如果您的内容超出屏幕高度,您可能会缺少<ScrollView>。
您可能还需要一个KeyboardAvoidingView,以确保TextInput 没有被键盘覆盖(或隐藏)。
这里我添加了几个<View>的来模拟一些内容。
import React from "react";
import {
StyleSheet,
View,
TextInput,
ScrollView,
KeyboardAvoidingView
} from "react-native";
export default class App extends React.Component {
render() {
return (
<KeyboardAvoidingView behavior="padding">
<ScrollView>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<TextInput
autoFocus
placeholder="Textinput far below..."
style={{ height: 20, backgroundColor: "red" }}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
<View
style={{
height: 100,
width: 100,
backgroundColor: "rgba(0, 0, 0, 0.3)"
}}
/>
</ScrollView>
</KeyboardAvoidingView>
);
}
}