diff --git a/src/FlashList.tsx b/src/FlashList.tsx index e028fa4c7..006f476e6 100644 --- a/src/FlashList.tsx +++ b/src/FlashList.tsx @@ -212,7 +212,9 @@ class FlashList extends React.PureComponent< return newState; } - private static getInitialMutableState(flashList): FlashListState { + private static getInitialMutableState( + flashList: FlashList + ): FlashListState { return { data: null, layoutProvider: null!!, @@ -221,6 +223,13 @@ class FlashList 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();