Skip to content

returnKeyType="done" causes a glitch at the bottom of the screen #1372

@romin-backpack

Description

@romin-backpack

returnKeyType="done" causes a glitch at the bottom of the screen on version 1.21.0 of the library. This happens only when there's a ScrollView or a FlatList/LegendList child. Reproducible example and screen recording below:

Example:

import { FlatList, StyleSheet, TextInput, View } from "react-native";
import { KeyboardAvoidingView } from "react-native-keyboard-controller";

const DATA = Array.from({ length: 30 }, (_, i) => i);

export function ConvertScreen() {
  return (
    <KeyboardAvoidingView behavior="padding" style={styles.flex}>
      <FlatList
        data={DATA}
        keyExtractor={(item) => String(item)}
        ListHeaderComponent={<Header />}
        renderItem={()=> (
          <View style={styles.item}>
            <View style={styles.itemInner} />
          </View>
        )}
      />
    </KeyboardAvoidingView>
  );
}

function Header() {
  return (
    <View style={styles.header}>
      <TextInput
        placeholder={"Enter text"}
        keyboardType="decimal-pad"
        style={styles.input}
        placeholderTextColor="#888"
      />
    </View>
  );
}

const styles = StyleSheet.create({
  flex: { flex: 1 },
  header: { padding: 16 },
  input: {
    borderWidth: 1,
    borderColor: "#444",
    borderRadius: 8,
    padding: 12,
    color: "white",
    fontSize: 16,
  },
  item: {
    height: 80,
    marginHorizontal: 16,
    marginVertical: 4,
    backgroundColor: "#1a1a2e",
    borderRadius: 8,
    justifyContent: "center",
    alignItems: "center",
  },
  itemInner: {
    width: 40,
    height: 40,
    backgroundColor: "#e94560",
    borderRadius: 4,
  },
});

Screen recording:
https://drive.google.com/file/d/1ZuRXOPpUhFb_kXi3mGSf_h38fo0nj7_j/view?usp=sharing

Metadata

Metadata

Assignees

Labels

KeyboardAvoidingView 🧪Anything related to KeyboardAvoidingView component🍎 iOSiOS specific🐛 bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions