1- import { useNavigation , useRoute } from '@react-navigation/native' ;
21import type { ReactNode } from 'react' ;
3- import React , { Fragment , useEffect , useState } from 'react' ;
2+ import React , { Fragment , useState } from 'react' ;
43import useLocalize from '@hooks/useLocalize' ;
54import useThemeStyles from '@hooks/useThemeStyles' ;
65import { getCurrencySymbol } from '@libs/CurrencyUtils' ;
@@ -38,38 +37,15 @@ type CurrencyPickerProps = {
3837
3938 /** Should show the full page offline view (whenever the user is offline) */
4039 shouldShowFullPageOfflineView ?: boolean ;
41-
42- /** Should sync picker visibility with navigation params (for modal state restoration) */
43- shouldSyncPickerVisibilityWithNavigation ?: boolean ;
44-
45- /** Should save currency value in navigation params */
46- shouldSaveCurrencyInNavigation ?: boolean ;
4740} ;
4841
49- function CurrencyPicker ( {
50- label,
51- value,
52- errorText,
53- headerContent,
54- excludeCurrencies,
55- disabled = false ,
56- shouldShowFullPageOfflineView = false ,
57- shouldSyncPickerVisibilityWithNavigation = false ,
58- shouldSaveCurrencyInNavigation = false ,
59- onInputChange = ( ) => { } ,
60- } : CurrencyPickerProps ) {
42+ function CurrencyPicker ( { label, value, errorText, headerContent, excludeCurrencies, disabled = false , shouldShowFullPageOfflineView = false , onInputChange = ( ) => { } } : CurrencyPickerProps ) {
6143 const { translate} = useLocalize ( ) ;
62- const route = useRoute ( ) ;
63- const navigation = useNavigation ( ) ;
64- const isPickerVisibleParam = route . params && 'isPickerVisible' in route . params && route . params . isPickerVisible === 'true' ;
65- const [ isPickerVisible , setIsPickerVisible ] = useState ( isPickerVisibleParam ?? false ) ;
44+ const [ isPickerVisible , setIsPickerVisible ] = useState ( false ) ;
6645 const styles = useThemeStyles ( ) ;
6746
6847 const hidePickerModal = ( ) => {
6948 setIsPickerVisible ( false ) ;
70- if ( shouldSaveCurrencyInNavigation ) {
71- Navigation . setParams ( { currency : value } ) ;
72- }
7349 } ;
7450
7551 const updateInput = ( item : CurrencyListItem ) => {
@@ -79,13 +55,6 @@ function CurrencyPicker({
7955
8056 const BlockingComponent = shouldShowFullPageOfflineView ? FullPageOfflineBlockingView : Fragment ;
8157
82- useEffect ( ( ) => {
83- if ( ! shouldSyncPickerVisibilityWithNavigation ) {
84- return ;
85- }
86- Navigation . setParams ( { isPickerVisible : String ( isPickerVisible ) } ) ;
87- } , [ isPickerVisible , navigation , shouldSyncPickerVisibilityWithNavigation ] ) ;
88-
8958 return (
9059 < >
9160 < MenuItemWithTopDescription
0 commit comments