diff --git a/src/components/ScreenWrapper/index.js b/src/components/ScreenWrapper/index.js index f5f0f2fadd41..766de729586c 100644 --- a/src/components/ScreenWrapper/index.js +++ b/src/components/ScreenWrapper/index.js @@ -29,6 +29,17 @@ class ScreenWrapper extends React.Component { onPanResponderRelease: toggleTestToolsModal, }); + this.keyboardDissmissPanResponder = PanResponder.create({ + onMoveShouldSetPanResponderCapture: (e, gestureState) => { + const isHorizontalSwipe = Math.abs(gestureState.dx) > Math.abs(gestureState.dy); + if (isHorizontalSwipe && this.props.shouldDismissKeyboardBeforeClose) { + return true; + } + return false; + }, + onPanResponderGrant: Keyboard.dismiss, + }); + this.state = { didScreenTransitionEnd: false, }; @@ -96,35 +107,41 @@ class ScreenWrapper extends React.Component { return ( - - - - {this.props.environment === CONST.ENVIRONMENT.DEV && } - {this.props.environment === CONST.ENVIRONMENT.DEV && } - { - // If props.children is a function, call it to provide the insets to the children. - _.isFunction(this.props.children) - ? this.props.children({ - insets, - safeAreaPaddingBottomStyle, - didScreenTransitionEnd: this.state.didScreenTransitionEnd, - }) - : this.props.children - } - {this.props.isSmallScreenWidth && this.props.shouldShowOfflineIndicator && } - - + + + {this.props.environment === CONST.ENVIRONMENT.DEV && } + {this.props.environment === CONST.ENVIRONMENT.DEV && } + { + // If props.children is a function, call it to provide the insets to the children. + _.isFunction(this.props.children) + ? this.props.children({ + insets, + safeAreaPaddingBottomStyle, + didScreenTransitionEnd: this.state.didScreenTransitionEnd, + }) + : this.props.children + } + {this.props.isSmallScreenWidth && this.props.shouldShowOfflineIndicator && } + + + ); }}