我使用keyboardAvoidingView来显示输入并使用了下一个焦点。但是,当我单击第一个输入(打印标签1623-Acidez)时,这是隐藏的。如何显示呢?

javascript - React-Native-KeyboardAvoidingView-错误-LMLPHP
javascript - React-Native-KeyboardAvoidingView-错误-LMLPHP

<ReactNative.View key={this.state.selectedTabIndex}>
                <ReactNative.ScrollView style={{ height: this.props.styles.height - 40 }}>

                    <ReactNative.KeyboardAvoidingView
                        keyboardVerticalOffset={0}

                        behavior="position"
                        contentContainerStyle={{ paddingTop: this.state.size }}
                    >
                        {this.tabs[this.state.selectedTabIndex].render()}
                    </ReactNative.KeyboardAvoidingView>

                </ReactNative.ScrollView>
            </ReactNative.View>

最佳答案

如果您将'keyboardVerticalOffset'增加到更大的值,例如KeyboardAvoidingView的'100'到更大的值,它将从键盘向上滚动,从而避免了这种情况。我也花了很多时间在互联网上找到正确的解决方案,但最终自己想出了“反应” -native'版本'0.50.4'。我像这样工作

<View style={…..}>
      <ScrollView>
         <KeyboardAvoidingView style={{ flex: 1 }}
            keyboardVerticalOffset={100} behavior={"position"}>

        </KeyboardAvoidingView>
      </ScrollView>
 </View>

07-26 01:27