问题描述:
React Native 在iOS端使用TextInput弹起键盘时,收起不了
解决方案:
// 先引入KeyboardAvoidingView组件,需要ScrollView组件配合使用
import { KeyboardAvoidingView, ScrollView, TextInput } from 'react-native';
<KeyboardAvoidingView
behavior="padding"
style={{ flex: 1 }}
>
<ScrollView>
...
<TextInput
style={styles.textInput}
underlineColorAndroid="transparent"
placeholder=""
defaultValue={}
onChangeText={text => this.change(text)}
/>
...
</ScrollView>
</KeyboardAvoidingView>