[Flow202][native][skip-ci] [12/x] Enable StackView to parameterize on invocation
Summary:
One of the quirks of Flow is that the only way to type a React component in a way where the types are parameterized on invocation is to type it as a function.
In our codebase, we render StackView inside a couple custom navigators. In those contexts, in order for the types to match, we need the StackView to be able to take a type that is more specific than StackNavigationHelpers<>.
I initially tried to address this by convincing Flow that the more specific types (ChatNavigationHelpers<> and RootNavigationHelpers<>) are subtypes of the more general type (StackNavigationHelpers<>). However, this turned out to be impossible because of a covariance / contravariance issue. Because StackNavigationHelpers's type param is used in both "in" and "out" contexts, that type param must match exactly for the subtype relationship to work.
Instead, I concluded that I had to parameterize StackView. I implemented an alternate type that matches the existing one, but uses a function with type params in place of React.ComponentType. With this change, Flow is properly able to match up the types for `StackView.
Depends on D9995
Test Plan: Confirm the Flow errors go away
Reviewers: tomek
Reviewed By: tomek
Differential Revision: https://phab.comm.dev/D9996