首页 > 解决方案 > React Native 键盘(多行)

问题描述

我的问题是进行多行文本输入时出现的键盘类型。

<TextInput
   keyboardType="default"
   multiline={false}
   editable={true}
   onChangeText={(text) => this.updateSharedObject({note: text})}
   value={this.state.data.note}
   placeholder="Press to type..."
   placeholderTextColor="#c0c0c0"
   underlineColorAndroid="transparent"
   autoCapitalize="sentences"
   style={[styles.textArea, {height: this.state.height}]}
   onContentSizeChange={(e) => 
   this.updateSize(e.nativeEvent.contentSize.height)}
 />

当用户尝试在字段中键入时,他们会得到这种键盘。

在此处输入图像描述

问题是我需要将该字段设为多行字段。当我将它设置为 true 时,键盘变成了这个。

在此处输入图像描述

无论如何保持第一个键盘布局,同时仍然使它成为多行?我一直在四处寻找,但没有找到任何帮助。

标签: androidreact-native

解决方案


<TextInput returnKeyType='done' />

推荐阅读