Correcting a mistake in the minimal example in the FlatList doc
Summary: The list items' selected state is inside the `selected` Map, not inside the `state`. This PR corrects a small mistake in the minimal example in the Documentatioin of the FlatList component. 1. Create a vanilla React Native project. 2. Create the components involved in the minimal example of FlatList. 3. Run to see if the `selected` property of the `MyListItem` changes as intended. Currently the example has this mistake so an error will show up when running: ![2017-05-05 2 00 12](https://cloud.githubusercontent.com/assets/5442413/25735154/c091f11a-319b-11e7-9646-427c6a56f901.png) Closes https://github.com/facebook/react-native/pull/13795 Differential Revision: D5010105 Pulled By: javache fbshipit-source-id: 09585cea2f2e3e6746419ef54ef8da9dbdb8dbb1
This commit is contained in:
parent
863e66e449
commit
c7d37a208a
|
@ -246,7 +246,7 @@ type DefaultProps = typeof defaultProps;
|
|||
* this.setState((state) => {
|
||||
* // copy the map rather than modifying state.
|
||||
* const selected = new Map(state.selected);
|
||||
* selected.set(id, !state.get(id)); // toggle
|
||||
* selected.set(id, !selected.get(id)); // toggle
|
||||
* return {selected};
|
||||
* });
|
||||
* };
|
||||
|
|
Loading…
Reference in New Issue