KeyboardAvoidingView不与TabNavigator的工作

Trầ*_*òa 5 react-native

我在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中添加时,它可以正常工作如何修复我的错误?非常感谢你!

Hie*_*yen 0

我遇到了同样的问题,尽管我有一种不同的方法,基本上会在键盘出现时计算和定位(使用translateY)视图。

我已经发布在这里,访问react-native-spacer了解更多默认值