我在屏幕底部使用反应原生的KeyboardAvoidingView
输入justifyContent:'flex-end'
)。键盘仍然隐藏输入。
<View
style={{
backgroundColor: AppConst.Colors.rowBg,
flex: 1,
paddingLeft: 20,
paddingRight: 20,
justifyContent: 'flex-end',
}}
>
<KeyboardAvoidingView behavior="padding">
<Text style={{ color: AppConst.Colors.blackApp, fontSize: 18 }}>
A description goes here
</Text>
<View
style={{
height: 50,
width: width - 40,
justifyContent: 'center',
paddingLeft: 20,
backgroundColor: '#FFF',
}}
>
<TextInput
style={{ color: AppConst.Colors.blackApp, backgroundColor: '#FFF', height: 50 }}
onChangeText={this.onChangeFriendCode}
placeholderTextColor={AppConst.Colors.grayApp}
value={this.state.token}
placeholder={this.props.store.translate('ENTER_CODE')}
tintColor={AppConst.Colors.mainApp}
maxLength={6}
autoCorrect={false}
/>
</View>
<Butto
captionStyle={{
color: AppConst.Colors.mainApp,
textAlign: 'center',
}}
caption={'A button here'}
/>
</KeyboardAvoidingView>
</View>