question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Picker Component resets when items list changes

See original GitHub issue

Description

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:closed
  • Created 6 years ago
  • Reactions:34
  • Comments:43 (14 by maintainers)

github_iconTop GitHub Comments

17reactions
joshuapintercommented, Jun 26, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found