javascript - 输入问题上的换行符 - ReactNative(仅限 Android)
问题描述
当在android中按下输入按钮时,我试图将我的句子移动到一个新行中。但即使我按下回车按钮,文本也不会中断并继续作为一个单词。
例如;
这就是我需要的
你好
如何
是
你
但我最终得到这样的文字
你好吗
请注意,这在 ios 中完美运行。问题在于 android 键盘。我怎样才能解决这个问题?
我认为的一种方法是在我按下回车键时在我的文本输入中包含一个<br>
或。\n
按回车键时如何包含这些标签之一。
我的代码
addTextToQuestion(value) {
this.setState({headingState: value});
}
<TextInput
multiline={true}
blurOnSubmit={false}
autoFocus={true}
underlineColorAndroid='transparent'
allowFontScaling={false}
style={styles.questionText}
placeholderTextColor="#C0C0C0"
onChangeText={this.addTextToQuestion.bind(this)}
placeholder={"Your question goes here"}
/>
解决方案
推荐阅读
- java - 使用 JpaPagingItemReader 时无法获取基于不同 pageSize 和 ChunkSize 的所有记录
- javascript - html 文件输入接受 .zip 文件
- rust - 没有为 Rocket 的 UUID 找到 Serde 的序列化实现
- sql - 字段作为子字符串
- sql - 使用 MyBatis 的 SQL 异常
- excel - 如何将网站数据抓取到 excel 中,但将结果附加到日志中
- ios - 在这种情况下,“ContentMode”对于类型查找不明确
- amazon-web-services - Invoke-WmiMethod:向 EC2 实例发送消息时访问被拒绝
- ios - UITableView 使用 willDisplay 拉取刷新和分页
- angular - 带字符串标记的角度动态 DI