Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard is visible for a brief moment on request/send money page after getting back from currency search page #15205

Merged
merged 10 commits into from
Feb 24, 2023
11 changes: 10 additions & 1 deletion src/components/ScreenWrapper/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {View} from 'react-native';
import {Keyboard, View} from 'react-native';
import React from 'react';
import _ from 'underscore';
import {withOnyx} from 'react-native-onyx';
Expand All @@ -16,6 +16,7 @@ import ONYXKEYS from '../../ONYXKEYS';
import {withNetwork} from '../OnyxProvider';
import {propTypes, defaultProps} from './propTypes';
import SafeAreaConsumer from '../SafeAreaConsumer';
import withKeyboardState from '../withKeyboardState';

class ScreenWrapper extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -45,6 +46,10 @@ class ScreenWrapper extends React.Component {
this.props.onTransitionEnd();
Navigation.setIsNavigating(false);
});
narefyev91 marked this conversation as resolved.
Show resolved Hide resolved
this.beforeRemoveSubscription = this.props.navigation.addListener('beforeRemove', () => {
if (!this.props.isKeyboardShown) { return; }
Keyboard.dismiss();
});
}

/**
Expand All @@ -69,6 +74,9 @@ class ScreenWrapper extends React.Component {
if (this.unsubscribeTransitionStart) {
this.unsubscribeTransitionStart();
}
if (this.beforeRemoveSubscription) {
this.beforeRemoveSubscription();
}
}

render() {
Expand Down Expand Up @@ -125,6 +133,7 @@ ScreenWrapper.defaultProps = defaultProps;
export default compose(
withNavigation,
withWindowDimensions,
withKeyboardState,
withOnyx({
modal: {
key: ONYXKEYS.MODAL,
Expand Down