react-native-phone-input icon indicating copy to clipboard operation
react-native-phone-input copied to clipboard

How to make the height of country picker longer?

Open felixchan opened this issue 6 years ago • 5 comments
trafficstars

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

felixchan avatar Oct 09 '19 22:10 felixchan

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.

ncuthbert avatar Nov 01 '19 16:11 ncuthbert

@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}); }; <View> <PhoneInput style={styles.PhoneInput} textStyle={styles.PhoneInputText} autoFormat={true} value={phoneStr} initialCountry={cca2} onPressFlag={this.onPressFlag} ref={ref => { this.phone = ref; }} /> <CountryPicker ref={ref => { this.countryPicker = ref; }} onChange={value => this.selectCountry(value)} translation="eng" cca2={this.state.cca2}> <View /> </CountryPicker> </View>

m4manjesh avatar Jan 29 '20 10:01 m4manjesh

@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.

ncuthbert avatar Jan 29 '20 22:01 ncuthbert

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

m4manjesh avatar Jan 30 '20 11:01 m4manjesh

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

ncuthbert avatar Jan 30 '20 14:01 ncuthbert