了解 textInput 并浏览文档 [英] Understanding textInput and navigating the documentation

查看:26
本文介绍了了解 textInput 并浏览文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

三个问题:

1) 如果您有多个 textInput 字段,您如何确定正在使用哪个字段?

1) if you have multiple textInput fields how do you determine which one is being used?

2) onchangeText 和 onsubmitEditing 返回给函数的内容

2) with both onchangeText and onsubmitEditing what is being returned to the function

onSubmitEditing={()=>{this.clearText()}}
onChangeText={(text) => {this.captureInput(text)}}

我在 onChangeText() 文本中得到了输入字段中的值.是否有任何其他参数被传递回该函数?

I get that in onChangeText() text gives me the value in the input field. Are there any other parameters being passed back to that function?

此外,在 onsubmitEditing() 中,我如何访问传递给 clearText() 的事件参数?

Also, in onsubmitEditing() how do I access the event parameters being passed to clearText()?

我已阅读此处的文档DOCS但它没有回答我的问题

I've read the documentation found here DOCS but it doesn't answer my question

3) 您在文档中的何处找到这些答案?

3) Where in the documentation do you find these answers?

推荐答案

1) 您只需调用不同的处理程序来分别处理它们:

1) You just call different handlers to handle them separately:

<TextInput onChangeText={text => this.handleFirstInput(text)} />
<TextInput onChangeText={text => this.handleSecondInput(text)} />

2) 没有其他参数传递给它们.你还需要什么?您可以为它们设置 ref,但如果可能,请避免这样做.

2) There's no other parameters passed to them. What else do you need? You can set a ref on them but avoid that if possible.

这篇关于了解 textInput 并浏览文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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