React-native: Android: Picker triggers odd onValueChange when initialized with selectedValue which is first item in options

Created on 4 Aug 2016  路  7Comments  路  Source: facebook/react-native

As in title: when initializing Picker component in Android with prop 'value' equals to value of first option, the odd onValueChange triggers. If prop 'value' equals to any other options value, everything is ok. iOS is ok.

RNPlay: https://rnplay.org/apps/DqxK9g

Locked

Most helpful comment

I guess this is related.

Looks like issue is still relevant.

All 7 comments

+1 having the same issue

+1

I made a workaround, that looks like this

  const weHaveAVersionWithThisBug = !!'https://github.com/facebook/react-native/issues/9220';
  const workAround = value => { if (value!==selectedValue) onChange(value); };
  const onValueChange = weHaveAVersionWithThisBug ? workAround : onChange;
  return (
    <Picker
      selectedValue={ selectedValue }
      onValueChange={ onValueChange }
    >

works for me now, and I know why this crap is in there :)

Looks like this commit
https://github.com/facebook/react-native/commit/a2a8d7f5da93ee10cf5eccfb944f581f43cfe0c0 could fix the problem (as it described in release notes) but I haven't checked yet.

+1 I would be thankful if this one got fixed. I had to use rather ugly workaround due to the way this interacted with other systems we use on frontend.

I guess this is related.

Looks like issue is still relevant.

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lazywei picture lazywei  路  3Comments

vikeri picture vikeri  路  3Comments

despairblue picture despairblue  路  3Comments

josev55 picture josev55  路  3Comments

janmonschke picture janmonschke  路  3Comments