Setting contentOffset and contentInset in FlatList breaks viewabilityConfigCallbackPairs logic #26282
Closed
Description
React Native version: 0.60.5, Platform: iOS
Describe what you expected to happen:
At intial render should call onViewableItemsChanged in viewabilityConfig
Snack, code example, screenshot, or link to a repository:
public render() {
const viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs = [
{
viewabilityConfig: {
minimumViewTime: 800,
itemVisiblePercentThreshold: 50,
},
onViewableItemsChanged: ({changed}) => {
console.log(changed);
},
},
];
const contentInset: Insets = {top: 15};
const contentOffset: PointPropType = {y: -15, x: 0}
return (
<FlatList
ListEmptyComponent={this.renderEmptyElement()}
ListFooterComponent={FixedFooterBottomInsetView}
ListHeaderComponent={this.renderHeaderComponent}
data={items}
renderItem={this.handleRenderItem}
keyExtractor={this.keyExtractor}
onEndReached={this.handleOnEndReach}
onEndReachedThreshold={REACH_LIST_END_SCREENS}
viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs}
onRefresh={this.handleListRefresh}
refreshing={isRefreshing}
showsVerticalScrollIndicator={false}
onScroll={this.handleScroll}
maxToRenderPerBatch={MAX_TO_RENDER_PER_BATCH}
windowSize={WINDOW_SIZE}
initialNumToRender={INITIAL_NUM_TO_RENDER}
updateCellsBatchingPeriod={UPDATE_CELLS_BATCHING_PERIOD}
contentOffset={contentOffset}
contentInset={contentInset}
scrollEventThrottle={1}
automaticallyAdjustContentInsets={false}
onScrollToIndexFailed={noop}
/>
);
}