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] [Android] Issue with TextInput element in the bottom of a FlatList

See original GitHub issue

Description: TextInputs at the bottom of the screen in a FlatList automatically and immediately dismiss the keyboard on focus, making it impossible to write anything in it. The issue is reproducible easily on a blank react-native init project. I tested it in Nexus 5x simulator and real device. I reproduce the bug every time on 0.61.

Reproduction Steps and Sample Code

<FlatList
          data={this.state.items}
          style={{ flex: 1 }}
          renderItem={(i) => (
            <View style={{ flexDirection: "row", borderBottomWidth: 1, borderBottomColor: "#333", padding: 24 }}>
              <Text style={{}}>{i.index}</Text>
              <TextInput style={{ flex: 1, backgroundColor: "#bbb" }} />
            </View>
          )}
        />

React Native version:

    OS: macOS 10.15.3
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 106.97 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 8.16.0 - /usr/local/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 23, 26, 28
      Build Tools: 25.0.1, 27.0.3, 28.0.3, 29.0.0
      System Images: android-19 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.5429.30.34.5452501
    Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.4 => 0.61.4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:9

github_iconTop GitHub Comments

47reactions
Silviu-Mariancommented, Apr 23, 2020

set removeClippedSubviews={false}

9reactions
FabianBGcommented, Apr 30, 2020

I faced the same issue, I have a code like this:

<View>
    <FlatList
      onEndReached={handleEndReach}
      data={props.items}
      renderItem={renderRow}
      keyExtractor={getKey}
      onEndReachedThreshold={0.01}
    />
</View>

I can’t use the last input from the flat list because it shows and hide immediately the keyboard, as some workarounds I fond some android manifest solutions but none of this worked for me so I changed the View for a ScrollView wrapper of the FlatList and it solved the problem. Maybe it is a problem when it scroll to make visible the input and the keyboard on a View Screen.

Solution:

<ScrollView>
    <FlatList
      onEndReached={handleEndReach}
      data={props.items}
      renderItem={renderRow}
      keyExtractor={getKey}
      onEndReachedThreshold={0.01}
    />
</ScrollView>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with TextInput element in the bottom of a FlatList
The issue is reproducible easily on a blank react-native init project. I tested it in Nexus 5x simulator and real device.
Read more >
Issue with TextInput element in the bottom of a FlatList-React ...
Coding example for the question Issue with TextInput element in the bottom of a FlatList-React Native.
Read more >
Optimizing Flatlist Configuration - React Native
Cons: Be aware that this implementation can have bugs, such as missing content (mainly observed on iOS), especially if you are doing complex ......
Read more >
A deep dive into React Native FlatList - LogRocket Blog
To solve this problem, check if you are loading images from the local storage or from the network (an API). React Native's Image...
Read more >
How to Add a Search Bar in a FlatList in React Native Apps
There are three primary props that a FlatList component requires to display a list of data: ... To understand this, let's build a...
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