Comments (10)
Any more information about what you're asking?
You can set the state by doing something similar to the following:
<CountryPicker
onChange={(value) => {
this.setState({
country: value.cca2, // this will be something like 'US'
countryName: value.name // this will be something like 'United States'
})
}}
cca2={country}
filterable
/>
from react-native-country-picker-modal.
@chapeljuice
Hey man!
where did you find
cca2
name
callingCode
?
Like how could i know that value.cca2 will give me to only 2 letters,
and value.name will give me the name of the country?
from react-native-country-picker-modal.
Hey @timorss, if I were you I'd place something like console.log('Country list values:', value)
in your CountryPicker's onChange
function and play around with it a bit. You'll be able to see all values that the module returns.
from react-native-country-picker-modal.
@chapeljuice
the console log marked as error here
what should i do?
from react-native-country-picker-modal.
@timorss it's hard to tell what you're doing from your non-formatted and partial sliver of code.
Is this what you're trying to do, and getting errors??
<CountryPicker
onChange={(value) => {
console.log(value)
this.setState({
cca2: value.cca2,
countryName: value.name,
callingCode: value.callingCode
})
}}
cca2={this.state.cca2}
translation='eng'
filterable
styles={{ backgroundColor: 'red' }}
/>
from react-native-country-picker-modal.
oh, i didn't notice it's not formatted, sorry!
yes that's what i did.
from react-native-country-picker-modal.
and lets say i want the list to be open without clicking on it.
as a part of my screen....i tried to do it...no success!
from react-native-country-picker-modal.
Hrmm, not sure. What errors are you getting?
Sorry, I don't work on this module so might not be able to help much further. I've just used it on a project per what the docs say. Maybe @xcarpentier can help you out?
from react-native-country-picker-modal.
Or, better yet, why don't you open a new question on stackoverflow.com detailing exactly what you're doing and what errors you're getting.
from react-native-country-picker-modal.
please can anyone help me how to display the country name not the flag?
from react-native-country-picker-modal.
Related Issues (20)
- countries-emoji.json 122 KB
- Incorrect translation in countries.json HOT 1
- Country flags are transparent HOT 4
- Ignore accents in country names when using filter and spanish translation
- Could not resolve dependency - @callstack/[email protected] HOT 7
- Alpha Filter not lined up with flatlist
- The loading never disappears
- Color input text
- feat(language): add support for spokenLanguage
- Canada flag doesn't persist because it shares the same code as US
- How can we style the flag?
- How to add maxFontSizeMultiplier property for selected country text? HOT 1
- flag
- Upgrade this to new react-native version 0.71
- Feature Request: Dev can style the Flag Images HOT 1
- Emoji flags in the modal are transparent on Android HOT 1
- Unable to resolve "react-async-hook" HOT 4
- Change of an unmaintained dependency HOT 6
- t
- I'm not able to display cca2 and arrowdown icon?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-country-picker-modal.