react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

Android: Keyboard gets closed immediately

Open asapMaki opened this issue 2 years ago • 5 comments

Environment

"react-native-pager-view": "^6.1.2" "react-native": "0.65.3" "react-navigation": all packages 5.x.x "react-native-screens": "3.4.0", -> this is where usually this bug is solved but it didn't work for me

AndroidManifest.xml: android:windowSoftInputMode="adjustResize" - I need this, otherwise adjustPan pushes the header as well when keyboard is opened

Description

So after trying out many combinations and solutions, this is what I found. Hope you can help me.

We have multi page apply form process. This includes input on almost every screen. Issue happens first time when I focus on input, it automatically closes. I tried combinations when:

  • Parent does not rerender and I only have 2 pages - It works as expected (but I will never have only 2 pages)
  • Parent does not rerender and I there are more than 2 pages - keyboard opens and closes immediately
  • Parent rerenders and I there are more than 2 pages - keyboard opens and closes immediately
  • Tried with collapsable props, still the same

Reproducible Demo

viewPager?.current?.setPage(currentPage + 1)

<PagerView
      style={{ flex: 1 }}
      initialPage={0}
      scrollEnabled={false}
      ref={viewPager}>
      <View key="0">
        <Input
          name="input"
          placeholder="placeholder"
        />
      </View>
      <View key="1">
        <Input
          name="input"
          placeholder="placeholder"
        />
      </View>
      <View key="2">
        <Input
          name="input"
          placeholder="placeholder"
        />
      </View>
    </PagerView>

asapMaki avatar Dec 13 '22 08:12 asapMaki

Have same problem

SemenovDeveloper avatar Jan 10 '23 09:01 SemenovDeveloper

Same problem. We need a fix as soon as possible.

robertpg3 avatar Jun 29 '23 11:06 robertpg3

Anyone find a workaround?

I'm not using PagerView directly, but I believe I'm seeing the same issue via react-navigation-material-top-tabs.

"react-native": "0.71.13",
"react-native-pager-view": "6.1.2",
"@react-navigation": all 6.x.x
"react-native-screens": "~3.20.0",

Edit: To elaborate, I've seen some reports where the keyboard only closes on the first focus. In my situation, the field blurs and keyboard closes every time any <TextInput/> is tapped, making it impossible to enter text.

dcanora avatar Oct 09 '23 18:10 dcanora

i have the same issue on the first tap. @asapMaki did you solve this?

AyoCodess avatar Mar 30 '24 09:03 AyoCodess