首页 > 解决方案 > 将 CompositeScreenProps 合并到 BottomTabScreenProps

问题描述

type HomeTabParamList = {
  Chats: undefined;
  Contacts: undefined;
  Profile: undefined;
};

你如何合并

type ContactsScreenProps = CompositeScreenProps<
  BottomTabScreenProps<HomeTabParamList, 'Contacts'>,
  StackScreenProps<RootStackParamList>
>;

进入

export type HomeTabScreenProps<RouteName extends keyof HomeTabParamList> =
  BottomTabScreenProps<HomeTabParamList, RouteName>;

?

我知道您也可以仅用ContactsScreenProps作该屏幕的道具。只是想知道是否可以将其重新注入HomeTabScreenProps以获得统一的 API

标签: typescriptreact-nativereact-navigation

解决方案


推荐阅读