react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.3k stars 4.97k forks source link

Keyboard hides => shows => hides when navigating back (from ios gesture only) from a screen where keyboard is shown #11963

Open nikolasgioannou opened 3 weeks ago

nikolasgioannou commented 3 weeks ago

Current behavior

Apr-24-2024 17-12-33

As you can see, when i start the gesture, it dismiss keyboard as expected. But when the gesture ends, it pops back up the keyboard.

Expected behavior

I expect the keyboard to stay dismissed when the gesture finishes.

Reproduction

https://github.com/nikolasgioannou/react-navigation-bug

Platform

Packages

Environment

package version
@react-navigation/native "^6.1.17",
@react-navigation/stack "^6.3.29"
react-native-safe-area-context "4.8.2",
react-native-screens "~3.29.0"
react-native-gesture-handler "~2.14.0",
react-native "0.73.6",
expo "~50.0.14",
node 18.14.2
npm or yarn 1.22.19
ach5910 commented 3 weeks ago

I'm having the same problem. If I use the native stack navigator, instead of the js based stack navigator, the issue doesn't occur. Unfortunately, the project I'm working on is large and we have already bought into the unique customization offered by the js stack navigator so switching now is not an option.

For any one else running into this problem I did find a work-around for the time being by toggling the gestureEnabled screen option when the keyboard visibility changes. Here's a link applying it to the reproduction example @nikolasgioannou posted with the bug https://snack.expo.dev/BePQKvC4CL3Y1k5668sHT