React Native have to double click for onPress to work

前端 未结 2 1613
隐瞒了意图╮
隐瞒了意图╮ 2020-12-17 09:07

I\'m using React Native with the Native Base library. I need an onPress event to fire on Native Base\' ListItem (equivalent to TouchableOpacity) when the keyboard is open. <

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-17 09:45

    For new googlers, in my case, I had a flatlist with an onPress property, and a searchBar. I wanted to press the row even when the keyboard is up, and I could do it only by double tap.Finally the problem was tackled by using "keyboardShouldPersistTaps" of the flatlist:

    Hide_Soft_Keyboard=()=>{
          Keyboard.dismiss();
        }
    
    ....
    
                    
                           (
                            {this.Hide_Soft_Keyboard(); this.props.navigation.navigate('Screen2')}}                                                      
                            /> ) }
                            />
                      
    

提交回复
热议问题