React-native:在android中提交文本输入时,建议单词未清除 [英] React-native: when submitting a text input in android, the word suggestions are not cleared

查看:157
本文介绍了React-native:在android中提交文本输入时,建议单词未清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个使用React本机构建的Android应用.
该应用程序具有TextInput和提交按钮.
在输入文本输入时,默认键盘会开始提示单词(不确定如何调用此功能-自动完成或预测性文本).
单击提交时,将存储数据,并通过TextInput的"clear()"方法清除TextInput.例如:


I have an Android app built with React native.
The app has a TextInput and a submit button.
When typing in the text input, the default keyboard starts suggesting words (not sure how this feature is called - auto complete or predictive text).
When clicking submit, the data is stored and the TextInput is cleared via the "clear()" method of the TextInput. For example:

this.refs.textInput.clear();

由于某种原因,在调用"clear()"方法后未清除预测文本".结果,当用户再次开始键入时,预测文本将从其停止处继续,并且用户必须清除输入的文本.
注意:文本输入为多行.不确定是否与问题有关.

这是相同问题的示例: 示例

有关更多详细信息,请参见附件图像:

For some reason, the "predictive text" is not cleared after the "clear()" method is called. As a result, when the user start typing again, the predictive text continues from where it stopped and the user has to clear the text input.
Note: the text input is multi-line. Not sure if it has anything to do with the problem.

Here is example for the same issue: Example

See attached image for more details:

推荐答案

我找到了一个解决方案:
提交后,我将更改键盘并还原,如以下代码所示.

I found a solution:
On submit, I change the keyboard and revert back, like in the following code.

this.refs.textInput.setNativeProps({keyboardType:"email-address"});
this.refs.textInput.setNativeProps({keyboardType:"default"});

这篇关于React-native:在android中提交文本输入时,建议单词未清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆