Skip to content

Commit

Permalink
Fix TS errors for getting stable ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Fořt committed Mar 15, 2022
1 parent d4adf8e commit d21b07a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/FlashList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ class FlashList<T> extends React.PureComponent<
return newState;
}

private static getInitialMutableState<T>(flashList): FlashListState<T> {
private static getInitialMutableState<T>(
flashList: FlashList<T>
): FlashListState<T> {
return {
data: null,
layoutProvider: null!!,
Expand All @@ -221,6 +223,13 @@ class FlashList<T> extends React.PureComponent<
return r1 !== r2;
},
(index) => {
if (
flashList.props == null ||
flashList.props.data == null ||
flashList.props.keyExtractor == null
) {
return index.toString();
}
return flashList.props
.keyExtractor(flashList.props.data[index], index)
.toString();
Expand Down

0 comments on commit d21b07a

Please sign in to comment.