KeyboardAvoidingView:
1import { KeyboardAvoidingView, Platform } from "react-native";23<KeyboardAvoidingView4 behavior={Platform.OS === "ios" ? "padding" : "height"}5 style={{ flex: 1 }}6>7 <TextInput placeholder="Type here" />8</KeyboardAvoidingView>
Dismiss on tap outside:
1import { TouchableWithoutFeedback, Keyboard } from "react-native";23<TouchableWithoutFeedback onPress={Keyboard.dismiss}>4 <View style={{ flex: 1 }}>5 <TextInput />6 </View>7</TouchableWithoutFeedback>
ScrollView approach:
1<ScrollView keyboardShouldPersistTaps="handled">2 <TextInput />3 <Button title="Submit" />4</ScrollView>
Tips:
keyboardVerticalOffset for headers