确定事件目标是否为“TextInput”

时间:2017-03-09 01:44:15

标签: react-native

我正在尝试为我的React-Native表单中的双击<ScrollView> issue创建一个work-arround。

该线程的答案之一非常接近,它使用以下代码:

<ScrollView
    showsVerticalScrollIndicator={true}
    automaticallyAdjustContentInsets={false}
    contentContainerStyle={styles.content}
    keyboardDismissMode='on-drag'
    keyboardShouldPersistTaps={true}>
    <View
      onStartShouldSetResponderCapture={(e) => {
        const focusField = TextInputState.currentlyFocusedField();

        if (focusField != null && e.nativeEvent.target != focusField){
          dismissKeyboard();
        }
      }}>
        ...
    </View>
</ScrollView>    

如果你没有点按当前选中的TextInput,这会取消键盘,如果e.nativeEvent.target不是TextInput,我想将其更改为仅关闭键盘点击其他输入时关闭并重新打开键盘。但是,e.nativeEvent.target是一个数字。

如何从此句柄中获取节点类型?

由于

0 个答案:

没有答案
相关问题