@@ -2,8 +2,8 @@ import {isUserValidatedSelector} from '@selectors/Account';
22import React , { useCallback , useMemo , useState } from 'react' ;
33import { View } from 'react-native' ;
44import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView' ;
5- import SelectionList from '@components/SelectionListWithSections ' ;
6- import RadioListItem from '@components/SelectionListWithSections /RadioListItem' ;
5+ import SelectionList from '@components/SelectionList ' ;
6+ import RadioListItem from '@components/SelectionList/ListItem /RadioListItem' ;
77import useDebouncedState from '@hooks/useDebouncedState' ;
88import useLocalize from '@hooks/useLocalize' ;
99import useNetwork from '@hooks/useNetwork' ;
@@ -69,30 +69,43 @@ function CountrySelection({isEditing, onNext, formValues, resetScreenIndex, fiel
6969 ) ;
7070
7171 const searchResults = searchOptions ( debouncedSearchValue , countries ) ;
72- const headerMessage = debouncedSearchValue . trim ( ) && ! searchResults . length ? translate ( 'common.noResultsFound' ) : '' ;
72+
73+ const textInputOptions = useMemo (
74+ ( ) => ( {
75+ label : translate ( 'common.search' ) ,
76+ value : searchValue ,
77+ onChangeText : setSearchValue ,
78+ headerMessage : debouncedSearchValue . trim ( ) && ! searchResults . length ? translate ( 'common.noResultsFound' ) : '' ,
79+ } ) ,
80+ [ translate , searchValue , setSearchValue , debouncedSearchValue , searchResults . length ] ,
81+ ) ;
82+
83+ const confirmButtonOptions = useMemo (
84+ ( ) => ( {
85+ showButton : true ,
86+ text : isEditing ? translate ( 'common.confirm' ) : translate ( 'common.next' ) ,
87+ isDisabled : isOffline ,
88+ onConfirm : onCountrySelected ,
89+ } ) ,
90+ [ isEditing , isOffline , onCountrySelected , translate ] ,
91+ ) ;
7392
7493 return (
7594 < FullPageOfflineBlockingView >
7695 < View style = { styles . ph5 } >
7796 < Text style = { [ styles . textHeadlineLineHeightXXL , styles . mb6 ] } > { translate ( 'addPersonalBankAccount.countrySelectionStepHeader' ) } </ Text >
7897 </ View >
7998 < SelectionList
80- headerMessage = { headerMessage }
81- sections = { [ { data : searchResults } ] }
82- textInputValue = { searchValue }
83- textInputLabel = { translate ( 'common.search' ) }
84- onChangeText = { setSearchValue }
85- onSelectRow = { onSelectionChange }
86- onConfirm = { onCountrySelected }
99+ data = { searchResults }
87100 ListItem = { RadioListItem }
88- initiallyFocusedOptionKey = { currentCountry }
101+ onSelectRow = { onSelectionChange }
102+ textInputOptions = { textInputOptions }
103+ confirmButtonOptions = { confirmButtonOptions }
104+ initiallyFocusedItemKey = { currentCountry }
89105 shouldSingleExecuteRowSelect
90- shouldStopPropagation
91- shouldUseDynamicMaxToRenderPerBatch
92- showConfirmButton
93- confirmButtonText = { isEditing ? translate ( 'common.confirm' ) : translate ( 'common.next' ) }
94- isConfirmButtonDisabled = { isOffline }
95106 shouldUpdateFocusedIndex
107+ shouldStopPropagation
108+ disableMaintainingScrollPosition
96109 />
97110 </ FullPageOfflineBlockingView >
98111 ) ;
0 commit comments