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

React native picker default value #20163

Closed
Hypothesis-github opened this issue Jul 12, 2018 · 1 comment
Closed

React native picker default value #20163

Hypothesis-github opened this issue Jul 12, 2018 · 1 comment
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@Hypothesis-github
Copy link

I have picker that is supposed to make some editing on existing data as such:

<Picker
  mode={'dropdown'}
  selectedValue={this.props.ID ? this.newData.get('shift') : this.props.store.EmpShift}
  style={{ height: 50, width: 130 }}
  onValueChange={(itemValue) => this.props.store.EmpShift = itemValue}>
  <Picker.Item label="Saturday" value="sat" />
  <Picker.Item label="Sunday" value="sun" />
  <Picker.Item label="Monday" value="mon" />
  <Picker.Item label="Tuesday" value="tue" />
  <Picker.Item label="Wednesday" value="wed" />
  <Picker.Item label="Thursday" value="thur" />
  <Picker.Item label="Friday" value="fri" />
</Picker>

This little piece of code selectedValue={this.props.ID ? this.newData.get('shift') : this.props.store.EmpShift} will indicate if there is a selected day, display it. if not whatever is selected, gets stored in a state called EmpShift.

The problem I am facing is, the picker value does not change the display, whatever day I choose it reverts immediately back to this.newData.get('shift').

I usually tackle these sorts of issues by changing value to defaultvalue in inputs, but in this case there are no props for defaultvalue.

How am I able to show the changes in regards with my existing data ? or show a one time defaultvalue on screen which I can change later and show.

@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to start a discussion, check out https://discuss.reactjs.org or follow the discussion template.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. 📋No Template labels Jul 12, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Jul 18, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
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

2 participants