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/web-support.md
+16-8Lines changed: 16 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,17 @@ While Web support works out of the box, there are some things to configure to en
17
17
18
18
Configuring linking allows React Navigation to integrate with the browser's URL bar. This is crucial for web apps to have proper URLs for each screen.
19
19
20
-
2.[**Use Button or Link components**](link.md)
20
+
2.**Use Button or Link components**
21
21
22
-
You may be familiar with using `navigation.navigate` to navigate between screens. But it's important to avoid using it when supporting the web. Instead, use the `Link` or [`Button`](elements.md#button) components to navigate between screens. This ensures that an anchor tag is rendered which provides the expected behavior on the web.
22
+
You may be familiar with using `navigation.navigate` to navigate between screens. But it's important to avoid using it when supporting the web. Instead, use the [`Link`](link.md) or [`Button`](elements.md#button) components (or your own with [`useLinkProps`](use-link-props.md)) to navigate between screens.
23
+
24
+
This ensures that an anchor tag is rendered which provides the expected behavior on the web.
23
25
24
26
3.[**Server rendering**](server-rendering.md)
25
27
26
-
Currently, React Navigation works best with fully client-side rendered apps. However, minimal server-side rendering support is available. So you can optionally choose to server render your app.
28
+
Currently, React Navigation works best with fully client-side rendered apps.
29
+
30
+
Limited server-side rendering support is available. So you can optionally choose to server render your app - however it requires using [React's server rendering APIs](https://react.dev/reference/react-dom/server) on your server directly, so it's not straightforward.
27
31
28
32
4.**Adapt to web-specific behavior**
29
33
@@ -106,19 +110,23 @@ Some of the navigators have different behavior on the web compared to native pla
Native Stack Navigator uses the platform's primitives to handle animations and gestures on native platforms. However, animations and gestures are not supported on the web.
113
+
Native Stack Navigator uses the platform's primitives to handle animations and gestures on native platforms.
114
+
115
+
On the Web, animations and gestures are not supported.
110
116
111
117
2.[**Stack Navigator**](stack-navigator.md)
112
118
113
-
Stack Navigator uses [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) to handle swipe gestures on native platforms. However, gestures are not supported on the web.
119
+
Stack Navigator uses [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) to handle swipe gestures on native platforms.
114
120
115
-
In addition, screen transitions are disabled by default on the web. You can enable them by setting `animationEnabled: true` in the navigator's options.
121
+
Screen transition animations are disabled by default on the web. You can enable them by using the [`animation`](stack-navigator.md#animations) option. Gestures are not supported on the web.
116
122
117
123
3.[**Drawer Navigator**](drawer-navigator.md)
118
124
119
-
Drawer Navigator uses [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) to handle swipe gestures and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) for animations on native platforms. However, gestures are not supported on the web, and animations are handled using CSS transitions.
125
+
Drawer Navigator uses [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) to handle swipe gestures and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) for animations on native platforms.
126
+
127
+
On the Web, the animations are handled using CSS transitions instead, and gestures are not supported.
120
128
121
-
In addition, navigators render hyperlinks on the web when possible, such as in the drawer sidebar, tab bar, stack navigator's back button, etc.
129
+
In addition, navigators render hyperlinks on the web when possible, such as in the drawer sidebar, tab bar, stack navigator's back button, etc. to provide the expected behavior on the web.
122
130
123
131
Since `react-native-gesture-handler` and `react-native-reanimated` are not used on the web, avoid importing them in your own code to reduce the bundle size unless you need them for your components. You can use `.native.js` or `.native.ts` extensions for code specific to native platforms.
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/web-support.md
+18-8Lines changed: 18 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,19 @@ While Web support works out of the box, there are some things to configure to en
17
17
18
18
Configuring linking allows React Navigation to integrate with the browser's URL bar. This is crucial for web apps to have proper URLs for each screen.
19
19
20
-
2.[**Use Button or Link components**](link.md)
20
+
Automatic links are already enabled by default when using [Static configuration](static-configuration.md). So if you're using static configuration, you don't need to do anything to enable linking.
21
21
22
-
You may be familiar with using `navigation.navigate` to navigate between screens. But it's important to avoid using it when supporting the web. Instead, use the `Link` or [`Button`](elements.md#button) components to navigate between screens. This ensures that an anchor tag is rendered which provides the expected behavior on the web.
22
+
2.**Use Button or Link components**
23
+
24
+
You may be familiar with using `navigation.navigate` to navigate between screens. But it's important to avoid using it when supporting the web. Instead, use the [`Link`](link.md) or [`Button`](elements.md#button) components (or your own with [`useLinkProps`](use-link-props.md)) to navigate between screens.
25
+
26
+
This ensures that an anchor tag is rendered which provides the expected behavior on the web.
23
27
24
28
3.[**Server rendering**](server-rendering.md)
25
29
26
-
Currently, React Navigation works best with fully client-side rendered apps. However, minimal server-side rendering support is available. So you can optionally choose to server render your app.
30
+
Currently, React Navigation works best with fully client-side rendered apps.
31
+
32
+
Limited server-side rendering support is available. So you can optionally choose to server render your app - however it requires using [React's server rendering APIs](https://react.dev/reference/react-dom/server) on your server directly, so it's not straightforward.
27
33
28
34
4.**Adapt to web-specific behavior**
29
35
@@ -106,19 +112,23 @@ Some of the navigators have different behavior on the web compared to native pla
Native Stack Navigator uses the platform's primitives to handle animations and gestures on native platforms. However, animations and gestures are not supported on the web.
115
+
Native Stack Navigator uses the platform's primitives to handle animations and gestures on native platforms.
116
+
117
+
On the Web, animations and gestures are not supported.
110
118
111
119
2.[**Stack Navigator**](stack-navigator.md)
112
120
113
-
Stack Navigator uses [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) to handle swipe gestures on native platforms. However, gestures are not supported on the web.
121
+
Stack Navigator uses [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) to handle swipe gestures on native platforms.
114
122
115
-
In addition, screen transitions are disabled by default on the web. You can enable them by setting `animationEnabled: true` in the navigator's options.
123
+
Screen transition animations are disabled by default on the web. You can enable them by using the [`animation`](stack-navigator.md#animations) option. Gestures are not supported on the web.
116
124
117
125
3.[**Drawer Navigator**](drawer-navigator.md)
118
126
119
-
Drawer Navigator uses [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) to handle swipe gestures and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) for animations on native platforms. However, gestures are not supported on the web, and animations are handled using CSS transitions.
127
+
Drawer Navigator uses [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) to handle swipe gestures and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) for animations on native platforms.
128
+
129
+
On the Web, the animations are handled using CSS transitions instead, and gestures are not supported.
120
130
121
-
In addition, navigators render hyperlinks on the web when possible, such as in the drawer sidebar, tab bar, stack navigator's back button, etc.
131
+
In addition, navigators render hyperlinks on the web when possible, such as in the drawer sidebar, tab bar, stack navigator's back button, etc. to provide the expected behavior on the web.
122
132
123
133
Since `react-native-gesture-handler` and `react-native-reanimated` are not used on the web, avoid importing them in your own code to reduce the bundle size unless you need them for your components. You can use `.native.js` or `.native.ts` extensions for code specific to native platforms.
0 commit comments