【问题标题】:React native IOS touch event need to tap twice when the keypad is openedReact原生IOS触摸事件需要在键盘打开时点击两次
【发布时间】:2018-09-29 22:59:52
【问题描述】:

我正在使用在 Flatlist 中具有 textInput 字段的子组件。当我第一次单击提交按钮时,键盘被关闭,而我第二次尝试捕获实际的提交事件。

    <FlatList
    ref={(ref) => { this.flatListRef = ref; }}
    data={this.state.pannelData}                   
    keyExtractor={item => item.type}
    getItemLayout={this.getItemLayout}                    
    keyboardShouldPersistTaps='handled'
    scrollEventThrottle={16}
    ListFooterComponent={() => { return <FooterComponent/> }} />

问题仅在 IOS 和 android 上按预期工作。
反应 - “^16.3.1”
反应原生 - “^0.55.3”

【问题讨论】:

    标签: javascript ios swift reactjs react-native


    【解决方案1】:

    将此道具keyboardShouldPersistTaps={true} 与您的平面列表一起使用。

    【讨论】:

    • 我也尝试了文档中提到的keyboardShouldPersistTaps='always',但问题仍然存在
    猜你喜欢
    • 2020-04-24
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多