You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/upgrading-from-6.x.md
+21-21Lines changed: 21 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ Due to these issues, we have a special API to navigate to a nested screen (`navi
27
27
28
28
From these release, this is no longer the default behavior. If you're relying on this behavior in your app, you can pass the `navigationInChildEnabled` prop to `NavigationContainer` to keep the behavior until you are able to migrate:
@@ -39,7 +39,7 @@ Previously, `navigate` method navigated back if the screen already exists in the
39
39
40
40
To avoid this confusion, we have removed the going back behavior from `navigate` and added a [new method `popTo`](stack-actions.md#popto) to explicitly go back to a specific screen in the stack:
@@ -53,7 +53,7 @@ To achieve a behavior similar to before with `navigate`, you can use the [`getId
53
53
54
54
To help with the migration, we have added a new method called `navigateDeprecated` which will behave like the old `navigate` method. You can replace your current `navigate` calls with `navigateDeprecated` to gradually migrate to the new behavior:
55
55
56
-
```diff
56
+
```diff lang=js
57
57
- navigation.navigate('SomeScreen');
58
58
+ navigation.navigateDeprecated('SomeScreen');
59
59
```
@@ -103,15 +103,15 @@ However, there are issues with this approach:
103
103
104
104
So we've removed this prop instead of a `NavigationIndependentTree` component which you can use to wrap the navigation container:
105
105
106
-
```diff
107
-
-<NavigationContainer independent>
108
-
- {/* ... */}
109
-
-</NavigationContainer>
110
-
+<NavigationIndependentTree>
111
-
+ <NavigationContainer>
112
-
+ {/* ... */}
113
-
+ </NavigationContainer>
114
-
+</NavigationIndependentTree>
106
+
```diff lang=jsx
107
+
-<NavigationContainer independent>
108
+
- {/* ... */}
109
+
-</NavigationContainer>
110
+
+<NavigationIndependentTree>
111
+
+ <NavigationContainer>
112
+
+ {/* ... */}
113
+
+ </NavigationContainer>
114
+
+</NavigationIndependentTree>
115
115
```
116
116
117
117
This way, the responsibility no longer lies on the miniapp developer, but on the parent app. It's also harder for beginners to accidentally add this.
@@ -120,14 +120,14 @@ This way, the responsibility no longer lies on the miniapp developer, but on the
120
120
121
121
Previously, the `theme` prop on `NavigationContainer` accepted a `colors` property to customize the colors used by various UI elements from React Navigation. We have now added a `fonts` property to customize the fonts as well. If you are passing a custom theme in the `theme` prop, you'll need to update it to include the `fonts` property.
122
122
123
-
```diff
123
+
```diff lang=js
124
124
import { DefaultTheme } from '@react-navigation/native';
125
125
126
126
const theme = {
127
127
colors: {
128
128
// ...
129
129
},
130
-
+ fonts: DefaultTheme.fonts,
130
+
+ fonts: DefaultTheme.fonts,
131
131
};
132
132
```
133
133
@@ -142,16 +142,16 @@ Previously, the `Link` component and `useLinkProps` hook were designed to work w
142
142
143
143
Now, instead of the `to` prop that took a path string, they now accept `screen` and `params` props, as well as an optional `href` prop to use instead of the generated path:
144
144
145
-
```diff
146
-
-<Link to="/details?foo=42">Go to Details</Link>
147
-
+<Link screen="Details" params={{ foo: 42 }}>Go to Details</Link>
145
+
```diff lang=jsx
146
+
-<Link to="/details?foo=42">Go to Details</Link>
147
+
+<Link screen="Details" params={{ foo: 42 }}>Go to Details</Link>
148
148
```
149
149
150
150
or
151
151
152
-
```diff
153
-
-const props = useLinkProps({ to: '/details?foo=42' });
With this change, you'd now have full type-safety when using the `Link` component given that you have [configured the global type](typescript.md#specifying-default-types-for-usenavigation-link-ref-etc).
@@ -262,7 +262,7 @@ The `@react-navigation/material-bottom-tabs` package provided React Navigation i
262
262
263
263
If you are using `@react-navigation/material-bottom-tabs` in your project, you can remove it from your dependencies and change the imports to `react-native-paper/react-navigation` instead:
264
264
265
-
```diff
265
+
```diff lang=js
266
266
- import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
267
267
+ import { createMaterialBottomTabNavigator } from 'react-native-paper/react-navigation';
0 commit comments