mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-28 12:25:21 +08:00
fix: throw when wrapping a compat navigatofor compat
This commit is contained in:
@@ -19,7 +19,14 @@ export default function createCompatNavigatorFactory<
|
||||
React.ComponentType<any>
|
||||
>
|
||||
>(createNavigator: CreateNavigator) {
|
||||
return <
|
||||
// @ts-ignore
|
||||
if (createNavigator.isCompat) {
|
||||
throw new Error(
|
||||
`The navigator is already in compat mode. You don't need to wrap it in 'createCompatNavigatorFactory'.`
|
||||
);
|
||||
}
|
||||
|
||||
const createCompatNavigator = <
|
||||
NavigationPropType extends NavigationProp<any, any, any, any, any>,
|
||||
ParamList extends ParamListBase = NavigationPropType extends NavigationProp<
|
||||
infer P
|
||||
@@ -157,4 +164,8 @@ export default function createCompatNavigatorFactory<
|
||||
|
||||
return Navigator;
|
||||
};
|
||||
|
||||
createCompatNavigator.isCompat = true;
|
||||
|
||||
return createCompatNavigator;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user