@@ -2,7 +2,7 @@ import { countries as countryList } from 'countries-list';
22import * as React from 'react' ;
33import { FlatList , View } from 'react-native' ;
44import { Toggle } from 'react-powerplug' ;
5- import { DeepPartial } from 'ts-essentials' ;
5+ import { DeepPartial , Omit } from 'ts-essentials' ;
66
77import { Icon } from '../../icons' ;
88import { Theme , withTheme } from '../../theme' ;
@@ -16,18 +16,17 @@ import {
1616 getPhoneNumberInputStyles ,
1717 PhoneNumberInputStyles ,
1818} from './PhoneNumberInput.styles' ;
19- import TextInput from './TextInput' ;
19+ import TextInput , { TextInputProps } from './TextInput' ;
2020
21- export interface PhoneNumberInputProps {
21+ export interface PhoneNumberInputProps
22+ extends Omit < TextInputProps , 'getStyles' > {
2223 countryCode ?: string ;
23- isInvalid ?: boolean ;
2424 onChangeCountryCode ?: ( countryCode : string ) => void ;
2525 phoneNumber ?: string ;
2626 onChangePhoneNumber ?: ( phoneNumber : string ) => void ;
2727 theme : Theme ;
2828 /** Label displayed when showing country selection */
2929 header ?: React . ReactElement < any > ;
30- placeholder ?: string ;
3130 getStyles ?: ReplaceReturnType <
3231 GetPhoneNumberInputStyles ,
3332 DeepPartial < PhoneNumberInputStyles >
@@ -48,11 +47,10 @@ const PhoneNumberInputBase = (props: PhoneNumberInputProps) => {
4847 phoneNumber,
4948 onChangeCountryCode,
5049 onChangePhoneNumber,
51- placeholder,
5250 header,
5351 theme,
5452 getStyles,
55- isInvalid ,
53+ ... textInputProps
5654 } = props ;
5755
5856 const { containerStyle } = mergeStyles ( getPhoneNumberInputStyles , getStyles ) (
@@ -120,6 +118,7 @@ const PhoneNumberInputBase = (props: PhoneNumberInputProps) => {
120118 } }
121119 </ Toggle >
122120 < TextInput
121+ name = "phone"
123122 getStyles = { ( ) => ( {
124123 containerStyle : {
125124 flex : 1 ,
@@ -129,11 +128,10 @@ const PhoneNumberInputBase = (props: PhoneNumberInputProps) => {
129128 borderTopLeftRadius : 0 ,
130129 } ,
131130 } ) }
132- isInvalid = { isInvalid }
133- keyboardType = "number-pad"
131+ keyboardType = "phone-pad"
134132 value = { phoneNumber }
135133 onChangeText = { onChangePhoneNumber }
136- placeholder = { placeholder }
134+ { ... textInputProps }
137135 />
138136 </ View >
139137 ) ;
0 commit comments