Skip to content

Android: KeyboardAvoidingView behavior height not working properly on different TextInput keyboardTypes #28004

@devstarman

Description

@devstarman

Description:

With 2 different TextInputs (default and keyboardType="number-pad") wrapped in KeyboardAvoidingView with behavior set to "height" and a single button on the bottom of the screen, keyboard avoiding is not behaving correctly.
Opening first TextInput (default) results in proper showing button placed on the bottom, but as soon as we switch to second TextInput (set to "number-pad") screen is not scaled properly and button hides behind a keyboard.

keyboard-bug

React Native version:

System:
OS: Windows 10 10.0.17134
CPU: (8) x64 Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
Memory: 4.43 GB / 15.87 GB
Binaries:
Node: 10.15.3 - C:\dev\nodejs\node.EXE
Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\dev\nodejs\npm.CMD
SDKs:
Android SDK:
API Levels: 24, 25, 26, 27, 28, 29
Build Tools: 25.0.2, 26.0.2, 27.0.3, 28.0.0, 28.0.3, 29.0.2
System Images: android-24 | Android TV Intel x86 Atom, android-24 | Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5791312
npmPackages:
react: 16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4

Steps To Reproduce

  1. Initialize a new RN project
  2. Copy/paste code from snack: https://snack.expo.io/@devstarman/keyboardavoidingview-textinput-bug
  3. Run the app using react-native run-android
  4. Click at first TextInput (with placeholder "enter text")
  5. Click at second TextInput (with placeholder "enter number")
  6. Observe how the "next" button disappears.

Expected Results

It's expected to scale properly no matter what type of keyboard is used in TextInput.
Changing behavior to "padding" solves issue BUT then there is another issue already reported in Dec 2019: #27526

Snack, code example, screenshot, or link to a repository:

https://snack.expo.io/@devstarman/keyboardavoidingview-textinput-bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions