以下是版本4.x的React Navigation文档中可用的示例
import { NavigationStackScreenComponent } from 'react-navigation-stack';
type Params = { userId: string };
type ScreenProps = { language: string };
const ProfileScreen: NavigationStackScreenComponent<
Params,
ScreenProps
> = props => {
// ...
};
ProfileScreen.navigationOptions = {
headerTitle: 'Profile',
};
在打字稿世界中我仍然是菜鸟,但试图使其适应我的React Native Projects。
我遇到的问题是NavigationStackScreenComponent
泛型接受导航参数和screenProps的类型,但是我无法(也许有,但我找不到它!)为组件prop添加类型注释。1 >