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;
    }

    // * 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 currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
    const {keyboardShouldPersistTaps} = this.props;
    const keyboardNeverPersistTaps =
      !keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
    if (
      keyboardNeverPersistTaps &&
      currentlyFocusedTextInput != null &&
      e.target &&
      !TextInputState.isTextInput(e.target)
    ) {
      return true;
    }

    return false;
  },
  scrollResponderHandleStartShouldSetResponder: function(e: Event): boolean {
    var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();

    if (this.props.keyboardShouldPersistTaps === 'handled' &&
      currentlyFocusedTextInput != null &&
      e.target !== currentlyFocusedTextInput) {
      return true;
    }
    return false;
  },
Example #3
0
 scrollResponderHandleStartShouldSetResponderCapture: function(e: Event): boolean {
   // First see if we want to eat taps while the keyboard is up
   var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
   if (!this.props.keyboardShouldPersistTaps &&
     currentlyFocusedTextInput != null &&
     e.target !== currentlyFocusedTextInput) {
     return true;
   }
   return this.scrollResponderIsAnimating();
 },
scrollResponderHandleStartShouldSetResponderCapture:function scrollResponderHandleStartShouldSetResponderCapture(e){

var currentlyFocusedTextInput=TextInputState.currentlyFocusedField();
if(!this.props.keyboardShouldPersistTaps&&
currentlyFocusedTextInput!=null&&
e.target!==currentlyFocusedTextInput){
return true;
}
return this.scrollResponderIsAnimating();
},
 scrollResponderHandleStartShouldSetResponderCapture: function(e: Event): boolean {
   // First see if we want to eat taps while the keyboard is up
   var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
   var {keyboardShouldPersistTaps} = this.props;
   var keyboardNeverPersistTaps = !keyboardShouldPersistTaps ||
                                   keyboardShouldPersistTaps === 'never';
   if (keyboardNeverPersistTaps &&
     currentlyFocusedTextInput != null &&
     !isTagInstanceOfTextInput(e.target)) {
     return true;
   }
   return this.scrollResponderIsAnimating();
 },
Example #6
0
  scrollResponderHandleResponderRelease: function(e: Event) {
    this.props.onResponderRelease && this.props.onResponderRelease(e);

    // By default scroll views will unfocus a textField
    // if another touch occurs outside of it
    var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
    if (!this.props.keyboardShouldPersistTaps &&
      currentlyFocusedTextInput != null &&
      e.target !== currentlyFocusedTextInput  &&
      !this.state.observedScrollSinceBecomingResponder &&
      !this.state.becameResponderWhileAnimating) {
      this.props.onScrollResponderKeyboardDismissed &&
        this.props.onScrollResponderKeyboardDismissed(e);
      TextInputState.blurTextInput(currentlyFocusedTextInput);
    }
  },
scrollResponderHandleResponderRelease:function scrollResponderHandleResponderRelease(e){
this.props.onResponderRelease&&this.props.onResponderRelease(e);



var currentlyFocusedTextInput=TextInputState.currentlyFocusedField();
if(!this.props.keyboardShouldPersistTaps&&
currentlyFocusedTextInput!=null&&
e.target!==currentlyFocusedTextInput&&
!this.state.observedScrollSinceBecomingResponder&&
!this.state.becameResponderWhileAnimating){
this.props.onScrollResponderKeyboardDismissed&&
this.props.onScrollResponderKeyboardDismissed(e);
TextInputState.blurTextInput(currentlyFocusedTextInput);
}
},
Example #8
0
  scrollResponderHandleStartShouldSetResponder: function(
    e: PressEvent,
  ): boolean {
    // Allow any event touch pass through if the default pan responder is disabled
    if (this.props.disableScrollViewPanResponder === true) {
      return false;
    }

    const currentlyFocusedTextInput = TextInputState.currentlyFocusedField();

    if (
      this.props.keyboardShouldPersistTaps === 'handled' &&
      currentlyFocusedTextInput != null &&
      e.target !== currentlyFocusedTextInput
    ) {
      return true;
    }
    return false;
  },
 isFocused: function(): boolean {
   return TextInputState.currentlyFocusedField() === ReactNative.findNodeHandle(this._inputRef)
 },
function dismissKeyboard() {
  TextInputState.blurTextInput(TextInputState.currentlyFocusedField());
}
 isFocused: function(): boolean {
   return TextInputState.currentlyFocusedField() ===
     React.findNodeHandle(this.refs.input);
 },
Example #12
0
 isFocused: function(): boolean {
   return TextInputState.currentlyFocusedField() ===
     this.refs.input.getNativeNode();
 },