Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0.2-alpha.0 introduces a bug that causes modal to not dismiss properly if dismiss pressable is inside modal #171

Closed
mr-moto opened this issue Jan 9, 2021 · 3 comments
Labels
bug Something isn't working v3 Written in Reanimated v2

Comments

@mr-moto
Copy link
Contributor

mr-moto commented Jan 9, 2021

Bug

v3.0.20alpha introduces a modal dismiss bug.
If a dismiss function is called from within the modal ( eg button inside modal that calls dismiss() ), handleOnChange will not be called and will prevent the modal from presenting once closed. similar to #168.

(_contentGestureState === State.END ||
_contentGestureState === State.UNDETERMINED) &&

the state of _contentGestureState is 2 (onStart) which does not equal END or UNDETERMINED

Environment info

Library Version
@gorhom/bottom-sheet 3.0.2-alpha.3
react-native 0.63.4
react-native-reanimated 2.0.0-rc.1
react-native-gesture-handler 1.9.0

Steps To Reproduce

  1. run the modal simple example
  2. add a button inside a modal
<TouchableOpacity onPress={()=>modalRef.current.dismiss()}><Text>Dismiss by ref</Text></TouchableOpacity>
<TouchableOpacity onPress={dismissModal}><Text>Dismiss by calling function</Text></TouchableOpacity>
<TouchableOpacity onPress={()=>dismiss('modalName')}><Text>Dismiss by hook</Text></TouchableOpacity>
<TouchableOpacity onPress={dismissAll}><Text>Dismiss All by hook</Text></TouchableOpacity>
  1. present -> dismiss using one of the buttons inside the modal -> present ( does not present )

Describe what you expected to happen:

  1. present modal after dismissing
@mr-moto mr-moto added the bug Something isn't working label Jan 9, 2021
@mr-moto
Copy link
Contributor Author

mr-moto commented Jan 9, 2021

const gestureHandler = useAnimatedGestureHandler<

the onActive and onEnd is not triggered in the gesture handler. only onStart gets triggered which sets the state to 2 ( which is the same behavior as 3.0.1 ) so I assume we just need to remove that part of the if statement or change it to _contentGestureState === State.START

@gorhom
Copy link
Owner

gorhom commented Jan 9, 2021

thanks @mr-moto for spotting this bug ! indeed it is an issue with useInteractivePanGestureHandler!

submitting a pr shortly :)

@gorhom gorhom added the v3 Written in Reanimated v2 label Jan 9, 2021
@gorhom
Copy link
Owner

gorhom commented Jan 9, 2021

this should be resolved with v3.1.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v3 Written in Reanimated v2
Projects
None yet
Development

No branches or pull requests

2 participants