jeremybarbet / react-native-portalize

The simplest way to render anything on top of the rest.
MIT License
335 stars 22 forks source link

Can't click the buttons on the screen after the modal is closed #21

Open borasumer opened 2 years ago

borasumer commented 2 years ago

So I am using Portalize and Modalize. Wrap one of my Stack navigations with Host, and mount the modal in one of the screens of that stack, and open and close that model in the same screen. When I close the modal, for like half a second after, I cannot click on any buttons in that screen, as if the modal is not properly being closed/unmounted even though it is not there anymore. To click any buttons after the modal is closed, I either have to double click, or wait like half a sec and then click any button on that screen, which is very odd. This only happens if I open the modal and close it. When I remove the modal code from the screen, or not open it at all, the buttons are working fine. So there is no issue with the buttons.

This is my modal:

    <Portal>
      <Modalize
        closeAnimationConfig={{
          spring: {
            tension: 0,
          },
          timing: {
            duration: 500,
          },
        }}
        ref={modalRef}
        withHandle={false}
        adjustToContentHeight={!height}
        panGestureEnabled={!disableSwipeDown}
        modalHeight={height || null}
        scrollViewProps={{
          scrollEnabled: false,
        }}
      >
        {children}
      </Modalize>
    </Portal>

And this is how I use it in the screen:

  const modalRef = useRef(null);

 <Modal modalRef={modalRef}>
       //Children to render in the modal view
        <FooterContent modalRef={modalRef} />
 </Modal>
borasumer commented 2 years ago

I think it is closeAnimationConfig. It gives you an error if you remove the timing, and if you have any timing value, no matter how much it is, you have to wait for half a sec after you close the modal to interact with the screen again. Not sure exactly what I am doing wrong here. I thought I would be able to modify the animation without getting into timing.

juniorogaa commented 2 years ago

I think your question has been answered here -> https://github.com/jeremybarbet/react-native-modalize/issues/224