Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in onvaluechange function in Picker Cannot read property 'props' of undefined #9209

Closed
waqas19921 opened this issue Aug 4, 2016 · 8 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@waqas19921
Copy link

whenever i change value of picker following error occurs
error

@ryankask
Copy link
Contributor

ryankask commented Aug 4, 2016

Please post a code snippet so we can better understand if this is a bug or another issue. Thanks!

@ryankask
Copy link
Contributor

ryankask commented Aug 4, 2016

@facebook-github-bot label Needs more information

@facebook-github-bot facebook-github-bot added Needs more information Ran Commands One of our bots successfully processed a command. labels Aug 4, 2016
@waqas19921
Copy link
Author

Here is the code i have used

constructor(props) {
    super(props);
    this.state = {
      city: ''
    };
  }

<View style={styles.field}>
            <Text>Select city</Text>
            <Picker style={styles.picker} selectedValue={this.state.city}
                    onValueChange={city=> this.setState({city: city})}>
              <Item label='None' value="-1"/>
              {this.props.cities.map((city, key)=> {
                return (
                  <Item label={city.name} key={key} value={city._id}/>
                )
              })}
            </Picker>
          </View>

@waqas19921
Copy link
Author

Here is the picker shown
device-2016-08-05-105507

After i select the city above read screen appears saying cannot read property Props of undefined

@waqas19921
Copy link
Author

@facebook-github-bot check now

@ryankask
Copy link
Contributor

ryankask commented Aug 5, 2016

This issue is that Picker doesn't like the shape of the child Item objects. The problematic Item is the one with the label 'None'.

If you want to fix this now you should flatten the children in Picker. Check out this related PR: #8153 as it involves the same issue.

@ryankask
Copy link
Contributor

ryankask commented Aug 5, 2016

@facebook-github-bot answered

@ghost
Copy link

ghost commented Aug 5, 2016

Closing this issue as @ryankask says the question asked has been answered. Please help us by asking questions on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

@ghost ghost closed this as completed Aug 5, 2016
@ghost ghost added the Ran Commands One of our bots successfully processed a command. label Aug 5, 2016
@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants