Flow type for specific React Native events?
Since they are exported in ViewPropTypes
you can use
import type { ViewLayoutEvent } from 'react-native/Libraries/Components/View/ViewPropTypes';
Take a look at the SyntheticEvent type. There are basic definitions for PressEvent and ScrollEvent. You can pass a type to the generic SynthenticEvent type to define anything else you need. The member 'nativeEvent' gets your custom type.
function handler(e: SyntheticEvent<CustomType>): void {
// e.nativeEvent...
}
I've not played about with that much yet, but will probably be doing so shortly.
There is documentation as part of ReactJS on the types there, and searching Native codebase should turn up if any of those are defined.
It looks like support is limited as of v0.53, so you might have to inspect what you get and roll your own.
Leyland Richardson maintains a Gist with RN types, but this doesn't cover Events.
You'll need to play a bit of detective (as you've noticed). There are a few event types in the following location.
import {type ScrollEvent} from "react-native/Libraries/Types/CoreEventTypes";
And it looks like a good place to look is the folder;
"react-native/Libraries/Types"
In any other case, jump into the source code and follow from the component you're trying to find the event for. Usually it's pretty straightforward, although annoying, to find the type.