繁体   English   中英

ListView在IOS键盘后面呈现 - React Native

[英]ListView renders behind IOS keyboard - React Native

在我的react-native应用程序中,我有一个View,它呈现TextInput和ListView。 ListView根据TextInput中键入的内容进行填充。

<View styleComponent={styleComponent.mainContainer}>
  <TextInput
    onChangeText={this.onTyping.bind(this)}
    value={this.state.text} />
  <ListView
    dataSource={this.state.dataSource}
    renderRow={(rowData) => this._renderRow(rowData)} />
</View>

我的问题是ListView的一部分是在IOS键盘后面呈现的。 有没有任何方法,没有外部库,告诉ListView在可用空间中呈现,即不在键盘下。

您应该使用onBluronFocus事件或键盘事件插件,并在键盘打开时调整列表样式。 看看这个: 如何自动滑动窗口从后面键盘 - 当textinput-have-focus时

使用react native的keyboar避免查看KeyboardAvoidingViewExample Like

import {ScrollView, Text, TextInput, View, KeyboardAvoidingView} from "react-native";

并在渲染函数中嵌套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>

它将照顾到这一点

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM