scrollResponderHandleStartShouldSetResponderCapture: function()

in deprecated-react-native-listview/ScrollResponder.js [208:250]


  scrollResponderHandleStartShouldSetResponderCapture: function(
    e: PressEvent,
  ): boolean {
    // The scroll view should receive taps instead of its descendants if:
    // * it is already animating/decelerating
    if (this.scrollResponderIsAnimating()) {
      return true;
    }

    // Allow any event touch pass through if the default pan responder is disabled
    if (this.props.disableScrollViewPanResponder === true) {
      return false;
    }

    // * the keyboard is up, keyboardShouldPersistTaps is 'never' (the default),
    // and a new touch starts with a non-textinput target (in which case the
    // first tap should be sent to the scroll view and dismiss the keyboard,
    // then the second tap goes to the actual interior view)
    const {keyboardShouldPersistTaps} = this.props;
    const keyboardNeverPersistTaps =
      !keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';

    if (typeof e.target === 'number') {
      if (__DEV__) {
        console.error(
          'Did not expect event target to be a number. Should have been a native component',
        );
      }

      return false;
    }

    if (
      keyboardNeverPersistTaps &&
      this.scrollResponderKeyboardIsDismissible() &&
      e.target != null &&
      !TextInputState.isTextInput(e.target)
    ) {
      return true;
    }

    return false;
  },