Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

react native country code prefix for text input

$
0
0

Trying to set up a form that takes a customer's address and phone number, but the API only accepts the phone number with the country code attached. So I need to add it in through the code.

I've tried it with my code below, but it seems like it's always leaving out the last number.

export default function ShippingAddressForm(props: Props) {  let { address, onChangeAddress } = props;  let [phoneState, setPhoneState] = useState<string>('');<TextInput    label={t('Phone Number')}    textContentType="telephoneNumber"    value={phoneState}    onChangeText={(number) => {      setPhoneState(number)      let phone = '+61'+ phoneState      onChangeAddress({ ...address, phone })    }}  />}

Building an app on Expo with react native typescript


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>