Closed
Description
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.