Picker Component resets when items list changes
See original GitHub issueDescription
If the picker item list changes, then, in some cases, the picker will call the onValueChange callback with the first item in the list as it’s argument.
Reproduction Steps and Sample Code
This can be reproduced at https://snack.expo.io/Sy1JClEag.
Select 2 or 3, then click on exclude. The new value is 1. This does not happen if you select a higher value than the one being excluded
Solution
Do not call the onValueChange callback when the items list changes, but the selectedValue is stil present in the list
Additional Information
- React Native version: 0.42
- Platform: Android
- Development Operating System: Linux
- Dev tools: Android SDK version 23
Issue Analytics
- State:
- Created 6 years ago
- Reactions:34
- Comments:43 (14 by maintainers)
Top Results From Across the Web
Picker value keeps being reset - react native - Stack Overflow
I have a picker inside each item in a flat list representing the quantity. When I try and change the value it is...
Read more >Date Picker issue patching and resetting gallery
Solved: Hello I have two screens, one is where you start to type in a name and suggestions are populated in the drop...
Read more >TagPicker - React Suite
Property Type (Default) Description
classPrefix string ('picker') The prefix of the component CSS class
cleanable boolean (true) Whether the selected value can be cleared
container HTMLElement...
Read more >counter-reset - CSS: Cascading Style Sheets - MDN Web Docs
In addition to author-created counters, the property can also reset the list-item counters used by ordered lists (as created using <ol> ...
Read more >Form Datepicker | Components - BootstrapVue
By default, clicking on the today or reset button will also close the calendar popup, unless the prop no-close-on-select is set. Date picker...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@stale This is still an issue.
@syamjayaraj’s link to a “solution” that is “working perfectly” has nothing to do with this issue. That solution refers to changing the selection of a Picker, not editing an Option for the Picker and having the current value reset after making that edit.
So, yes, this is still an issue in the react-native core and should remain on here and get some attention from the react-native team.
https://stackoverflow.com/questions/37597665/how-to-make-react-native-picker-stay-at-newly-selected-option
Working perfectly