Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
gedu committed Mar 23, 2023
1 parent 0713192 commit 81986b1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
4 changes: 3 additions & 1 deletion src/components/ScreenWrapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ class ScreenWrapper extends React.Component {
}

render() {
const maxHeight = this.props.lockHeight ? null : this.props.windowHeight;

return (
<SafeAreaConsumer>
{({
Expand All @@ -109,7 +111,7 @@ class ScreenWrapper extends React.Component {
if (this.props.includeSafeAreaPaddingBottom || this.props.network.isOffline) {
paddingStyle.paddingBottom = paddingBottom;
}
const maxHeight = this.props.lockHeight ? null : this.props.windowHeight;

return (
<View
style={[
Expand Down
2 changes: 1 addition & 1 deletion src/components/ScreenWrapper/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const propTypes = {
/** Whether to dismiss keyboard before leaving a screen */
shouldDismissKeyboardBeforeClose: PropTypes.bool,

/** Whether to lock the max height with the initial window height */
/** Whether to use the maxHeight (false) or use the 100% of the height (true) */
lockHeight: PropTypes.bool,
};

Expand Down
37 changes: 20 additions & 17 deletions src/pages/iou/IOUModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ class IOUModal extends Component {
render() {
const currentStep = this.steps[this.state.currentStepIndex];
const reportID = lodashGet(this.props, 'route.params.reportID', '');

// We want to lock the height of the screen when the IOUAmount page is visible
// so that the keyboard doesn't cause the screen to resize and move the NumberPad up and down
const lockHeight = DeviceCapabilities.canUseTouchScreen() && currentStep === Steps.IOUAmount;

return (
Expand All @@ -432,23 +435,23 @@ class IOUModal extends Component {
{didScreenTransitionEnd && (
<>
{currentStep === Steps.IOUAmount && (
<AnimatedStep
direction={this.getDirection()}
style={[styles.flex1, safeAreaPaddingBottomStyle]}
>
{this.renderHeader()}
<IOUAmountPage
onStepComplete={(amount) => {
this.setState({amount});
this.navigateToNextStep();
}}
reportID={reportID}
hasMultipleParticipants={this.props.hasMultipleParticipants}
selectedAmount={this.state.amount}
navigation={this.props.navigation}
iouType={this.props.iouType}
/>
</AnimatedStep>
<AnimatedStep
direction={this.getDirection()}
style={[styles.flex1, safeAreaPaddingBottomStyle]}
>
{this.renderHeader()}
<IOUAmountPage
onStepComplete={(amount) => {
this.setState({amount});
this.navigateToNextStep();
}}
reportID={reportID}
hasMultipleParticipants={this.props.hasMultipleParticipants}
selectedAmount={this.state.amount}
navigation={this.props.navigation}
iouType={this.props.iouType}
/>
</AnimatedStep>
)}
{currentStep === Steps.IOUParticipants && (
<AnimatedStep
Expand Down

0 comments on commit 81986b1

Please sign in to comment.