mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
chore: add documentation links in deprecation messages
This commit is contained in:
@@ -63,6 +63,15 @@ function BottomTabNavigator({
|
||||
],
|
||||
});
|
||||
|
||||
(
|
||||
Object.keys(defaultScreenOptions) as (keyof BottomTabNavigationOptions)[]
|
||||
).forEach((key) => {
|
||||
if (defaultScreenOptions[key] === undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete defaultScreenOptions[key];
|
||||
}
|
||||
});
|
||||
|
||||
warnOnce(
|
||||
tabBarOptions,
|
||||
`Bottom Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.\n\nPlace the following in 'screenOptions' in your code to keep current behavior:\n\n${JSON.stringify(
|
||||
@@ -78,7 +87,7 @@ function BottomTabNavigator({
|
||||
|
||||
warnOnce(
|
||||
true,
|
||||
`Bottom Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.`
|
||||
`Bottom Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/6.x/bottom-tab-navigator/#lazy for more details.`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ export default function useNavigationHelpers<
|
||||
);
|
||||
},
|
||||
getParent: () => parentNavigationHelpers as any,
|
||||
getState: getState,
|
||||
getState,
|
||||
} as NavigationHelpers<ParamListBase, EventMap> &
|
||||
(NavigationProp<ParamListBase, string, any, any, any> | undefined) &
|
||||
ActionHelpers;
|
||||
|
||||
@@ -55,6 +55,15 @@ function DrawerNavigator({
|
||||
gestureHandlerProps: drawerContentOptions.gestureHandlerProps,
|
||||
});
|
||||
|
||||
(
|
||||
Object.keys(defaultScreenOptions) as (keyof DrawerNavigationOptions)[]
|
||||
).forEach((key) => {
|
||||
if (defaultScreenOptions[key] === undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete defaultScreenOptions[key];
|
||||
}
|
||||
});
|
||||
|
||||
warnOnce(
|
||||
drawerContentOptions,
|
||||
`Drawer Navigator: 'drawerContentOptions' is deprecated. Migrate the options to 'screenOptions' instead.\n\nPlace the following in 'screenOptions' in your code to keep current behavior:\n\n${JSON.stringify(
|
||||
@@ -70,7 +79,7 @@ function DrawerNavigator({
|
||||
|
||||
warnOnce(
|
||||
true,
|
||||
`Drawer Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.`
|
||||
`Drawer Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/6.x/drawer-navigator/#lazy for more details.`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,17 @@ function MaterialTopTabNavigator({
|
||||
tabBarStyle: tabBarOptions.style,
|
||||
});
|
||||
|
||||
(
|
||||
Object.keys(
|
||||
defaultScreenOptions
|
||||
) as (keyof MaterialTopTabNavigationOptions)[]
|
||||
).forEach((key) => {
|
||||
if (defaultScreenOptions[key] === undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete defaultScreenOptions[key];
|
||||
}
|
||||
});
|
||||
|
||||
warnOnce(
|
||||
tabBarOptions,
|
||||
`Material Top Tab Navigator: 'tabBarOptions' is deprecated. Migrate the options to 'screenOptions' instead.\n\nPlace the following in 'screenOptions' in your code to keep current behavior:\n\n${JSON.stringify(
|
||||
@@ -74,7 +85,7 @@ function MaterialTopTabNavigator({
|
||||
|
||||
warnOnce(
|
||||
true,
|
||||
`Material Top Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.`
|
||||
`Material Top Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/6.x/material-top-tab-navigator#lazy for more details.`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,17 +45,17 @@ function StackNavigator({
|
||||
|
||||
warnOnce(
|
||||
mode != null,
|
||||
`Stack Navigator: 'mode="${mode}"' is deprecated. Use 'presentation: "${mode}"' in 'screenOptions' instead.`
|
||||
`Stack Navigator: 'mode="${mode}"' is deprecated. Use 'presentation: "${mode}"' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/6.x/stack-navigator#presentation for more details.`
|
||||
);
|
||||
|
||||
warnOnce(
|
||||
headerMode === 'none',
|
||||
`Stack Navigator: 'headerMode="none"' is deprecated. Use 'headerShown: false' in 'screenOptions' instead.`
|
||||
`Stack Navigator: 'headerMode="none"' is deprecated. Use 'headerShown: false' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/6.x/stack-navigator/#headershown for more details.`
|
||||
);
|
||||
|
||||
warnOnce(
|
||||
headerMode != null && headerMode !== 'none',
|
||||
`Stack Navigator: 'headerMode' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.`
|
||||
`Stack Navigator: 'headerMode' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/6.x/stack-navigator/#headermode for more details.`
|
||||
);
|
||||
|
||||
const { state, descriptors, navigation, NavigationContent } =
|
||||
|
||||
Reference in New Issue
Block a user