DefinitelyTyped/types/react-native-phone-input/react-native-phone-input-tests.tsx
Matthew Elphick 4dca5ecae9 feat: Add types for react-native-phone-input (#38937)
* feat: Add types for react-native-phone-input

* fix: Add missing onPressCancel, onPressConfirm, blur

* style: Commit formatting from pre-commit hook
2019-10-08 12:42:32 -07:00

51 lines
1.4 KiB
TypeScript

import * as React from 'react';
import { Text } from 'react-native';
import ReactNativePhoneInput from 'react-native-phone-input';
const test: React.SFC = () => (
<ReactNativePhoneInput<typeof Text>
initialCountry={'us'}
allowZeroAfterCountryCode={false}
disabled={false}
value={'+440000000000'}
style={{
backgroundColor: 'green',
}}
flagStyle={{
backgroundColor: 'blue',
}}
textStyle={{
color: 'red',
}}
textProps={{
maxFontSizeMultiplier: 2,
}}
textComponent={Text}
offset={10}
pickerButtonColor={'#FFFFFF'}
pickerBackgroundColor={'#000000'}
pickerItemStyle={{}}
cancelText={'Cancel'}
confirmText={'Confirm'}
buttonTextStyle={{
color: 'red',
}}
onChangePhoneNumber={newPhoneNumber => {
console.info('New phone number', newPhoneNumber);
}}
onSelectCountry={selected => {
console.info('Selected country', selected);
}}
onPressFlag={() => {
console.info('Flag pressed');
}}
onPressCancel={() => {
console.info('Selection cancelled');
}}
onPressConfirm={() => {
console.info('Selection confirmed');
}}
countriesList={[]}
/>
);