I have component in tabnavigator. In my component I have text multiple line so I want use KeyboardAvoidingView to push screen when keyboard show, when I enter multiple line in InputText keyboard over it. Here is my code:
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'}
/>
);
}
}
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 >
);
}
}
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
},
});
It only happen when I add code in component on TabNavigator, when add in App.js it work fine How I can fix my bug? Thank you very much!