GithubHelp home page GithubHelp logo

Comments (10)

chapeljuice avatar chapeljuice commented on July 17, 2024

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.

timorss avatar timorss commented on July 17, 2024

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

chapeljuice avatar chapeljuice commented on July 17, 2024

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.

timorss avatar timorss commented on July 17, 2024

@chapeljuice
the console log marked as error here
what should i do?

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

chapeljuice avatar chapeljuice commented on July 17, 2024

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

timorss avatar timorss commented on July 17, 2024

oh, i didn't notice it's not formatted, sorry!
yes that's what i did.

from react-native-country-picker-modal.

timorss avatar timorss commented on July 17, 2024

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.

chapeljuice avatar chapeljuice commented on July 17, 2024

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.

chapeljuice avatar chapeljuice commented on July 17, 2024

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.

payawalangelica avatar payawalangelica commented on July 17, 2024

please can anyone help me how to display the country name not the flag?

from react-native-country-picker-modal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.