Viewability Tracking
Called when the viewability of rows changes, as defined by the ViewabilityInfo Type:
viewabilityConfig prop.Array of changed includes ViewTokens for both visible and non-visible items. You can use the isViewable flag to filter the items.If you are tracking the time a view becomes (non-)visible, use the timestamp property. We make no guarantees that in the future viewability callbacks will be invoked as soon as they happen - for example, they might be deferred until JS thread is less busy.A default configuration for determining whether items are viewable.ViewabilityConfig Properties:
itemVisiblePercentThreshold(number): Percent of item that must be visible for a partially occluded item to count as “viewable”, 0-100. Fully visible items are always considered viewable. A value of 0 means that a single pixel in the viewport makes the item viewable, and a value of 100 means that an item must be either entirely visible or cover the entire viewport to count as viewableminimumViewTime(number): Minimum amount of time (in milliseconds) that an item must be physically viewable before the viewability callback will be firedviewAreaCoveragePercentThreshold(number): Percent of viewport that must be covered for a partially occluded item to count as “viewable”, 0-100waitForInteraction(boolean): Nothing is considered viewable until the user scrolls orrecordInteractionis called after render
List of
ViewabilityConfig/onViewableItemsChanged pairs. A specific onViewableItemsChanged will be called when its corresponding ViewabilityConfig’s conditions are met.This allows you to track multiple viewability conditions simultaneously.The
viewabilityConfigCallbackPairs value should be memoized or created outside of render to avoid unnecessary re-renders.Type Reference
ViewToken<TItem>
Represents the viewability state of an item:item: The actual data item from yourdataarraykey: Unique key for the item (fromkeyExtractor)index: Index of the item in the data arrayisViewable: Whether the item is currently viewabletimestamp: Timestamp (in milliseconds) when the viewability state changed