diff --git a/examples/CustomLibraryPicker/app.js b/examples/CustomLibraryPicker/app.js index 6c7e2383..d61cf279 100644 --- a/examples/CustomLibraryPicker/app.js +++ b/examples/CustomLibraryPicker/app.js @@ -12,6 +12,7 @@ class App extends Component { this.selectCountry = this.selectCountry.bind(this); this.state = { cca2: 'US', + isCountryModalOpen: false }; } @@ -21,8 +22,14 @@ class App extends Component { }); } + toggleCountryModal() { + this.setState((state) => ({ + isCountryModalOpen: !state.isCountryModalOpen + })) + } + onPressFlag() { - this.countryPicker.openModal(); + this.toggleCountryModal() } selectCountry(country) { @@ -30,6 +37,7 @@ class App extends Component { this.setState({ cca2: country.cca2 }); } + render() { return ( @@ -41,12 +49,13 @@ class App extends Component { /> { - this.countryPicker = ref; - }} - onChange={value => this.selectCountry(value)} + onSelect={value => this.selectCountry(value)} translation="eng" - cca2={this.state.cca2} + countryCode={this.state.cca2} + modalProps={{ + visible: this.state.isCountryModalOpen + }} + onClose={() => this.toggleCountryModal()} > diff --git a/examples/CustomLibraryPicker/package.json b/examples/CustomLibraryPicker/package.json index 21a5b7bb..fcaa1f6d 100644 --- a/examples/CustomLibraryPicker/package.json +++ b/examples/CustomLibraryPicker/package.json @@ -9,7 +9,7 @@ "dependencies": { "react": "15.4.2", "react-native": "0.41.2", - "react-native-country-picker-modal": "^0.2.8", + "react-native-country-picker-modal": "^1.9.8", "react-native-phone-input": "^0.1.5" }, "devDependencies": {