1- import React , { useCallback , useMemo } from 'react' ;
1+ import React , { useCallback } from 'react' ;
22import { Appearance , Image , TouchableOpacity , View } from 'react-native' ;
33import CountryPicker , {
44 CountryModalProvider ,
@@ -13,7 +13,7 @@ import styles from './styles';
1313import { usePhoneInput } from './usePhoneInput' ;
1414
1515const isDarkTheme = Appearance . getColorScheme ( ) === 'dark' ;
16- const dropDown =
16+ const dropDownImage =
1717 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAi0lEQVRYR+3WuQ6AIBRE0eHL1T83FBqU5S1szdiY2NyTKcCAzU/Y3AcBXIALcIF0gRPAsehgugDEXnYQrUC88RIgfpuJ+MRrgFmILN4CjEYU4xJgFKIa1wB6Ec24FuBFiHELwIpQxa0ALUId9wAkhCnuBdQQ5ngP4I9wxXsBDyJ9m+8y/g9wAS7ABW4giBshQZji3AAAAABJRU5ErkJggg==' ;
1818
1919export const PhoneInput : React . FC < PhoneInputProps > = ( props ) => {
@@ -25,32 +25,22 @@ export const PhoneInput: React.FC<PhoneInputProps> = (props) => {
2525
2626 const {
2727 theme : {
28- withDarkTheme = isDarkTheme ,
29- withShadow,
28+ enableDarkTheme = isDarkTheme ,
3029 textInputStyle,
3130 flagButtonStyle,
3231 containerStyle,
32+ dropDownImageStyle,
3333 } = { } ,
3434 maskInputProps,
3535 autoFocus,
36- disableArrowIcon ,
37- renderDropdownImage ,
36+ hideDropdownIcon ,
37+ renderCustomDropdown ,
3838 countryPickerProps,
3939 flagProps,
4040 disabled,
41+ dropDownImageProps,
4142 } = props ;
4243
43- const _renderDropdownImage = useMemo ( ( ) => {
44- return (
45- < Image
46- testID = "dropdown-icon"
47- source = { { uri : dropDown } }
48- resizeMode = "contain"
49- style = { styles . dropDownImage }
50- />
51- ) ;
52- } , [ ] ) ;
53-
5444 const renderFlagButton = useCallback (
5545 ( ) => (
5646 < Flag
@@ -66,11 +56,7 @@ export const PhoneInput: React.FC<PhoneInputProps> = (props) => {
6656 < CountryModalProvider >
6757 < View
6858 testID = "phone-input-container"
69- style = { [
70- styles . container ,
71- withShadow ? styles . shadow : { } ,
72- containerStyle ,
73- ] }
59+ style = { [ styles . container , containerStyle ] }
7460 >
7561 < TouchableOpacity
7662 testID = "country-picker-button"
@@ -89,14 +75,22 @@ export const PhoneInput: React.FC<PhoneInputProps> = (props) => {
8975 withCallingCode
9076 disableNativeModal = { disabled }
9177 visible = { modalVisible }
92- theme = { withDarkTheme ? DARK_THEME : DEFAULT_THEME }
78+ theme = { enableDarkTheme ? DARK_THEME : DEFAULT_THEME }
9379 renderFlagButton = { renderFlagButton }
9480 excludeCountries = { EXCLUDED_COUNTRIES }
9581 onClose = { hideModal }
9682 { ...countryPickerProps }
9783 />
98- { ! disableArrowIcon &&
99- ( renderDropdownImage || < > { _renderDropdownImage } </ > ) }
84+ { ! hideDropdownIcon &&
85+ ( renderCustomDropdown || (
86+ < Image
87+ testID = "dropdown-icon"
88+ source = { { uri : dropDownImage } }
89+ resizeMode = "contain"
90+ style = { [ styles . dropDownImage , dropDownImageStyle ] }
91+ { ...dropDownImageProps }
92+ />
93+ ) ) }
10094 </ TouchableOpacity >
10195 < MaskInput
10296 testID = "phone-input"
@@ -109,7 +103,7 @@ export const PhoneInput: React.FC<PhoneInputProps> = (props) => {
109103 value = { phoneNumber }
110104 editable = { ! disabled }
111105 selectionColor = "black"
112- keyboardAppearance = { withDarkTheme ? 'dark' : 'default' }
106+ keyboardAppearance = { enableDarkTheme ? 'dark' : 'default' }
113107 keyboardType = "number-pad"
114108 autoFocus = { autoFocus }
115109 { ...maskInputProps }
0 commit comments