@@ -8,11 +8,9 @@ import { Icon } from '../../icons';
88import { Theme , withTheme } from '../../theme' ;
99import { mergeStyles , ReplaceReturnType } from '../../utils/mergeStyles' ;
1010import { Button } from '../Button' ;
11- import { Spacing } from '../Layout' ;
1211import { ListItem } from '../ListItem' ;
1312import { Modal } from '../Modal' ;
1413import ModalContent from '../Modal/ModalContent' ;
15- import { Heading } from '../Typography' ;
1614import {
1715 GetPhoneNumberInputStyles ,
1816 getPhoneNumberInputStyles ,
@@ -22,12 +20,13 @@ import TextInput from './TextInput';
2220
2321export interface PhoneNumberInputProps {
2422 countryCode ?: string ;
23+ isInvalid ?: boolean ;
2524 onChangeCountryCode ?: ( countryCode : string ) => void ;
2625 phoneNumber ?: string ;
2726 onChangePhoneNumber ?: ( phoneNumber : string ) => void ;
2827 theme : Theme ;
2928 /** Label displayed when showing country selection */
30- label ?: string ;
29+ header ?: React . ReactElement < any > ;
3130 placeholder ?: string ;
3231 getStyles ?: ReplaceReturnType <
3332 GetPhoneNumberInputStyles ,
@@ -50,9 +49,10 @@ const PhoneNumberInputBase = (props: PhoneNumberInputProps) => {
5049 onChangeCountryCode,
5150 onChangePhoneNumber,
5251 placeholder,
53- label ,
52+ header ,
5453 theme,
5554 getStyles,
55+ isInvalid,
5656 } = props ;
5757
5858 const { containerStyle } = mergeStyles ( getPhoneNumberInputStyles , getStyles ) (
@@ -89,13 +89,7 @@ const PhoneNumberInputBase = (props: PhoneNumberInputProps) => {
8989 < Modal visible = { on } >
9090 < ModalContent onClose = { ( ) => set ( false ) } >
9191 < FlatList
92- ListHeaderComponent = {
93- label ? (
94- < Spacing marginVertical = { 3 } paddingHorizontal = { 2 } >
95- < Heading size = "xxxlarge" > { label } </ Heading >
96- </ Spacing >
97- ) : null
98- }
92+ ListHeaderComponent = { header }
9993 keyExtractor = { item => item . key }
10094 getItemLayout = { ( data , index ) => ( {
10195 index,
@@ -135,6 +129,7 @@ const PhoneNumberInputBase = (props: PhoneNumberInputProps) => {
135129 borderTopLeftRadius : 0 ,
136130 } ,
137131 } ) }
132+ isInvalid = { isInvalid }
138133 keyboardType = "number-pad"
139134 value = { phoneNumber }
140135 onChangeText = { onChangePhoneNumber }
0 commit comments