douglasjunior / react-native-keyboard-manager

⚛ Library to prevent issues of keyboard sliding up and cover inputs on React-Native iOS projects.
https://www.npmjs.com/package/react-native-keyboard-manager
MIT License
952 stars 60 forks source link

Attempting to swipe back but not actually swiping back causes undesirable blank view while text input is focused #89

Closed itsramiel closed 2 years ago

itsramiel commented 2 years ago

https://user-images.githubusercontent.com/80689446/160818446-082d47ad-19ae-460b-bd5e-71fd51bb7933.mp4

https://user-images.githubusercontent.com/80689446/160818617-ffcfb84d-9dbb-4b6c-8a66-f7449ecc2985.mp4

I understand that this package depends on IQKeyboardManager, and this issue was opened a long time in https://github.com/hackiftekhar/IQKeyboardManager/issues/1361. It was mentioned that it was resolved but it doesnt seem to be.

Can you please confirm the bug and if possible suggest a solution if any?

douglasjunior commented 2 years ago

I've never encountered this problem in the projects I've worked on.

This seems to be a conflict related to the navigation library. Are you using React Navigation? react-native-screens? Because in React Navigation we have just one native screen, and then the internal screens are simulated with "Views" and animation.

Can you share a reproducible example with these libraries together?

itsramiel commented 2 years ago

sure. I will work one a reproducable demo compiled using eas build and share the result and the repo link. And yes I am using react navigation and react-native-screens

itsramiel commented 2 years ago

Same results with the following minimal repo:

https://user-images.githubusercontent.com/80689446/160873297-10bf5e3b-fb2d-4196-938f-d1eeb60f847b.mp4

https://user-images.githubusercontent.com/80689446/160873325-bd061fc5-b150-4dd5-81bb-6732fa47aead.mp4

douglasjunior commented 2 years ago

Bingo, the problem is related to "@react-navigation/native-stack". Replacing to "@react-navigation/stack" the problem dont happens.

I will report to IQKeyboardManager and make myself available to help if necessary.

Let's follow the thread https://github.com/hackiftekhar/IQKeyboardManager/issues/1361 and https://github.com/hackiftekhar/IQKeyboardManager/issues/1422

douglasjunior commented 2 years ago

I created a native iOS Xcode project, with Storyboards and Navigation Controllers, and problem don't happen.

keyboard manager

This make me think that the "react-native-screens" uses some strategy to do a "native navigation" that's breaking the IQKeyboardManager.

Possible related issues: https://github.com/software-mansion/react-native-screens/issues?q=is%3Aissue+blank+ios

itsramiel commented 2 years ago

yes confirmed that the bug is not there when using stack instead of native stack. thank you!!

hirbod commented 2 years ago

@ramiel1999 maybe worth an issue report at react-native-screens.

landabaso commented 9 months ago

For the moment, I think it's better to disable gestures when using the native-stack.

      <NativeStack.Navigator
        screenOptions={{
          //Disable goBack with gesture to prevent this issue:
          //https://github.com/douglasjunior/react-native-keyboard-manager/issues/89
          ...(Platform.OS === 'ios' ? { gestureEnabled: false } : {}),
        }}
      >
itsramiel commented 9 months ago

For the moment, I think it's better to disable gestures when using the native-stack.

      <NativeStack.Navigator
        screenOptions={{
          //Disable goBack with gesture to prevent this issue:
          //https://github.com/douglasjunior/react-native-keyboard-manager/issues/89
          ...(Platform.OS === 'ios' ? { gestureEnabled: false } : {}),
        }}
      >

That's a behavior almost all ios user rely on. Definitely not a good solution. A solution I found was to use scrollviews instead of views for the parent component of the screen if possible because then it doesnt happen

landabaso commented 9 months ago

That's a behavior almost all ios user rely on. Definitely not a good solution. A solution I found was to use scrollviews instead of views for the parent component of the screen if possible because then it doesn't happen

It's a bad solution. However, when the bug occurs then the App gets broken in my case, which is even worse. I am already using <ScrollView> as the parent component of all the Screens. The bug shows up after the TextInput is blurred in my case.