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

MoneyRequest: use ScreenWrapper only if editing #24097

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 68 additions & 60 deletions src/pages/iou/steps/MoneyRequestAmount.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,69 +419,77 @@ function MoneyRequestAmount(props) {
const formattedAmount = replaceAllDigits(amount, toLocaleDigit);
const buttonText = isEditing.current ? translate('common.save') : translate('common.next');

return (
<FullPageNotFoundView shouldShow={!IOUUtils.isValidMoneyRequestType(iouType.current)}>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
onEntryTransitionEnd={focusTextInput}
const content = (
<>
<View
nativeID={amountViewID}
onMouseDown={(event) => onMouseDown(event, [amountViewID])}
style={[styles.flex1, styles.flexRow, styles.w100, styles.alignItemsCenter, styles.justifyContentCenter]}
>
<TextInputWithCurrencySymbol
formattedAmount={formattedAmount}
onChangeAmount={updateAmount}
onCurrencyButtonPress={navigateToCurrencySelectionPage}
placeholder={numberFormat(0)}
ref={(el) => (textInput.current = el)}
selectedCurrencyCode={selectedCurrencyCode}
selection={selection}
onSelectionChange={(e) => {
if (!shouldUpdateSelection) {
return;
}
setSelection(e.nativeEvent.selection);
}}
/>
</View>
<View
onMouseDown={(event) => onMouseDown(event, [numPadContainerViewID, numPadViewID])}
style={[styles.w100, styles.justifyContentEnd, styles.pageWrapper]}
nativeID={numPadContainerViewID}
>
{({safeAreaPaddingBottomStyle}) => (
{DeviceCapabilities.canUseTouchScreen() ? (
<BigNumberPad
nativeID={numPadViewID}
numberPressed={updateAmountNumberPad}
longPressHandlerStateChanged={updateLongPressHandlerState}
/>
) : (
<View />
)}

<Button
success
style={[styles.w100, styles.mt5]}
onPress={navigateToNextPage}
pressOnEnter
isDisabled={!amount.length || parseFloat(amount) < 0.01}
text={buttonText}
/>
</View>
</>
);

if (!isEditing.current) {
Beamanator marked this conversation as resolved.
Show resolved Hide resolved
return content;
}

return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
onEntryTransitionEnd={focusTextInput}
>
{({safeAreaPaddingBottomStyle}) => (
<FullPageNotFoundView shouldShow={!IOUUtils.isValidMoneyRequestType(iouType.current)}>
<View style={[styles.flex1, safeAreaPaddingBottomStyle]}>
{isEditing.current && (
<HeaderWithBackButton
title={titleForStep}
onBackButtonPress={navigateBack}
/>
)}
<View
nativeID={amountViewID}
onMouseDown={(event) => onMouseDown(event, [amountViewID])}
style={[styles.flex1, styles.flexRow, styles.w100, styles.alignItemsCenter, styles.justifyContentCenter]}
>
<TextInputWithCurrencySymbol
formattedAmount={formattedAmount}
onChangeAmount={updateAmount}
onCurrencyButtonPress={navigateToCurrencySelectionPage}
placeholder={numberFormat(0)}
ref={(el) => (textInput.current = el)}
selectedCurrencyCode={selectedCurrencyCode}
selection={selection}
onSelectionChange={(e) => {
if (!shouldUpdateSelection) {
return;
}
setSelection(e.nativeEvent.selection);
}}
/>
</View>
<View
onMouseDown={(event) => onMouseDown(event, [numPadContainerViewID, numPadViewID])}
style={[styles.w100, styles.justifyContentEnd, styles.pageWrapper]}
nativeID={numPadContainerViewID}
>
{DeviceCapabilities.canUseTouchScreen() ? (
<BigNumberPad
nativeID={numPadViewID}
numberPressed={updateAmountNumberPad}
longPressHandlerStateChanged={updateLongPressHandlerState}
/>
) : (
<View />
)}

<Button
success
style={[styles.w100, styles.mt5]}
onPress={navigateToNextPage}
pressOnEnter
isDisabled={!amount.length || parseFloat(amount) < 0.01}
text={buttonText}
/>
</View>
<HeaderWithBackButton
title={titleForStep}
onBackButtonPress={navigateBack}
/>
{content}
</View>
)}
</ScreenWrapper>
</FullPageNotFoundView>
</FullPageNotFoundView>
)}
</ScreenWrapper>
);
}

Expand Down
Loading