From c7d37a208aed7889ca2ff4f82c6405ed56d9f1f8 Mon Sep 17 00:00:00 2001 From: liushigit Date: Fri, 5 May 2017 11:47:28 -0700 Subject: [PATCH] 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 --- Libraries/Lists/FlatList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 3639cc36113..ea615d2363d 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -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}; * }); * };