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
14 changes: 14 additions & 0 deletions src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import Str from 'expensify-common/lib/str';
import {Keyboard} from 'react-native';
import ONYXKEYS from '../../ONYXKEYS';
import OptionsSelector from '../../components/OptionsSelector';
import Navigation from '../../libs/Navigation/Navigation';
Expand All @@ -13,6 +14,7 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize
import * as IOU from '../../libs/actions/IOU';
import * as CurrencySymbolUtils from '../../libs/CurrencySymbolUtils';
import {withNetwork} from '../../components/OnyxProvider';
import withKeyboardState from '../../components/withKeyboardState';

/**
* IOU Currency selection for selecting currency
Expand Down Expand Up @@ -51,6 +53,17 @@ class IOUCurrencySelection extends Component {
this.changeSearchValue = this.changeSearchValue.bind(this);
}

componentDidMount() {
this.beforeRemoveSubscription = this.props.navigation.addListener('beforeRemove', () => {
if (!this.props.isKeyboardShown) { return; }
Keyboard.dismiss();
});
}

componentWillUnmount() {
this.beforeRemoveSubscription();
}

/**
* Returns the sections needed for the OptionsSelector
*
Expand Down Expand Up @@ -140,6 +153,7 @@ IOUCurrencySelection.defaultProps = defaultProps;

export default compose(
withLocalize,
withKeyboardState,
withOnyx({
currencyList: {key: ONYXKEYS.CURRENCY_LIST},
}),
Expand Down