Skip to content

Commit 39e18a6

Browse files
committed
Update web support docs
1 parent f3b138d commit 39e18a6

File tree

2 files changed

+34
-16
lines changed

2 files changed

+34
-16
lines changed

versioned_docs/version-7.x/web-support.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ While Web support works out of the box, there are some things to configure to en
1717

1818
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.
1919

20-
2. [**Use Button or Link components**](link.md)
20+
2. **Use Button or Link components**
2121

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.
2325

2426
3. [**Server rendering**](server-rendering.md)
2527

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.
2731

2832
4. **Adapt to web-specific behavior**
2933

@@ -106,19 +110,23 @@ Some of the navigators have different behavior on the web compared to native pla
106110

107111
1. [**Native Stack Navigator**](stack-navigator.md)
108112

109-
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.
110116

111117
2. [**Stack Navigator**](stack-navigator.md)
112118

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.
114120

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.
116122

117123
3. [**Drawer Navigator**](drawer-navigator.md)
118124

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.
120128

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.
122130

123131
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.
124132

versioned_docs/version-8.x/web-support.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ While Web support works out of the box, there are some things to configure to en
1717

1818
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.
1919

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.
2121

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.
2327

2428
3. [**Server rendering**](server-rendering.md)
2529

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.
2733

2834
4. **Adapt to web-specific behavior**
2935

@@ -106,19 +112,23 @@ Some of the navigators have different behavior on the web compared to native pla
106112

107113
1. [**Native Stack Navigator**](stack-navigator.md)
108114

109-
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.
110118

111119
2. [**Stack Navigator**](stack-navigator.md)
112120

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.
114122

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.
116124

117125
3. [**Drawer Navigator**](drawer-navigator.md)
118126

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.
120130

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.
122132

123133
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.
124134

0 commit comments

Comments
 (0)