For streaming events, I define custom types, such as the following:
export type OnScrollEvent = { nativeEvent: { contentOffset: { y: number }, contentSize: { height: number } } }
Obviously, there are several missing properties (for example, x and width ), but I do not need them yet.
I tried to find similar types for RN, but found only an Event type that does not seem particularly useful:
import type {Event} from "react-native"; handleEvent = (e: Event) => console.log(e.inexistentProperty)
Are there any existing stream types for React Native events, or should I continue to define them myself?
Refresh
They seem to be scattered throughout the code base. Here is the layout event type:
export type ViewLayout = { x: number, y: number, width: number, height: number, } export type ViewLayoutEvent = { nativeEvent: { layout: ViewLayout, } }
located in ViewPropTypes.js
javascript reactjs react-native flowtype
Palisand
source share