Animation 反应本机:键盘AvoidingView未设置动画

Animation 反应本机:键盘AvoidingView未设置动画,animation,react-native,keyboard,textinput,react-animated,Animation,React Native,Keyboard,Textinput,React Animated,当键盘出现时,是否有什么特殊的方法使视图向上滑动? 根据我所看到的所有例子,默认情况下它会这样做,但在我这方面,它直接从A点到B点 这是我的渲染,其中FadeInView只是一个动画。视图: <FadeInView style={{ flex: 1 }}> <KeyboardAvoidingView style={s.container} contentContain

当键盘出现时,是否有什么特殊的方法使视图向上滑动? 根据我所看到的所有例子,默认情况下它会这样做,但在我这方面,它直接从A点到B点

这是我的渲染,其中FadeInView只是一个动画。视图:

<FadeInView style={{ flex: 1 }}>
                <KeyboardAvoidingView
                    style={s.container}
                    contentContainerStyle={{alignItems: 'center'}}
                    behavior="position"
                    keyboardVerticalOffset={-80}
                >
                    <View style={{
                        width: 100, height: 100, borderWidth: 1,
                        borderColor: '#E0E0E0', marginBottom: 30,
                    }} />
                    <Item>
                        <Input
                            placeholder={t('login:username')}
                            onChangeText={(username) => { username = username.trim(); return this.setState({ username }); }} />
                    </Item>
                    <Item style={{ marginBottom: 10 }}>
                        <Input
                            secureTextEntry={true}
                            placeholder={t('login:password')}
                            onChangeText={(password) => { password = password.trim(); return this.setState({ password }); }} />
                    </Item>
                    {isFetching ?
                        <TouchableOpacity
                            disabled={true}
                            style={cs.button}
                            onPress={() => this.onLogin()}>
                            <Text>{t('common:loading').toUpperCase()}</Text>
                        </TouchableOpacity>
                        :
                        <TouchableOpacity
                            activeOpacity={0.7}
                            style={cs.button}
                            onPress={() => this.onLogin()}>
                            <Text style={cs.buttonText}>{t('login:login').toUpperCase()}</Text>
                        </TouchableOpacity>
                    }
                    {errorMessage != null &&
                        <Text style={cs.errorMessage}>{errorMessage}</Text>
                    }
                </KeyboardAvoidingView>
            </FadeInView>

抱歉,代码太大了,但我对这个问题有点绝望。。。谢谢

可能是您的代码错误,但大多数情况下都是键盘本身的问题。检查此链接:我已切换到。
const s = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#fff',
        alignItems: 'center',
        paddingTop: 50,
        paddingRight: 20,
        paddingLeft: 20,
    },
});