-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Implemented International Bank Account flow #54798
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
Merged
MonilBhavsar
merged 37 commits into
Expensify:main
from
shubham1206agra:intl-bank-account
Jan 22, 2025
Merged
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
4bf95b9
Revert "[CP Staging] Revert "Implemented International Bank Account f…
shubham1206agra 085aeda
Merge branch 'Expensify:main' into intl-bank-account
shubham1206agra 6f0a577
Fix navigation from plaid account
shubham1206agra e4225f4
Fix navigation from plaid account success setup
shubham1206agra a060234
Fix navigation from plaid header back button
shubham1206agra 6b982b3
Fix button on account type step
shubham1206agra 0a8574f
Fix scrolling of country page
shubham1206agra da88626
Fix scrolling of country page
shubham1206agra c07ec58
Fix excluded currency and countries
shubham1206agra 3cddf30
Fix validation
shubham1206agra ca22f9b
Fix: Currency does not auto update after changing country
shubham1206agra 13a8197
Fix: Make default payment method option uses a message icon instead o…
shubham1206agra 976956e
Fix the top of the confirmation page header
shubham1206agra dbd5145
Minor fix
shubham1206agra d88fe50
Fix draft saving mechanism
shubham1206agra 1dfe4ca
Fix testValidation function
shubham1206agra 300a666
Fix draft saving on account type step
shubham1206agra 47eb2b4
Fix offline view of confirmation step
shubham1206agra d9e53a9
Fix order of menu items
shubham1206agra 4e324cb
Minor fix
shubham1206agra 434cd21
Merge branch 'Expensify:main' into intl-bank-account
shubham1206agra edbc2a1
Fix crash
shubham1206agra 0d12036
Make currency picker non-interactive when offline
shubham1206agra dff31f4
Merge branch 'Expensify:main' into intl-bank-account
shubham1206agra cef7c93
Fixed offline view on country selection page
shubham1206agra 2ec7312
Fixed account type button
shubham1206agra b305672
Merge main
shubham1206agra b386ff5
Fix lint
shubham1206agra cdd16f2
Fix lint
shubham1206agra 64b13a6
Merge main
shubham1206agra 11c0e77
Added the full page offline view on currency page
shubham1206agra d8761d5
Merge branch 'Expensify:main' into intl-bank-account
shubham1206agra 7ed8ae5
Add a beta for the feature
shubham1206agra 01d156c
Merge main
shubham1206agra e74e380
Fix lint
shubham1206agra 36793b4
Merge branch 'main' into intl-bank-account
shubham1206agra 63fbf3b
Merge branch 'main' into intl-bank-account
shubham1206agra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,105 @@ | ||
import React, {forwardRef, useState} from 'react'; | ||
import type {ForwardedRef} from 'react'; | ||
import {View} from 'react-native'; | ||
import type {ReactNode} from 'react'; | ||
import React, {Fragment, useState} from 'react'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useStyleUtils from '@hooks/useStyleUtils'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import variables from '@styles/variables'; | ||
import {getCurrencySymbol} from '@libs/CurrencyUtils'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import CONST from '@src/CONST'; | ||
import CurrencySelectionListWithOnyx from './CurrencySelectionList'; | ||
import FullPageOfflineBlockingView from './BlockingViews/FullPageOfflineBlockingView'; | ||
import CurrencySelectionList from './CurrencySelectionList'; | ||
import type {CurrencyListItem} from './CurrencySelectionList/types'; | ||
import HeaderWithBackButton from './HeaderWithBackButton'; | ||
import MenuItemWithTopDescription from './MenuItemWithTopDescription'; | ||
import Modal from './Modal'; | ||
import ScreenWrapper from './ScreenWrapper'; | ||
import type {ValuePickerItem, ValuePickerProps} from './ValuePicker/types'; | ||
|
||
type CurrencyPickerProps = { | ||
selectedCurrency?: string; | ||
/** Label for the input */ | ||
label: string; | ||
|
||
/** Current value of the selected item */ | ||
value?: string; | ||
|
||
/** Custom content to display in the header */ | ||
headerContent?: ReactNode; | ||
|
||
/** Callback when the list item is selected */ | ||
onInputChange?: (value: string, key?: string) => void; | ||
|
||
/** Form Error description */ | ||
errorText?: string; | ||
|
||
/** List of currencies to exclude from the list */ | ||
excludeCurrencies?: string[]; | ||
|
||
/** Is the MenuItem interactive */ | ||
interactive?: boolean; | ||
|
||
/** Should show the full page offline view (whenever the user is offline) */ | ||
shouldShowFullPageOfflineView?: boolean; | ||
}; | ||
function CurrencyPicker({selectedCurrency, label = '', errorText = '', value, onInputChange, furtherDetails}: ValuePickerProps & CurrencyPickerProps, forwardedRef: ForwardedRef<View>) { | ||
const StyleUtils = useStyleUtils(); | ||
const styles = useThemeStyles(); | ||
const [isPickerVisible, setIsPickerVisible] = useState(false); | ||
const {translate} = useLocalize(); | ||
|
||
const showPickerModal = () => { | ||
setIsPickerVisible(true); | ||
}; | ||
function CurrencyPicker({label, value, errorText, headerContent, excludeCurrencies, interactive, shouldShowFullPageOfflineView = false, onInputChange = () => {}}: CurrencyPickerProps) { | ||
const {translate} = useLocalize(); | ||
const [isPickerVisible, setIsPickerVisible] = useState(false); | ||
const styles = useThemeStyles(); | ||
|
||
const hidePickerModal = () => { | ||
setIsPickerVisible(false); | ||
}; | ||
|
||
const updateInput = (item: ValuePickerItem) => { | ||
if (item.value !== selectedCurrency) { | ||
onInputChange?.(item.value); | ||
} | ||
const updateInput = (item: CurrencyListItem) => { | ||
onInputChange?.(item.currencyCode); | ||
hidePickerModal(); | ||
}; | ||
|
||
const descStyle = !selectedCurrency || selectedCurrency.length === 0 ? StyleUtils.getFontSizeStyle(variables.fontSizeLabel) : null; | ||
const BlockingComponent = shouldShowFullPageOfflineView ? FullPageOfflineBlockingView : Fragment; | ||
|
||
return ( | ||
<View> | ||
<> | ||
<MenuItemWithTopDescription | ||
ref={forwardedRef} | ||
shouldShowRightIcon | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
title={value || ''} | ||
descriptionTextStyle={descStyle} | ||
title={value ? `${value} - ${getCurrencySymbol(value)}` : undefined} | ||
description={label} | ||
onPress={showPickerModal} | ||
furtherDetails={furtherDetails} | ||
onPress={() => setIsPickerVisible(true)} | ||
brickRoadIndicator={errorText ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} | ||
errorText={errorText} | ||
interactive={interactive} | ||
/> | ||
|
||
<Modal | ||
type={CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED} | ||
isVisible={isPickerVisible} | ||
onClose={() => hidePickerModal} | ||
onClose={hidePickerModal} | ||
onModalHide={hidePickerModal} | ||
hideModalContentWhileAnimating | ||
useNativeDriver | ||
onBackdropPress={hidePickerModal} | ||
onBackdropPress={Navigation.dismissModal} | ||
> | ||
<ScreenWrapper | ||
style={styles.pb0} | ||
style={[styles.pb0]} | ||
includePaddingTop={false} | ||
includeSafeAreaPaddingBottom={false} | ||
testID={label} | ||
includeSafeAreaPaddingBottom | ||
testID={CurrencyPicker.displayName} | ||
> | ||
<HeaderWithBackButton | ||
title={label} | ||
shouldShowBackButton | ||
onBackButtonPress={hidePickerModal} | ||
/> | ||
<CurrencySelectionListWithOnyx | ||
onSelect={(item) => updateInput({value: item.currencyCode})} | ||
searchInputLabel={translate('common.currency')} | ||
initiallySelectedCurrencyCode={selectedCurrency} | ||
/> | ||
<BlockingComponent> | ||
{!!headerContent && headerContent} | ||
<CurrencySelectionList | ||
initiallySelectedCurrencyCode={value} | ||
onSelect={updateInput} | ||
searchInputLabel={translate('common.search')} | ||
excludedCurrencies={excludeCurrencies} | ||
/> | ||
</BlockingComponent> | ||
</ScreenWrapper> | ||
</Modal> | ||
</View> | ||
</> | ||
); | ||
} | ||
|
||
CurrencyPicker.displayName = 'CurrencyPicker'; | ||
|
||
export default forwardRef(CurrencyPicker); | ||
export default CurrencyPicker; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coming from #56697
we caused an issue where offline message is behind the keyboard