在 react-native 中滚动时修复了导航栏

Sar*_*Vin 1 android react-native

我有 android 和滚动视图的问题。我想在软键盘打开时看到文本输入。

所以我使用这个组件 => https://github.com/sarovin/react-native-scrollview-smart

但问题是导航栏没有固定在顶部而是消失了......

错误的 Gif

导航栏是 react-native-router-flux => https://github.com/aksonov/react-native-router-flux 的一个组件

有什么建议吗?

谢谢

Waq*_*med 5

使用 react native 的键盘避免视图 KeyboardAvoidingViewExample Like

import {ScrollView, Text, TextInput, View, KeyboardAvoidingView} from "react-native";
Run Code Online (Sandbox Code Playgroud)

并在渲染函数中嵌套ViewTextInput

<ScrollView style={styles.container}>
          <KeyboardAvoidingView behavior='position'>
                <View style={styles.textInputContainer}>
                  <TextInput
                    value={pin}
                    style={styles.textInput}
                    keyboardType='default'
                    returnKeyType='next'
                    onChangeText={this.handleChangePin}
                    underlineColorAndroid='transparent'
                    placeholder={I18n.t('pin')}/>
                </View>
          </KeyboardAvoidingView>
        </ScrollView>
Run Code Online (Sandbox Code Playgroud)

它会照顾到