Typescript is complaining Parameter 'event' implicitly has an 'any' type. for the event in the onScroll function.
const onScroll = (event) => { console.log("width: ", event.nativeEvent.layoutMeasurement.width);};<FlatList data={data} renderItem={renderItem} onScroll={onScroll}/>
Then I traced onScroll prop on the FlatList, found
/** * Fires at most once per frame during scrolling. * The frequency of the events can be contolled using the scrollEventThrottle prop. */onScroll?: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
Then I updated the onScroll to the following, event type complaining is gone, but it's now complaining "Property 'nativeEvent' does not exist on type 'NativeSyntheticEvent'" for event.nativeEvent
const onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => { console.log("width: ", event.nativeEvent.layoutMeasurement.width);};
What is the event type for the onScroll's event parameter?