question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FlatList in KeyboardAvoidingView ignores keyboard's height

See original GitHub issue

Description

FlatList in KeyboardAvoidingView ignores keyboard’s height and renderItems at bottom of FlatList are hidden. If I use inverted property in FlatList it works as I expected.

React Native version:

System:
    OS: macOS 11.0.1
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Memory: 2.28 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.18.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 26.0.2, 27.0.3, 28.0.2, 28.0.3
      System Images: android-23 | Google APIs Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1.1 4.1.1
    Xcode: 12.2/12B45b - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_66 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: 0.63.3 => 0.63.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

  1. Open project https://snack.expo.io/@zfanta/flat-list in iOS device
  2. Touch text input in bottom of screen to show keyboard

Expected Results

Items at bottom are hidden.

https://user-images.githubusercontent.com/6619332/102712475-f38d8380-4304-11eb-9a45-e18881f2c45c.MP4

If I use inverted property Items at bottom are not hidden.

https://user-images.githubusercontent.com/6619332/102712477-fb4d2800-4304-11eb-8a70-4c6f8837eb82.MP4

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

https://snack.expo.io/@zfanta/flat-list

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

4reactions
abehan7commented, Apr 7, 2022

why don’t you reverse your array with FlatList in inverted true?

i also got that problem but i found solution from inverted true

const dummy = [1,2,3,4,5,6,7,8,9,10]
...
<KeyboardAvoidingView > 
       <FlatList
            data={dummy.reverse()}
             inverted={true}
         />
</KeyboardAvoidingView>
1reaction
FrankyCTYcommented, Mar 26, 2022

Any one found a solution, or everyone moved to flutter?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use KeyboardAvoidingView with FlatList?
When I select the input I want it to scroll up above the keyboard. My code: return ( <KeyboardAvoidingView behavior='padding' style= ...
Read more >
View - React Native
'keyboardkey' - Used when the element acts as a keyboard key. ... For example, if a touchable view has a height of 20...
Read more >
nested textinput on scrollview react native - You.com | The AI ...
Your question is really unclear, but what I think you need is KeyboardAvoidingView. It's a built-in React Native component that resizes based on...
Read more >
[Solved]-KeyboardAvoidingView padding bug-React Native
Coding example for the question KeyboardAvoidingView padding bug-React Native. ... KeyboardAvoidingView - Reset height when Keyboard is hidden ...
Read more >
keyboard avoidance view not working on react native
<KeyboardAvoidingView. 2. keyboardVerticalOffset = {Header.HEIGHT + 20} // adjust the value here if you need more padding. 3. style = {{ flex: 1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found