Mobile | Tue May 09 202314,778 views

Tutorial Keyboard Avoiding View

Keyboard avoiding view

Hello friend!

In this video we learn how to use KeyboardAvoidingView with React Native

Example

<SafeAreaView style={{ flex: 1 }}>
  <View style={styles.container}>
    <Text style={styles.title}>Chat GPT</Text>
    <KeyboardAvoidingView
      style={{ flex: 1 }}
      behavior={Platform.OS === "ios" ? "padding" : undefined}
      keyboardVerticalOffset={60}
    >
      <FlatList
        data={conversation}
        renderItem={({ item }) => <MessageBubble {...item} />}
        keyExtractor={(_, index) => index.toString()}
        contentContainerStyle={{ paddingHorizontal: 10, gap: 10 }}
      />
      <Input />
    </KeyboardAvoidingView>
  </View>
</SafeAreaView>

👍 Want to become a master in React Native? Check the React Native Course

Youtube GitHub

Go back to Projects

Support Our Community

Take your skills to the next level by enrolling in our courses!

React Native CourseMaster React with TypeScriptMaster Git & GitHubLiveStore Course

Your support helps us continue creating valuable resources for everyone. ❤️