react-native-screens: React Navigation preventDefault() does not work with beforeRemove listener when using createNativeStackNavigator
Description
preventDefault()
does not work with beforeRemove
listener when using createNativeStackNavigator
when header back button is pressed. However, it works properly using the Android back button. Not sure if this is a react-navigation or react-native-screens bug since it works in some cases.
Steps To Reproduce
I have used the “Preventing going back” React Navigation code example and modified it to use createNativeStackNavigator. This causes the Alert to appear after the navigation is complete when clicking the back button in the header.
Expected behavior
preventDefault()
prevents the navigation for all methods of navigating.
Actual behavior
preventDefault()
does not prevent navigation when pressing the header back button.
Package versions
- React: 16.13.1
- React Native: 0.63.3
- React Native Screens: 2.15.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 18 (9 by maintainers)
@WoLewicki Wow that’s great work. I really appreciate your efforts. I’ll check it 😃