thegamenicorus / react-native-phone-input

Phone input box for React Native
https://www.npmjs.com/package/react-native-phone-input
MIT License
396 stars 452 forks source link

How to make the height of country picker longer? #123

Open felixchan opened 5 years ago

felixchan commented 5 years ago

Seems that it only fills 1/3 of the screen. Is there any way to customize the height of the scroll picker?

ncuthbert commented 5 years ago

If it helps, I used react-native-country-picker-modal which I found easier to customise, and display that in onPressFlag. In the country picker's onChange, I call this.phoneInput.selectCountry(country.cca2.toLowerCase() to set the country on the phone input. Works well for me.

m4manjesh commented 4 years ago

@ncuthbert I am getting this "undefined is not an object (evaluating '_this.countryPicker.openModal')" while using react-native-country-picker-modal?

componentDidMount() { this.asyncLoadLastPhone(); this.setState({ pickerData: this.phone.getPickerData(), }); }

onPressFlag = () => { this.countryPicker.openModal(); };

selectCountry = (country: any) => { this.phone.selectCountry(country.cca2.toLowerCase()); this.setState({cca2: country.cca2}); };

{ this.phone = ref; }} /> { this.countryPicker = ref; }} onChange={value => this.selectCountry(value)} translation="eng" cca2={this.state.cca2}>
ncuthbert commented 4 years ago

@m4manjesh looks like there is a ticket open for the issue you describe. Seeing as it's come up recently for a number of people, it may be related to a recent version and I'd suggest downgrading, if possible.

m4manjesh commented 4 years ago

@ncuthbert Thanks for the response. Which version you are using?

ncuthbert commented 4 years ago

I'm using 0.2.2 at the moment. There was another issue in 0.2.4, so I've downgraded as a workaround.