-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Picker Component resets when items list changes #13351
Comments
Did you find a work around for this? |
Nope. In theory, I think it should be doable, but it seems overly complicated. In my case, I managed to get rid of the need to change the picker items. |
Got snagged with this as well. I am renaming my items in the Picker and when you update the Picker items, including the renamed one, it loses the selected value, even if your selected value is still in the list. For example: <Picker selectedValue="2" ...>
<Picker.Item key="1" value="1" label="One" />
<Picker.Item key="2" value="2" label="Two" />
<Picker.Item key="3" value="3" label="Three" />
</Picker> If you change the second <Picker.Item key="2" value="2" label="Second" /> It has to re-render but it loses the selectedValue. The selectedValue just becomes the first one, even though the value of the selected item hasn't changed, just the label. Might be a little confusing but it's a real pain when renaming things. For now, I am getting around it with a dirty solution that adds a new <Picker selectedValue="2" ...>
<Picker.Item key="1" value="1" label="One" />
<Picker.Item key="2" value="2" label="Two" />
<Picker.Item key="3" value="3" label="Three" />
<Picker.Item key="2" value="2" label="Second" />
</Picker> |
This resolved for me: import React, { Component } from 'react';
import { Picker, Platform } from 'react-native';
class MyPicker extends Component {
componentWillReceiveProps(nextProps) {
if (Platform.OS === 'android') {
let selectedIndex = -1;
nextProps.children.forEach((c, i) => {
if (c.props.value === nextProps.selectedValue) {
selectedIndex = i;
}
});
this.refs.picker._reactInternalInstance._renderedComponent._instance.setState({ initialSelectedIndex: selectedIndex, selectedIndex });
}
}
onValueChange(value, index) {
if (value !== this.props.selectedValue) {
this.props.onValueChange(value, index);
}
}
render() {
return (
<Picker ref='picker' {...this.props} onValueChange={this.onValueChange.bind(this)}>
{this.props.children}
</Picker>
);
}
}
MyPicker.Item = Picker.Item;
export { MyPicker }; |
@goblinbr Thanks for the solution, but for some reason it didn't help me. Honestly, I'm a little surprised that a major bug such as this attracts so little attention. I just started working with the |
@goblinbr Thank you for you solution, but it doesn't work on me as well. This would not stop triggering the "onValueChange". Is there any other walkaround? |
Having the same issue. React Native 0.48.2 |
I would love it if an core member would jump in here and give their thoughts. That would be enough for myself or somebody else to work on a PR. But working on a PR without a core member's encouragement is a risky use of time. |
Never mind, the issue was on my side, I has two onValueChange attributes declared on my component. 🤦♂️ |
@hirvesh So you're saying this is no longer an issue on 0.48.2? |
I've just tried it on 0.48.2 - same problem. In my scenario, I have a component with multiple Picker elements and one of them changes the interface language. When I change the language and save the settings, the component re-renders and some Picker elements receive new labels. All numeric Pickers retain the correct states, but all text-based ones are reset to the first element. Probably @hirvesh's use case is different. |
I get this bug as well on react native 0.44.3. I traced it to the event argument in _onChange in PickerAndroid.android, but I can't see any difference between the event arg when the option is actually being selected and when the options are changing. Could one of the core devs please look into this? |
Still happening in 0.49. This Picker component is so full of bugs that I wonder if it'd make sense to just rewrite it. |
Has to coerce into string for proper comparison |
This comment has been minimized.
This comment has been minimized.
@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. |
I took a look at this, and it seems to be expected behavior. From the
|
You can try this. this worked for. At first it kept going back to the selected value.
|
@goblinbr alternative component version to fix this problem with deep-equal npm package
|
Hey @jcppman, that worked great!! |
For those that might want this in a Component form, here's the modified version. import React from "react";
import { Picker } from "react-native";
// This is necessary because the native Picker does not handle edits of existing Picker.Items.
// For example, if you edit the selected Picker.Item, it will lose the selected value. This fixes that.
//
// See https://github.com/facebook/react-native/issues/13351#issuecomment-450281257
//
export default class FixedPicker extends React.Component {
render() {
const key = React.Children.map( this.props.children, child => Object.values( child.props ).join( "," ) ).join( ";" );
return <Picker { ...this.props } key={ key } />;
}
} Thanks again, @jcppman! |
Thanks @jcppman and @joshuapinter ! Modifications at multiple places was made simple by the modified version ! |
@jcppman I wasted hours on this bug, at first I thought it came from react-18next (my use case is the same of yours, a Picker to switch app language). Thanks a lot! Honestly, seeing open issue this big from 2017 is worring me a lot, is React-native still in active development and REAL bugfixing? |
@antonioaltamura Are you kidding me? There's been 4 commits in the last 12 hours. Don't get me wrong, I'm as frustrated as you are that these seemingly glaring bugs are still not fixed in master after several years and a dozen releases, but a quick look at the repo shows it's under very active development. |
I was able to repro this on 0.59. If someone wants to investigate this problem and send a PR that would be greatly appreciated. |
cc @Kudo |
Summary: Two root causes: 1. Android Spinner will reset selection to undefined after setAdapter() which will trigger onValueChange(). The behavior is not expected for RN. And the solution is to setSelection() explicitly 2. In original implementation, it setups `items` immediately, but delays the `selected` after update transaction. There will be some race condition and incosistency if update `items` only. The fix will update both after transaction. Fixes facebook#13351
Summary: Two root causes: 1. Android Spinner will reset selection to undefined after setAdapter() which will trigger onValueChange(). The behavior is not expected for RN. And the solution is to setSelection() explicitly 2. In original implementation, it setups `items` immediately, but delays the `selected` after update transaction. There will be some race condition and incosistency if update `items` only. The fix will update both after transaction. Fixes facebook#13351
) Summary: Fixes #13351 Two root causes: 1. Android Spinner will reset selection to undefined after setAdapter() which will trigger onValueChange(). The behavior is not expected for RN. And the solution is to setSelection() explicitly 2. In original implementation, it setups `items` immediately, but delays the `selected` setup after update transaction. There will be some race condition and incosistency if update `items` only. The fix will do the setup all after update transaction. [Android] [Fixed] - Fix #13351 PickerAndroid will reset selected value during items update. Pull Request resolved: #24793 Differential Revision: D15293516 Pulled By: cpojer fbshipit-source-id: 5a99a60015c7e1b2968252cdc0b2661d52a15b9d
Summary: This sync includes the following changes: - **[ade5e6928](facebook/react@ade5e6928)**: Manually update schedule dep in react-native-renderer (facebook#13609) //<Brian Vaughn>// - **[f260b14a8](facebook/react@f260b14a8)**: Fix host bailout for the persistent mode (facebook#13611) //<Dan Abramov>// - **[4a40d7624](facebook/react@4a40d7624)**: Fix a regression related to isReactComponent prototype check (facebook#13608) //<Dan Abramov>// - **[03ab1efeb](facebook/react@03ab1efeb)**: Improve DX when combining react-dom/profiling and schedule/tracking (facebook#13605) //<Brian Vaughn>// - **[144328fe8](facebook/react@144328fe8)**: Enable no-use-before-define rule (facebook#13606) //<Dan Abramov>// - **[8a8d973d3](facebook/react@8a8d973d3)**: Use clearer wording //<Dan>// - **[7d1169b2d](facebook/react@7d1169b2d)**: Remove injectComponentTree from unstable-native-dependencies, add EventPluginHub (facebook#13598) //<Brandon Dail>// - **[8d1038fc6](facebook/react@8d1038fc6)**: Break up ReactDOMServerIntegrationForm-test (facebook#13600) //<Nathan Hunzaker>// - **[b87aabdfe](facebook/react@b87aabdfe)**: Drop the year from Facebook copyright headers and the LICENSE file. (facebook#13593) //<Héctor Ramos>// - **[e417e0bf7](facebook/react@e417e0bf7)**: Update ReactNativeViewConfigRegistry Flow Types (facebook#13579) //<Timothy Yung>// - **[71c0e05ba](facebook/react@71c0e05ba)**: Update bundle sizes for 16.5.0 release //<Brian Vaughn>// - **[6255cc394](facebook/react@6255cc394)**: Updating package versions for release 16.5.0 //<Brian Vaughn>// - **[28cb37978](facebook/react@28cb37978)**: Added a test for Profiler onRender that throws (facebook#13575) //<Brian Vaughn>// - **[8963118b3](facebook/react@8963118b3)**: Update react-dom README //<Dan Abramov>// - **[b47a28cb9](facebook/react@b47a28cb9)**: Tweak react-dom README //<Dan Abramov>// - **[f765f0225](facebook/react@f765f0225)**: When a root expires, flush all expired work in a single batch (facebook#13503) //<Andrew Clark>// - **[550dd1d2e](facebook/react@550dd1d2e)**: Call Profiler onRender after mutations (facebook#13572) //<Brian Vaughn>// - **[34348a45b](facebook/react@34348a45b)**: Add enableSuspenseServerRenderer feature flag (facebook#13573) //<Alex Taylor>// - **[4e744be6e](facebook/react@4e744be6e)**: Added react-dom/profiling entry point to NPM package (facebook#13570) //<Brian Vaughn>// - **[bb627228e](facebook/react@bb627228e)**: test: add test for fragement props (facebook#13565) //<laoxiong>// - **[9a110ebd8](facebook/react@9a110ebd8)**: Cleaned up 'schedule' API wrt interactions and subscriber ref: (facebook#13561) //<Brian Vaughn>// - **[fb88fd9d8](facebook/react@fb88fd9d8)**: Fixed schedule/tracking require for www sync script (facebook#13556) //<Brian Vaughn>// - **[955393cab](facebook/react@955393cab)**: refactor: remove emove type judgment when defining warning props (facebook#13553) //<laoxiong>// - **[ff9399602](facebook/react@ff9399602)**: Fix import of ReactDOM in server env //<Dan Abramov>// - **[281bd64c0](facebook/react@281bd64c0)**: Fix test file name //<Dan Abramov>// - **[d6b59e3d2](facebook/react@d6b59e3d2)**: Check document.documentMode once //<Dan Abramov>// - **[52633c84e](facebook/react@52633c84e)**: Try/finally //<Dan Abramov>// - **[2d4705e75](facebook/react@2d4705e75)**: Make IE 11 not complain about non-crucial style attribute hydration mismatch (facebook#13534) //<Michał Gołębiowski-Owczarek>// - **[25d48a728](facebook/react@25d48a728)**: Add gridArea to unitless CSS properties (facebook#13550) //<Michał Gołębiowski-Owczarek>// - **[877f8bc6b](facebook/react@877f8bc6b)**: Renamed schedule UMD forwarding methods to stay in-sync with SECRET_INTERNALS change (facebook#13549) //<Brian Vaughn>// - **[0a96f9057](facebook/react@0a96f9057)**: Revert "Extract common logic" (facebook#13547) //<Dan Abramov>// - **[17a57adde](facebook/react@17a57adde)**: Fix test //<Dan Abramov>// - **[605da8b42](facebook/react@605da8b42)**: Extract common logic (facebook#13535) //<Heaven>// - **[69f9f4127](facebook/react@69f9f4127)**: Document event bubble order (facebook#13546) //<Philipp>// - **[c1ba7b8cf](facebook/react@c1ba7b8cf)**: Remove www scheduler fork (facebook#13545) //<Dan Abramov>// - **[b473d5f86](facebook/react@b473d5f86)**: Secret exports: Scheduler => Schedule (facebook#13544) //<Dan Abramov>// - **[6312efc34](facebook/react@6312efc34)**: Tweak README and description //<Dan Abramov>// - **[b92f947af](facebook/react@b92f947af)**: Rename "react-scheduler" package to "schedule" (facebook#13543) //<Brian Vaughn>// - **[3c1dcd349](facebook/react@3c1dcd349)**: Expose less internals for TestUtils (facebook#13539) //<Dan Abramov>// - **[0b74e95d7](facebook/react@0b74e95d7)**: Ignore noscript content on the client (facebook#13537) //<Fredrik Höglund>// - **[8a1e3962a](facebook/react@8a1e3962a)**: Remove negative lookbehind from Rollup plugin that broke Node <= v8.9 (facebook#13538) //<Brian Vaughn>// - **[9604d26ae](facebook/react@9604d26ae)**: Rename ReactDOMFiber* to ReactDOM* (facebook#13540) //<Dan Abramov>// - **[28b928902](facebook/react@28b928902)**: Tidied up scheduling UMD API forwarding test (facebook#13533) //<Brian Vaughn>// - **[bf8aa6092](facebook/react@bf8aa6092)**: Added Jest test to verify UMD API-forwarding for scheduling package (facebook#13532) //<Brian Vaughn>// - **[0040efc8d](facebook/react@0040efc8d)**: Fix a typo (facebook#13531) //<Heaven>// - **[46950a3df](facebook/react@46950a3df)**: Interaction tracking follow up (facebook#13509) //<Brian Vaughn>// - **[0452c9bba](facebook/react@0452c9bba)**: Add a regression test for facebook#4618 //<Dan Abramov>// - **[c21bab694](facebook/react@c21bab694)**: Add SSR regression test for facebook#6119 //<Dan Abramov>// - **[0d3fc9de1](facebook/react@0d3fc9de1)**: Add regression test for facebook#6119 //<Dan Abramov>// - **[0f050ad7c](facebook/react@0f050ad7c)**: Make regression test better //<Dan Abramov>// - **[f94342323](facebook/react@f94342323)**: Add a more precise regression test for facebook#6219 //<Dan Abramov>// - **[a3e4d0008](facebook/react@a3e4d0008)**: Fixed typo (facebook#13519) //<Ivan>// - **[b3d8c5376](facebook/react@b3d8c5376)**: [RN] Remove isMounted() false positive warning (facebook#13511) //<Dan Abramov>// - **[d2123d656](facebook/react@d2123d656)**: Sync React Native Flow Changes (facebook#13513) //<Timothy Yung>// - **[1c0ba70b4](facebook/react@1c0ba70b4)**: Fix test to use AsyncMode //<Dan>// - **[6e4f7c788](facebook/react@6e4f7c788)**: Profiler integration with interaction-tracking package (facebook#13253) //<Brian Vaughn>// - **[2967ebdbe](facebook/react@2967ebdbe)**: Remove buggy unstable_deferredUpdates() (facebook#13488) //<Dan Abramov>// - **[1664b08f0](facebook/react@1664b08f0)**: added flow types to setInnerHTML (facebook#13495) //<Bryan M>// - **[672e859d3](facebook/react@672e859d3)**: Add warning to prevent setting this.state to this.props referentially (facebook#11658) //<Veekas Shrivastava>// - **[29287f088](facebook/react@29287f088)**: Rename lowestPendingInteractiveExpirationTime (facebook#13484) //<Heaven>// - **[d400d6d5e](facebook/react@d400d6d5e)**: Replace magic number 1 with ELEMENT_NODE (facebook#13479) //<Heaven>// - **[340bfd939](facebook/react@340bfd939)**: Rename ReactTypeOfWork to ReactWorkTags, ReactTypeOfSideEffect to ReactSideEffectTags (facebook#13476) //<Sophie Alpert>// - **[5cefd9b1e](facebook/react@5cefd9b1e)**: Stringify <option> children (facebook#13465) //<Dan Abramov>// - **[3661616c2](facebook/react@3661616c2)**: Improve test harness of submit events (facebook#13463) //<Philipp Spieß>// - **[a1be17140](facebook/react@a1be17140)**: Revert "Rely on bubbling for submit and reset events (facebook#13358)" (facebook#13462) //<Dan Abramov>// - **[90c92c700](facebook/react@90c92c700)**: Fix warning message //<Dan Abramov>// - **[5cb0f2bf5](facebook/react@5cb0f2bf5)**: Change www error shim API (facebook#13454) //<Dan Abramov>// - **[e106b8c44](facebook/react@e106b8c44)**: Warn about unsafe toWarnDev() nesting in tests (facebook#12457) //<Brian Vaughn>// - **[026aa9c97](facebook/react@026aa9c97)**: Bumped version to 16.4.3-alpha.0 (facebook#13448) //<Brian Vaughn>// - **[d670bdc6b](facebook/react@d670bdc6b)**: Warn about ReactDOM.createPortal usage within ReactTestRenderer (facebook#12895) //<Brian Vaughn>// - **[bf1abf478](facebook/react@bf1abf478)**: Fix React.lazy(forwardRef) (facebook#13446) //<Dan Abramov>// - **[e8571c798](facebook/react@e8571c798)**: Tweak ReactTypeOfWork order (facebook#13444) //<Dan Abramov>// - **[973496b40](facebook/react@973496b40)**: Fix component name for React.lazy (facebook#13443) //<Dan Abramov>// - **[0beb2ee76](facebook/react@0beb2ee76)**: Fix incorrect legacy context for factory components (facebook#13441) //<Dan Abramov>// - **[004cb21bb](facebook/react@004cb21bb)**: Short circuit the logic for exporting a module (facebook#13392) //<Joseph>// - **[f7a538c91](facebook/react@f7a538c91)**: Remove getTextContentAccessor (facebook#13434) //<Brandon Dail>// - **[d1c42d2f1](facebook/react@d1c42d2f1)**: Remove addEventListener check in isEventSupported (facebook#13435) //<Brandon Dail>// - **[a869f992a](facebook/react@a869f992a)**: Remove helper object from FallbackCompositionState (facebook#13430) //<Brandon Dail>// - **[0cd8d470d](facebook/react@0cd8d470d)**: Do not toLowerCase lists of lowercase words (facebook#13428) //<Nathan Hunzaker>// - **[b3a4cfea5](facebook/react@b3a4cfea5)**: Trap click events for portal root (facebook#11927) //<Brandon Dail>// - **[0da5102cf](facebook/react@0da5102cf)**: Add interaction-tracking/subscriptions (facebook#13426) //<Brian Vaughn>// - **[4b32f525e](facebook/react@4b32f525e)**: Refactor away some namespace imports (facebook#13427) //<Dan Abramov>// - **[d2f5c3fbc](facebook/react@d2f5c3fbc)**: Don't diff memoized host components in completion phase (facebook#13423) //<Dan Abramov>// - **[5e0f073d5](facebook/react@5e0f073d5)**: interaction-tracking package (facebook#13234) //<Brian Vaughn>// - **[d14e443d6](facebook/react@d14e443d6)**: Resume onSelect tracking after dragend (facebook#13422) //<Dan Abramov>// - **[d5edc1f51](facebook/react@d5edc1f51)**: Remove unused ReactCall & ReactReturn types (facebook#13419) //<Esteban>// - **[4fa20b53b](facebook/react@4fa20b53b)**: Don't pass instanceHandle to clones (facebook#13125) //<Sebastian Markbåge>// - **[fe959eea7](facebook/react@fe959eea7)**: React.lazy (facebook#13398) //<Andrew Clark>// - **[2b3082800](facebook/react@2b3082800)**: Fix wrong Flow return type //<Andrew Clark>// - **[5031ebf6b](facebook/react@5031ebf6b)**: Accept promise as element type (facebook#13397) //<Andrew Clark>// - **[77b7a660b](facebook/react@77b7a660b)**: fix: do not reconcile children that are iterable functions (facebook#13416) //<Rauno Freiberg>// - **[cb7745c6c](facebook/react@cb7745c6c)**: remove unused state initialValue from ReactDOMFiberSelect (facebook#13412) //<Kartik Lad>// - **[9832a1b6d](facebook/react@9832a1b6d)**: Avoid setting empty value on reset & submit inputs (facebook#12780) //<Ellis Clayton>// - **[8862172fa](facebook/react@8862172fa)**: Provide a better error message (facebook#12421) //<Aaron Brager>// - **[581682917](facebook/react@581682917)**: De-duplicate commitUpdateQueue effect commit (facebook#13403) //<Ruud Burger>// - **[1bc975d07](facebook/react@1bc975d07)**: Don't stop context traversal at matching consumers (facebook#13391) //<Andrew Clark>// - **[83e446e1d](facebook/react@83e446e1d)**: Refactor ReactErrorUtils (facebook#13406) //<Dan Abramov>// - **[13fa96a54](facebook/react@13fa96a54)**: Improve bad ref invariant (facebook#13408) //<Dan Abramov>// - **[b2adcfba3](facebook/react@b2adcfba3)**: Don't suppress jsdom error reporting in our tests (facebook#13401) //<Dan Abramov>// - **[69e2a0d73](facebook/react@69e2a0d73)**: Ability to access window.event in development (facebook#11687) (facebook#11696) //<Conrad Irwin>// - **[ade4dd3f6](facebook/react@ade4dd3f6)**: Fix typo in a comment (facebook#13373) //<davidblnc>// - **[2c59076d2](facebook/react@2c59076d2)**: Warn when "false" or "true" is the value of a boolean DOM prop (facebook#13372) //<Moti Zilberman>// - **[de5102c4c](facebook/react@de5102c4c)**: Ignore symbols and functions in select tag (facebook#13389) //<Rauno Freiberg>// - **[d04d03e47](facebook/react@d04d03e47)**: Fix passing symbols and functions to textarea (facebook#13362) //<Rauno Freiberg>// - **[5550ed4a8](facebook/react@5550ed4a8)**: Ensure arguments are coerced to strings in warnings (facebook#13385) //<Nathan Hunzaker>// - **[3938ccc88](facebook/react@3938ccc88)**: Allow the user to opt out of seeing "The above error..." addendum (facebook#13384) //<Dan Abramov>// - **[47e217a77](facebook/react@47e217a77)**: Provide component reference in ReactDOMFiberTextarea warnings (facebook#13361) //<Rauno Freiberg>// - **[a0190f828](facebook/react@a0190f828)**: Rename SafeValue to ToStringValue (facebook#13376) //<Philipp Spieß>// - **[33602d435](facebook/react@33602d435)**: Improve soundness of ReactDOMFiberInput typings (facebook#13367) //<Philipp Spieß>// - **[ae855cec2](facebook/react@ae855cec2)**: Support tangentialPressure and twist fields of pointer events (facebook#13374) //<Moti Zilberman>// - **[725e499cf](facebook/react@725e499cf)**: Rely on bubbling for submit and reset events (facebook#13358) //<Philipp Spieß>// - **[e07a3cd28](facebook/react@e07a3cd28)**: fix typo on inline comment (facebook#13364) //<Alex Rohleder>// - **[e0204084a](facebook/react@e0204084a)**: Fix typos detected by github.com/client9/misspell (facebook#13349) //<Kazuhiro Sera>// - **[be4533af7](facebook/react@be4533af7)**: Fix hydration of non-string dangerousSetInnerHTML.__html (facebook#13353) //<Dan Abramov>// - **[0072b5998](facebook/react@0072b5998)**: Improve scry() error message for bad first argument (facebook#13351) //<Dan Abramov>// - **[d59b993a7](facebook/react@d59b993a7)**: Make nicer stacks DEV-only //<Dan>// - **[54d86eb82](facebook/react@54d86eb82)**: Improve display of filenames in component stack (facebook#12059) //<Billy Janitsch>// - **[067cc24f5](facebook/react@067cc24f5)**: Profiler actualDuration bugfix (facebook#13313) //<Brian Vaughn>// - **[3cfab14b9](facebook/react@3cfab14b9)**: Treat focusable as enumerated boolean SVG attribute (facebook#13339) //<Dan Abramov>// - **[3b3b7fcbb](facebook/react@3b3b7fcbb)**: Don't search beyond Sync roots for highest priority work (facebook#13335) //<Dan Abramov>// - **[08e32263f](facebook/react@08e32263f)**: Fix Prettier "No parser" warning while building (facebook#13323) //<Bartosz Kaszubowski>// - **[ac7238856](facebook/react@ac7238856)**: Add support for auxclick event (facebook#11571) //<Jason Quense>// - **[75491a8f4](facebook/react@75491a8f4)**: Add a regression test for facebook#12200 (facebook#12242) //<Gareth Small>// - **[2d0356a52](facebook/react@2d0356a52)**: Make sure that `select` has `multiple` attribute set to appropriate state before appending options (facebook#13270) //<Dmytro Zasyadko>// - **[b179bae0a](facebook/react@b179bae0a)**: Enhance get derived state from props state warning - facebook#12670 (facebook#13317) //<Felix Wu>// - **[15a8f0318](facebook/react@15a8f0318)**: Fix ambiguity in doc comment for isValidElement (facebook#12826) //<Alexey>// - **[5cff21207](facebook/react@5cff21207)**: add flowtype to function signature (facebook#13285) //<ryota-murakami>// - **[b565f4953](facebook/react@b565f4953)**: Minimally support iframes (nested browsing contexts) in selection event handling (facebook#12037) //<Andrew Patton>// - **[1609cf343](facebook/react@1609cf343)**: Warn about rendering Generators (facebook#13312) //<Dan Abramov>// - **[46d5afc54](facebook/react@46d5afc54)**: Replace console.error() with a throw in setTimeout() as last resort exception logging (facebook#13310) //<Dan Abramov>// - **[b3b80a483](facebook/react@b3b80a483)**: Inject react-art renderer into react-devtools (facebook#13173) //<Yunchan Cho>// - **[5e8beec84](facebook/react@5e8beec84)**: Add a regression test for facebook#11602 //<Dan Abramov>// - **[470377bbd](facebook/react@470377bbd)**: Remove extraneous condition //<Dan Abramov>// - **[6db080154](facebook/react@6db080154)**: Remove irrelevant suggestion of a legacy method from a warning (facebook#13169) //<Ideveloper>// - **[f60a7f722](facebook/react@f60a7f722)**: Fix SSR crash on a hasOwnProperty attribute (facebook#13303) //<Dan Abramov>// - **[ff41519ec](facebook/react@ff41519ec)**: Sanitize unknown attribute names for SSR (facebook#13302) //<Dan Abramov>// - **[c44c2a216](facebook/react@c44c2a216)**: More helpful message when passing an element to createElement() (facebook#13131) //<Dylan Cutler>// - **[28cd494bd](facebook/react@28cd494bd)**: Refactor validateDOMNesting a bit (facebook#13300) //<Dan Abramov>// - **[b381f4141](facebook/react@b381f4141)**: Allow Electrons <webview> tag (facebook#13301) //<Philipp Spieß>// - **[0182a7463](facebook/react@0182a7463)**: Fix a crash when using dynamic children in <option> tag (facebook#13261) //<Konstantin Yakushin>// - **[2a2ef7e0f](facebook/react@2a2ef7e0f)**: Remove unnecessary branching from updateContextProvider (facebook#13282) //<Andrew Clark>// - **[840cb1a26](facebook/react@840cb1a26)**: Add an invariant to createRoot() to validate containers (facebook#13279) //<Dan Abramov>// Release Notes: [GENERAL] [FEATURE] [React] - React sync for revisions bc1ea9c...ade5e69 Reviewed By: bvaughn Differential Revision: D9561644 fbshipit-source-id: 3be120d7450f310af458897d54993a6c086cff2f
Summary: This sync includes the following changes: - **[ade5e6928](facebook/react@ade5e6928)**: Manually update schedule dep in react-native-renderer (facebook#13609) //<Brian Vaughn>// - **[f260b14a8](facebook/react@f260b14a8)**: Fix host bailout for the persistent mode (facebook#13611) //<Dan Abramov>// - **[4a40d7624](facebook/react@4a40d7624)**: Fix a regression related to isReactComponent prototype check (facebook#13608) //<Dan Abramov>// - **[03ab1efeb](facebook/react@03ab1efeb)**: Improve DX when combining react-dom/profiling and schedule/tracking (facebook#13605) //<Brian Vaughn>// - **[144328fe8](facebook/react@144328fe8)**: Enable no-use-before-define rule (facebook#13606) //<Dan Abramov>// - **[8a8d973d3](facebook/react@8a8d973d3)**: Use clearer wording //<Dan>// - **[7d1169b2d](facebook/react@7d1169b2d)**: Remove injectComponentTree from unstable-native-dependencies, add EventPluginHub (facebook#13598) //<Brandon Dail>// - **[8d1038fc6](facebook/react@8d1038fc6)**: Break up ReactDOMServerIntegrationForm-test (facebook#13600) //<Nathan Hunzaker>// - **[b87aabdfe](facebook/react@b87aabdfe)**: Drop the year from Facebook copyright headers and the LICENSE file. (facebook#13593) //<Héctor Ramos>// - **[e417e0bf7](facebook/react@e417e0bf7)**: Update ReactNativeViewConfigRegistry Flow Types (facebook#13579) //<Timothy Yung>// - **[71c0e05ba](facebook/react@71c0e05ba)**: Update bundle sizes for 16.5.0 release //<Brian Vaughn>// - **[6255cc394](facebook/react@6255cc394)**: Updating package versions for release 16.5.0 //<Brian Vaughn>// - **[28cb37978](facebook/react@28cb37978)**: Added a test for Profiler onRender that throws (facebook#13575) //<Brian Vaughn>// - **[8963118b3](facebook/react@8963118b3)**: Update react-dom README //<Dan Abramov>// - **[b47a28cb9](facebook/react@b47a28cb9)**: Tweak react-dom README //<Dan Abramov>// - **[f765f0225](facebook/react@f765f0225)**: When a root expires, flush all expired work in a single batch (facebook#13503) //<Andrew Clark>// - **[550dd1d2e](facebook/react@550dd1d2e)**: Call Profiler onRender after mutations (facebook#13572) //<Brian Vaughn>// - **[34348a45b](facebook/react@34348a45b)**: Add enableSuspenseServerRenderer feature flag (facebook#13573) //<Alex Taylor>// - **[4e744be6e](facebook/react@4e744be6e)**: Added react-dom/profiling entry point to NPM package (facebook#13570) //<Brian Vaughn>// - **[bb627228e](facebook/react@bb627228e)**: test: add test for fragement props (facebook#13565) //<laoxiong>// - **[9a110ebd8](facebook/react@9a110ebd8)**: Cleaned up 'schedule' API wrt interactions and subscriber ref: (facebook#13561) //<Brian Vaughn>// - **[fb88fd9d8](facebook/react@fb88fd9d8)**: Fixed schedule/tracking require for www sync script (facebook#13556) //<Brian Vaughn>// - **[955393cab](facebook/react@955393cab)**: refactor: remove emove type judgment when defining warning props (facebook#13553) //<laoxiong>// - **[ff9399602](facebook/react@ff9399602)**: Fix import of ReactDOM in server env //<Dan Abramov>// - **[281bd64c0](facebook/react@281bd64c0)**: Fix test file name //<Dan Abramov>// - **[d6b59e3d2](facebook/react@d6b59e3d2)**: Check document.documentMode once //<Dan Abramov>// - **[52633c84e](facebook/react@52633c84e)**: Try/finally //<Dan Abramov>// - **[2d4705e75](facebook/react@2d4705e75)**: Make IE 11 not complain about non-crucial style attribute hydration mismatch (facebook#13534) //<Michał Gołębiowski-Owczarek>// - **[25d48a728](facebook/react@25d48a728)**: Add gridArea to unitless CSS properties (facebook#13550) //<Michał Gołębiowski-Owczarek>// - **[877f8bc6b](facebook/react@877f8bc6b)**: Renamed schedule UMD forwarding methods to stay in-sync with SECRET_INTERNALS change (facebook#13549) //<Brian Vaughn>// - **[0a96f9057](facebook/react@0a96f9057)**: Revert "Extract common logic" (facebook#13547) //<Dan Abramov>// - **[17a57adde](facebook/react@17a57adde)**: Fix test //<Dan Abramov>// - **[605da8b42](facebook/react@605da8b42)**: Extract common logic (facebook#13535) //<Heaven>// - **[69f9f4127](facebook/react@69f9f4127)**: Document event bubble order (facebook#13546) //<Philipp>// - **[c1ba7b8cf](facebook/react@c1ba7b8cf)**: Remove www scheduler fork (facebook#13545) //<Dan Abramov>// - **[b473d5f86](facebook/react@b473d5f86)**: Secret exports: Scheduler => Schedule (facebook#13544) //<Dan Abramov>// - **[6312efc34](facebook/react@6312efc34)**: Tweak README and description //<Dan Abramov>// - **[b92f947af](facebook/react@b92f947af)**: Rename "react-scheduler" package to "schedule" (facebook#13543) //<Brian Vaughn>// - **[3c1dcd349](facebook/react@3c1dcd349)**: Expose less internals for TestUtils (facebook#13539) //<Dan Abramov>// - **[0b74e95d7](facebook/react@0b74e95d7)**: Ignore noscript content on the client (facebook#13537) //<Fredrik Höglund>// - **[8a1e3962a](facebook/react@8a1e3962a)**: Remove negative lookbehind from Rollup plugin that broke Node <= v8.9 (facebook#13538) //<Brian Vaughn>// - **[9604d26ae](facebook/react@9604d26ae)**: Rename ReactDOMFiber* to ReactDOM* (facebook#13540) //<Dan Abramov>// - **[28b928902](facebook/react@28b928902)**: Tidied up scheduling UMD API forwarding test (facebook#13533) //<Brian Vaughn>// - **[bf8aa6092](facebook/react@bf8aa6092)**: Added Jest test to verify UMD API-forwarding for scheduling package (facebook#13532) //<Brian Vaughn>// - **[0040efc8d](facebook/react@0040efc8d)**: Fix a typo (facebook#13531) //<Heaven>// - **[46950a3df](facebook/react@46950a3df)**: Interaction tracking follow up (facebook#13509) //<Brian Vaughn>// - **[0452c9bba](facebook/react@0452c9bba)**: Add a regression test for facebook#4618 //<Dan Abramov>// - **[c21bab694](facebook/react@c21bab694)**: Add SSR regression test for facebook#6119 //<Dan Abramov>// - **[0d3fc9de1](facebook/react@0d3fc9de1)**: Add regression test for facebook#6119 //<Dan Abramov>// - **[0f050ad7c](facebook/react@0f050ad7c)**: Make regression test better //<Dan Abramov>// - **[f94342323](facebook/react@f94342323)**: Add a more precise regression test for facebook#6219 //<Dan Abramov>// - **[a3e4d0008](facebook/react@a3e4d0008)**: Fixed typo (facebook#13519) //<Ivan>// - **[b3d8c5376](facebook/react@b3d8c5376)**: [RN] Remove isMounted() false positive warning (facebook#13511) //<Dan Abramov>// - **[d2123d656](facebook/react@d2123d656)**: Sync React Native Flow Changes (facebook#13513) //<Timothy Yung>// - **[1c0ba70b4](facebook/react@1c0ba70b4)**: Fix test to use AsyncMode //<Dan>// - **[6e4f7c788](facebook/react@6e4f7c788)**: Profiler integration with interaction-tracking package (facebook#13253) //<Brian Vaughn>// - **[2967ebdbe](facebook/react@2967ebdbe)**: Remove buggy unstable_deferredUpdates() (facebook#13488) //<Dan Abramov>// - **[1664b08f0](facebook/react@1664b08f0)**: added flow types to setInnerHTML (facebook#13495) //<Bryan M>// - **[672e859d3](facebook/react@672e859d3)**: Add warning to prevent setting this.state to this.props referentially (facebook#11658) //<Veekas Shrivastava>// - **[29287f088](facebook/react@29287f088)**: Rename lowestPendingInteractiveExpirationTime (facebook#13484) //<Heaven>// - **[d400d6d5e](facebook/react@d400d6d5e)**: Replace magic number 1 with ELEMENT_NODE (facebook#13479) //<Heaven>// - **[340bfd939](facebook/react@340bfd939)**: Rename ReactTypeOfWork to ReactWorkTags, ReactTypeOfSideEffect to ReactSideEffectTags (facebook#13476) //<Sophie Alpert>// - **[5cefd9b1e](facebook/react@5cefd9b1e)**: Stringify <option> children (facebook#13465) //<Dan Abramov>// - **[3661616c2](facebook/react@3661616c2)**: Improve test harness of submit events (facebook#13463) //<Philipp Spieß>// - **[a1be17140](facebook/react@a1be17140)**: Revert "Rely on bubbling for submit and reset events (facebook#13358)" (facebook#13462) //<Dan Abramov>// - **[90c92c700](facebook/react@90c92c700)**: Fix warning message //<Dan Abramov>// - **[5cb0f2bf5](facebook/react@5cb0f2bf5)**: Change www error shim API (facebook#13454) //<Dan Abramov>// - **[e106b8c44](facebook/react@e106b8c44)**: Warn about unsafe toWarnDev() nesting in tests (facebook#12457) //<Brian Vaughn>// - **[026aa9c97](facebook/react@026aa9c97)**: Bumped version to 16.4.3-alpha.0 (facebook#13448) //<Brian Vaughn>// - **[d670bdc6b](facebook/react@d670bdc6b)**: Warn about ReactDOM.createPortal usage within ReactTestRenderer (facebook#12895) //<Brian Vaughn>// - **[bf1abf478](facebook/react@bf1abf478)**: Fix React.lazy(forwardRef) (facebook#13446) //<Dan Abramov>// - **[e8571c798](facebook/react@e8571c798)**: Tweak ReactTypeOfWork order (facebook#13444) //<Dan Abramov>// - **[973496b40](facebook/react@973496b40)**: Fix component name for React.lazy (facebook#13443) //<Dan Abramov>// - **[0beb2ee76](facebook/react@0beb2ee76)**: Fix incorrect legacy context for factory components (facebook#13441) //<Dan Abramov>// - **[004cb21bb](facebook/react@004cb21bb)**: Short circuit the logic for exporting a module (facebook#13392) //<Joseph>// - **[f7a538c91](facebook/react@f7a538c91)**: Remove getTextContentAccessor (facebook#13434) //<Brandon Dail>// - **[d1c42d2f1](facebook/react@d1c42d2f1)**: Remove addEventListener check in isEventSupported (facebook#13435) //<Brandon Dail>// - **[a869f992a](facebook/react@a869f992a)**: Remove helper object from FallbackCompositionState (facebook#13430) //<Brandon Dail>// - **[0cd8d470d](facebook/react@0cd8d470d)**: Do not toLowerCase lists of lowercase words (facebook#13428) //<Nathan Hunzaker>// - **[b3a4cfea5](facebook/react@b3a4cfea5)**: Trap click events for portal root (facebook#11927) //<Brandon Dail>// - **[0da5102cf](facebook/react@0da5102cf)**: Add interaction-tracking/subscriptions (facebook#13426) //<Brian Vaughn>// - **[4b32f525e](facebook/react@4b32f525e)**: Refactor away some namespace imports (facebook#13427) //<Dan Abramov>// - **[d2f5c3fbc](facebook/react@d2f5c3fbc)**: Don't diff memoized host components in completion phase (facebook#13423) //<Dan Abramov>// - **[5e0f073d5](facebook/react@5e0f073d5)**: interaction-tracking package (facebook#13234) //<Brian Vaughn>// - **[d14e443d6](facebook/react@d14e443d6)**: Resume onSelect tracking after dragend (facebook#13422) //<Dan Abramov>// - **[d5edc1f51](facebook/react@d5edc1f51)**: Remove unused ReactCall & ReactReturn types (facebook#13419) //<Esteban>// - **[4fa20b53b](facebook/react@4fa20b53b)**: Don't pass instanceHandle to clones (facebook#13125) //<Sebastian Markbåge>// - **[fe959eea7](facebook/react@fe959eea7)**: React.lazy (facebook#13398) //<Andrew Clark>// - **[2b3082800](facebook/react@2b3082800)**: Fix wrong Flow return type //<Andrew Clark>// - **[5031ebf6b](facebook/react@5031ebf6b)**: Accept promise as element type (facebook#13397) //<Andrew Clark>// - **[77b7a660b](facebook/react@77b7a660b)**: fix: do not reconcile children that are iterable functions (facebook#13416) //<Rauno Freiberg>// - **[cb7745c6c](facebook/react@cb7745c6c)**: remove unused state initialValue from ReactDOMFiberSelect (facebook#13412) //<Kartik Lad>// - **[9832a1b6d](facebook/react@9832a1b6d)**: Avoid setting empty value on reset & submit inputs (facebook#12780) //<Ellis Clayton>// - **[8862172fa](facebook/react@8862172fa)**: Provide a better error message (facebook#12421) //<Aaron Brager>// - **[581682917](facebook/react@581682917)**: De-duplicate commitUpdateQueue effect commit (facebook#13403) //<Ruud Burger>// - **[1bc975d07](facebook/react@1bc975d07)**: Don't stop context traversal at matching consumers (facebook#13391) //<Andrew Clark>// - **[83e446e1d](facebook/react@83e446e1d)**: Refactor ReactErrorUtils (facebook#13406) //<Dan Abramov>// - **[13fa96a54](facebook/react@13fa96a54)**: Improve bad ref invariant (facebook#13408) //<Dan Abramov>// - **[b2adcfba3](facebook/react@b2adcfba3)**: Don't suppress jsdom error reporting in our tests (facebook#13401) //<Dan Abramov>// - **[69e2a0d73](facebook/react@69e2a0d73)**: Ability to access window.event in development (facebook#11687) (facebook#11696) //<Conrad Irwin>// - **[ade4dd3f6](facebook/react@ade4dd3f6)**: Fix typo in a comment (facebook#13373) //<davidblnc>// - **[2c59076d2](facebook/react@2c59076d2)**: Warn when "false" or "true" is the value of a boolean DOM prop (facebook#13372) //<Moti Zilberman>// - **[de5102c4c](facebook/react@de5102c4c)**: Ignore symbols and functions in select tag (facebook#13389) //<Rauno Freiberg>// - **[d04d03e47](facebook/react@d04d03e47)**: Fix passing symbols and functions to textarea (facebook#13362) //<Rauno Freiberg>// - **[5550ed4a8](facebook/react@5550ed4a8)**: Ensure arguments are coerced to strings in warnings (facebook#13385) //<Nathan Hunzaker>// - **[3938ccc88](facebook/react@3938ccc88)**: Allow the user to opt out of seeing "The above error..." addendum (facebook#13384) //<Dan Abramov>// - **[47e217a77](facebook/react@47e217a77)**: Provide component reference in ReactDOMFiberTextarea warnings (facebook#13361) //<Rauno Freiberg>// - **[a0190f828](facebook/react@a0190f828)**: Rename SafeValue to ToStringValue (facebook#13376) //<Philipp Spieß>// - **[33602d435](facebook/react@33602d435)**: Improve soundness of ReactDOMFiberInput typings (facebook#13367) //<Philipp Spieß>// - **[ae855cec2](facebook/react@ae855cec2)**: Support tangentialPressure and twist fields of pointer events (facebook#13374) //<Moti Zilberman>// - **[725e499cf](facebook/react@725e499cf)**: Rely on bubbling for submit and reset events (facebook#13358) //<Philipp Spieß>// - **[e07a3cd28](facebook/react@e07a3cd28)**: fix typo on inline comment (facebook#13364) //<Alex Rohleder>// - **[e0204084a](facebook/react@e0204084a)**: Fix typos detected by github.com/client9/misspell (facebook#13349) //<Kazuhiro Sera>// - **[be4533af7](facebook/react@be4533af7)**: Fix hydration of non-string dangerousSetInnerHTML.__html (facebook#13353) //<Dan Abramov>// - **[0072b5998](facebook/react@0072b5998)**: Improve scry() error message for bad first argument (facebook#13351) //<Dan Abramov>// - **[d59b993a7](facebook/react@d59b993a7)**: Make nicer stacks DEV-only //<Dan>// - **[54d86eb82](facebook/react@54d86eb82)**: Improve display of filenames in component stack (facebook#12059) //<Billy Janitsch>// - **[067cc24f5](facebook/react@067cc24f5)**: Profiler actualDuration bugfix (facebook#13313) //<Brian Vaughn>// - **[3cfab14b9](facebook/react@3cfab14b9)**: Treat focusable as enumerated boolean SVG attribute (facebook#13339) //<Dan Abramov>// - **[3b3b7fcbb](facebook/react@3b3b7fcbb)**: Don't search beyond Sync roots for highest priority work (facebook#13335) //<Dan Abramov>// - **[08e32263f](facebook/react@08e32263f)**: Fix Prettier "No parser" warning while building (facebook#13323) //<Bartosz Kaszubowski>// - **[ac7238856](facebook/react@ac7238856)**: Add support for auxclick event (facebook#11571) //<Jason Quense>// - **[75491a8f4](facebook/react@75491a8f4)**: Add a regression test for facebook#12200 (facebook#12242) //<Gareth Small>// - **[2d0356a52](facebook/react@2d0356a52)**: Make sure that `select` has `multiple` attribute set to appropriate state before appending options (facebook#13270) //<Dmytro Zasyadko>// - **[b179bae0a](facebook/react@b179bae0a)**: Enhance get derived state from props state warning - facebook#12670 (facebook#13317) //<Felix Wu>// - **[15a8f0318](facebook/react@15a8f0318)**: Fix ambiguity in doc comment for isValidElement (facebook#12826) //<Alexey>// - **[5cff21207](facebook/react@5cff21207)**: add flowtype to function signature (facebook#13285) //<ryota-murakami>// - **[b565f4953](facebook/react@b565f4953)**: Minimally support iframes (nested browsing contexts) in selection event handling (facebook#12037) //<Andrew Patton>// - **[1609cf343](facebook/react@1609cf343)**: Warn about rendering Generators (facebook#13312) //<Dan Abramov>// - **[46d5afc54](facebook/react@46d5afc54)**: Replace console.error() with a throw in setTimeout() as last resort exception logging (facebook#13310) //<Dan Abramov>// - **[b3b80a483](facebook/react@b3b80a483)**: Inject react-art renderer into react-devtools (facebook#13173) //<Yunchan Cho>// - **[5e8beec84](facebook/react@5e8beec84)**: Add a regression test for facebook#11602 //<Dan Abramov>// - **[470377bbd](facebook/react@470377bbd)**: Remove extraneous condition //<Dan Abramov>// - **[6db080154](facebook/react@6db080154)**: Remove irrelevant suggestion of a legacy method from a warning (facebook#13169) //<Ideveloper>// - **[f60a7f722](facebook/react@f60a7f722)**: Fix SSR crash on a hasOwnProperty attribute (facebook#13303) //<Dan Abramov>// - **[ff41519ec](facebook/react@ff41519ec)**: Sanitize unknown attribute names for SSR (facebook#13302) //<Dan Abramov>// - **[c44c2a216](facebook/react@c44c2a216)**: More helpful message when passing an element to createElement() (facebook#13131) //<Dylan Cutler>// - **[28cd494bd](facebook/react@28cd494bd)**: Refactor validateDOMNesting a bit (facebook#13300) //<Dan Abramov>// - **[b381f4141](facebook/react@b381f4141)**: Allow Electrons <webview> tag (facebook#13301) //<Philipp Spieß>// - **[0182a7463](facebook/react@0182a7463)**: Fix a crash when using dynamic children in <option> tag (facebook#13261) //<Konstantin Yakushin>// - **[2a2ef7e0f](facebook/react@2a2ef7e0f)**: Remove unnecessary branching from updateContextProvider (facebook#13282) //<Andrew Clark>// - **[840cb1a26](facebook/react@840cb1a26)**: Add an invariant to createRoot() to validate containers (facebook#13279) //<Dan Abramov>// Release Notes: [GENERAL] [FEATURE] [React] - React sync for revisions bc1ea9c...ade5e69 Reviewed By: bvaughn Differential Revision: D9561644 fbshipit-source-id: 3be120d7450f310af458897d54993a6c086cff2f
…e from a long list (#25276) Summary: axe-fb reported this side effect from my previous commit in #24793 (comment) After revisited the implementation of Android Spinner, it seems the formal way to update existing adapter is mutating it, i.e. `arrayAdapter.clear()` & `arrayAdapter.addAll()` to update a Spinner Adapter. `setAdapter()` will reset everything including `mDataChanged`. A race condition may happens between rendering a long picker list and reseting adapter. Here is a code snippet: https://snack.expo.io/kudochien/80f810 To reproduce the issue, please select large item (e.g. 500) first and click the button right hand side. Please not to verify this on Expo directly in the meantime, because Expo with RN 0.59 does not include my previous commit. ## Changelog [Android] [Fixed] - Fix Picker ArrayOutOfBoundsException during Picker.Item update from a long list Pull Request resolved: #25276 Test Plan: 1. Check the test case https://snack.expo.io/kudochien/80f810 will have exception or not. 2. Regression of https://snack.expo.io/Sy1JClEag from #13351 3. Regression of https://snack.expo.io/kudochien/android-picker-issue from #22821 4. RNTester Picker example Reviewed By: mdvacca Differential Revision: D15857426 Pulled By: axe-fb fbshipit-source-id: 8ef902447fdd1b8aeab50ad061545cd14c735e51
same issue here |
you should understand the issue first |
same issue. |
Same issue here. |
There is this naming trouble, be careful, prop |
…e from a long list (facebook#25276) Summary: axe-fb reported this side effect from my previous commit in facebook#24793 (comment) After revisited the implementation of Android Spinner, it seems the formal way to update existing adapter is mutating it, i.e. `arrayAdapter.clear()` & `arrayAdapter.addAll()` to update a Spinner Adapter. `setAdapter()` will reset everything including `mDataChanged`. A race condition may happens between rendering a long picker list and reseting adapter. Here is a code snippet: https://snack.expo.io/kudochien/80f810 To reproduce the issue, please select large item (e.g. 500) first and click the button right hand side. Please not to verify this on Expo directly in the meantime, because Expo with RN 0.59 does not include my previous commit. ## Changelog [Android] [Fixed] - Fix Picker ArrayOutOfBoundsException during Picker.Item update from a long list Pull Request resolved: facebook#25276 Test Plan: 1. Check the test case https://snack.expo.io/kudochien/80f810 will have exception or not. 2. Regression of https://snack.expo.io/Sy1JClEag from facebook#13351 3. Regression of https://snack.expo.io/kudochien/android-picker-issue from facebook#22821 4. RNTester Picker example Reviewed By: mdvacca Differential Revision: D15857426 Pulled By: axe-fb fbshipit-source-id: 8ef902447fdd1b8aeab50ad061545cd14c735e51
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 theselectedValue
is stil present in the listAdditional Information
The text was updated successfully, but these errors were encountered: