-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53845 from Krishna2323/krishna2323/issue/52164_pr2
feat: Provide education/confirmation before creating workspaces in New Workspace flows
- Loading branch information
Showing
23 changed files
with
475 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import React, {forwardRef, useState} from 'react'; | ||
import type {ForwardedRef} from 'react'; | ||
import {View} from 'react-native'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useStyleUtils from '@hooks/useStyleUtils'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import variables from '@styles/variables'; | ||
import CONST from '@src/CONST'; | ||
import CurrencySelectionListWithOnyx from './CurrencySelectionList'; | ||
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; | ||
}; | ||
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); | ||
}; | ||
|
||
const hidePickerModal = () => { | ||
setIsPickerVisible(false); | ||
}; | ||
|
||
const updateInput = (item: ValuePickerItem) => { | ||
if (item.value !== selectedCurrency) { | ||
onInputChange?.(item.value); | ||
} | ||
hidePickerModal(); | ||
}; | ||
|
||
const descStyle = !selectedCurrency || selectedCurrency.length === 0 ? StyleUtils.getFontSizeStyle(variables.fontSizeLabel) : null; | ||
|
||
return ( | ||
<View> | ||
<MenuItemWithTopDescription | ||
ref={forwardedRef} | ||
shouldShowRightIcon | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
title={value || ''} | ||
descriptionTextStyle={descStyle} | ||
description={label} | ||
onPress={showPickerModal} | ||
furtherDetails={furtherDetails} | ||
brickRoadIndicator={errorText ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} | ||
errorText={errorText} | ||
/> | ||
|
||
<Modal | ||
type={CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED} | ||
isVisible={isPickerVisible} | ||
onClose={() => hidePickerModal} | ||
onModalHide={hidePickerModal} | ||
hideModalContentWhileAnimating | ||
useNativeDriver | ||
onBackdropPress={hidePickerModal} | ||
> | ||
<ScreenWrapper | ||
style={styles.pb0} | ||
includePaddingTop={false} | ||
includeSafeAreaPaddingBottom={false} | ||
testID={label} | ||
> | ||
<HeaderWithBackButton | ||
title={label} | ||
onBackButtonPress={hidePickerModal} | ||
/> | ||
<CurrencySelectionListWithOnyx | ||
onSelect={(item) => updateInput({value: item.currencyCode})} | ||
searchInputLabel={translate('common.currency')} | ||
initiallySelectedCurrencyCode={selectedCurrency} | ||
/> | ||
</ScreenWrapper> | ||
</Modal> | ||
</View> | ||
); | ||
} | ||
|
||
CurrencyPicker.displayName = 'CurrencyPicker'; | ||
|
||
export default forwardRef(CurrencyPicker); |
This file contains 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 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 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 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 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 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 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 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 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 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.