この文書の現在のバージョンと選択したバージョンの差分を表示します。
次のリビジョン | 前のリビジョン | ||
reactnative:flatlist [2019/02/10 16:56] ips 作成 |
reactnative:flatlist [2019/02/11 19:38] (現在) ips |
||
---|---|---|---|
ライン 2: | ライン 2: | ||
[[https://qiita.com/ozaki25/items/ef02ac136158c2bf189a|[React Native]FlatListのdataを変更しても画面が更新されない]] | [[https://qiita.com/ozaki25/items/ef02ac136158c2bf189a|[React Native]FlatListのdataを変更しても画面が更新されない]] | ||
+ | |||
+ | |||
+ | ====== VirtualizedList: missing keys for items, make sure to specify a key property on each item or provide a custom keyExtractor., ====== | ||
+ | |||
+ | <code> | ||
+ | [17:19:16] VirtualizedList: missing keys for items, make sure to specify a key property on each item or provide a custom keyExtractor., | ||
+ | - node_modules\expo\build\logs\LogSerialization.js:145:14 in _captureConsoleStackTrace | ||
+ | - node_modules\expo\build\logs\LogSerialization.js:40:24 in Object.serializeLogDataAsync$ | ||
+ | - ... 9 more stack frames from framework internals | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | <FlatList | ||
+ | data={this.state.data} | ||
+ | execData={this.state.update} | ||
+ | keyExtractor={(item, index) => index.toString()} // warningがでなくなった | ||
+ | renderItem={({item}) => | ||
+ | <Swipeout | ||
+ | autoClose={true} | ||
+ | sectionID={item.rowid} | ||
+ | rowID={item.rowid} | ||
+ | </code> | ||
+ | |||
+ | [[https://stackoverflow.com/questions/44545148/basic-flatlist-code-throws-warning-react-native|Basic FlatList code throws Warning - React Native]] | ||
+ | |||
+ | ====== どうしても更新されない ====== | ||
+ | どうしても削除した行がきれいに更新されず、からの行がのこって変になる。 | ||
+ | しかたがないので一旦stateをnullで更新してから再設定するとうまくいった。 | ||
+ | stateの更新方法になにかなぞがある? |