Skip to content

Commit e322ee8

Browse files
committed
Fix diffs in upgrading guide
1 parent 88dc8c1 commit e322ee8

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

versioned_docs/version-7.x/upgrading-from-6.x.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Due to these issues, we have a special API to navigate to a nested screen (`navi
2727

2828
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:
2929

30-
```js
30+
```jsx
3131
<NavigationContainer navigationInChildEnabled>{/* ... */}</NavigationContainer>
3232
```
3333

@@ -39,7 +39,7 @@ Previously, `navigate` method navigated back if the screen already exists in the
3939

4040
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:
4141

42-
```diff
42+
```diff lang=js
4343
- navigation.navigate('PreviousScreen', { foo: 42 });
4444
+ navigation.popTo('PreviousScreen', { foo: 42 });
4545
```
@@ -53,7 +53,7 @@ To achieve a behavior similar to before with `navigate`, you can use the [`getId
5353

5454
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:
5555

56-
```diff
56+
```diff lang=js
5757
- navigation.navigate('SomeScreen');
5858
+ navigation.navigateDeprecated('SomeScreen');
5959
```
@@ -103,15 +103,15 @@ However, there are issues with this approach:
103103

104104
So we've removed this prop instead of a `NavigationIndependentTree` component which you can use to wrap the navigation container:
105105
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>
115115
```
116116
117117
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
120120

121121
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.
122122
123-
```diff
123+
```diff lang=js
124124
import { DefaultTheme } from '@react-navigation/native';
125125
126126
const theme = {
127127
colors: {
128128
// ...
129129
},
130-
+ fonts: DefaultTheme.fonts,
130+
+ fonts: DefaultTheme.fonts,
131131
};
132132
```
133133
@@ -142,16 +142,16 @@ Previously, the `Link` component and `useLinkProps` hook were designed to work w
142142

143143
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:
144144

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>
148148
```
149149

150150
or
151151

152-
```diff
153-
-const props = useLinkProps({ to: '/details?foo=42' });
154-
+const props = useLinkProps({ screen: 'Details', params: { foo: 42 } });
152+
```diff lang=js
153+
- const props = useLinkProps({ to: '/details?foo=42' });
154+
+ const props = useLinkProps({ screen: 'Details', params: { foo: 42 } });
155155
```
156156

157157
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
262262
263263
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:
264264
265-
```diff
265+
```diff lang=js
266266
- import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
267267
+ import { createMaterialBottomTabNavigator } from 'react-native-paper/react-navigation';
268268
```

0 commit comments

Comments
 (0)