我在TabNavigator的组成部分。在我的组件我有文字多行,所以我想利用KeyboardAvoidingView推送画面时,键盘秀,当我进入inputText的键盘比它多行。这是我的代码:
class UselessTextInput extends Component {
render() {
return (
<TextInput
{...this.props} // Inherit any props passed to it; e.g., multiline, numberOfLines below
editable={true}
autoFocus={false}
placeholder={Const.TEXT_INPUT_DELETE_ACCOUNT}
//maxLength={10000}
underlineColorAndroid='rgba(0,0,0,0)'
placeholderTextColor={'gray'}
/>
);
}
}Run Code Online (Sandbox Code Playgroud)
class SettingProfileDetail extends React.Component {
render(){
return (
<KeyboardAvoidingView behavior="padding" style={styles.container}>
<Text style={styles.textTitle}>
{Const.REASONDELETEACCOUNT}
</Text>
<UselessTextInput
style={styles.textInput}
multiline={true}
numberOfLines={1}
onChangeText={(text) => this.setState({ reason: text })}
value={this.state.reason}
/>
</KeyboardAvoidingView >
);
}
}Run Code Online (Sandbox Code Playgroud)
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
backgroundColor: 'white',
},
textTitle: {
fontFamily: font.bold,
textAlign: 'center',
color: '#666666',
marginTop: 20,
marginBottom: 18
},
textInput: {
fontFamily: font.normal,
marginLeft: 10,
marginRight: 10,
padding: 0
},
});Run Code Online (Sandbox Code Playgroud)
仅当我在TabNavigator上的组件中添加代码时才发生,当在App.js中添加时,它可以正常工作如何修复我的错误?非常感谢你!
| 归档时间: |
|
| 查看次数: |
575 次 |
| 最近记录: |