Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 当文本输入聚焦时,按两次使按钮工作_Reactjs_React Native - Fatal编程技术网

Reactjs 当文本输入聚焦时,按两次使按钮工作

Reactjs 当文本输入聚焦时,按两次使按钮工作,reactjs,react-native,Reactjs,React Native,尝试从TextInput组件提交数据时出现问题。当尝试按下调用处理文本的回调的按钮时,需要按下两次才能使其工作。一次用于TextInput失去焦点,第二次调用回调。 我尝试了这个解决方案,但对我来说不起作用 组成部分: <Modal> <ScrollView> <Card> <CardImage source={{uri: this.props.linkImage}}/> <CardCo

尝试从
TextInput
组件提交数据时出现问题。当尝试按下调用处理文本的回调的按钮时,需要按下两次才能使其工作。一次用于
TextInput
失去焦点,第二次调用回调。 我尝试了这个解决方案,但对我来说不起作用

组成部分:

  <Modal>
    <ScrollView>
      <Card>
        <CardImage source={{uri: this.props.linkImage}}/>
        <CardContent/>
      </Card>
      {
        this.state.single.map((comment) => {
          return comment[3] ?  
            <Comp/> : null                                           
          })
      }
  </ScrollView> 
    <KeyboardAvoidingView behavior="padding" enabled>   
      <CardAction>
      <TouchableOpacity>
        <IconFA name="reply"/>
      </TouchableOpacity>
      <TouchableOpacity>
        <IconEn name="thumbs-up"/>
      </TouchableOpacity>
      <TouchableOpacity>
        <IconEn name="thumbs-down"/>
      </TouchableOpacity>

      </CardAction> 
      <CardAction>
        <TextInput ref={input => this.input = input}/>
        <TouchableOpacity>
          <IconFA name="rocket"/>
        </TouchableOpacity> 
      </CardAction> 
    </KeyboardAvoidingView>             
  </Modal>

{
this.state.single.map((注释)=>{
返回注释[3]?
:null
})
}
this.input=input}/>

您为键盘ShouldPersistTaps道具提供了哪个值?
始终
虽然我可能会错过放置它的位置,但我应该在
键盘ShouldPersistTaps
中包装哪个组件?
是的,但是您建议用它包装哪个组件?