Understanding textInput and navigating the documentation

流过昼夜 提交于 2019-12-25 00:52:50

问题


three questions:

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

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

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

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?

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

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

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) 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.



来源:https://stackoverflow.com/questions/50090054/understanding-textinput-and-navigating-the-documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!