Skip to content

Commit 471350b

Browse files
committed
Fix videos in 7.x docs
1 parent ea353f0 commit 471350b

File tree

7 files changed

+53
-26
lines changed

7 files changed

+53
-26
lines changed

versioned_docs/version-7.x/drawer-based-navigation.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import TabItem from '@theme/TabItem';
99

1010
Common pattern in navigation is to use drawer from left (sometimes right) side for navigating between screens.
1111

12+
<div style={{ display: 'flex', margin: '16px 0' }}>
13+
<video playsInline autoPlay muted loop style={{ maxWidth: '280px' }}>
14+
<source src="/assets/navigators/drawer/drawer.mp4" />
15+
</video>
16+
</div>
17+
1218
Before continuing, first install and configure [`@react-navigation/drawer`](https://github.com/react-navigation/react-navigation/tree/main/packages/drawer) and its dependencies following the [installation instructions](drawer-navigator.md#installation).
1319

1420
## Minimal example of drawer-based navigation
@@ -111,11 +117,6 @@ export default function App() {
111117
}
112118
```
113119

114-
<div style={{ display: 'flex', margin: '16px 0' }}>
115-
<video playsInline autoPlay muted loop style={{ maxWidth: '280px' }}>
116-
<source src="/assets/navigators/drawer/drawer.mp4" />
117-
</video>
118-
</div>
119120
</TabItem>
120121
</Tabs>
121122

versioned_docs/version-7.x/header-buttons.md

+31-8
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,11 @@ export default function App() {
102102
}
103103
```
104104

105-
![Header button](/assets/headers/header-button.png)
106-
107-
When we define our button this way, the `this` variable in `options` is _not_ the `HomeScreen` instance, so you can't call `setState` or any instance methods on it. This is pretty important because it's extremely common to want the buttons in your header to interact with the screen that the header belongs to. So, we will look how to do this next.
108105
</TabItem>
109106
</Tabs>
110107

108+
![Header button](/assets/headers/header-button.png)
109+
111110
When we define our button this way, the `this` variable in `options` is _not_ the `HomeScreen` instance, so you can't call `setState` or any instance methods on it. This is pretty important because it's common to want the buttons in your header to interact with the screen that the header belongs to. So, we will look how to do this next.
112111

113112
:::tip
@@ -173,11 +172,6 @@ export default function App() {
173172
}
174173
```
175174

176-
<div style={{ display: 'flex', margin: '16px 0' }}>
177-
<video playsInline autoPlay muted loop style={{ maxWidth: '280px' }}>
178-
<source src="/assets/headers/header-update-screen.mov" />
179-
</video>
180-
</div>
181175
</TabItem>
182176
<TabItem value="dynamic" label="Dynamic">
183177

@@ -238,6 +232,12 @@ export default function App() {
238232
</TabItem>
239233
</Tabs>
240234

235+
<div style={{ display: 'flex', margin: '16px 0' }}>
236+
<video playsInline autoPlay muted loop style={{ maxWidth: '280px' }}>
237+
<source src="/assets/headers/header-update-screen.mov" />
238+
</video>
239+
</div>
240+
241241
Here we update the `headerRight` with a button with `onPress` handler that has access to the component's state and can update it.
242242

243243
## Customizing the back button
@@ -248,6 +248,26 @@ You can change the label behavior with `headerBackTitle` and style it with `head
248248

249249
To customize the back button image, you can use `headerBackImageSource` ([read more](native-stack-navigator.md#headerbackimagesource)).
250250

251+
<Tabs groupId="config" queryString="config">
252+
<TabItem value="static" label="Static" default>
253+
254+
```js
255+
const MyStack = createNativeStackNavigator({
256+
screens: {
257+
Home: {
258+
screen: HomeScreen,
259+
options: {
260+
headerBackTitle: 'Custom Back',
261+
headerBackTitleStyle: { fontSize: 30 },
262+
},
263+
},
264+
},
265+
});
266+
```
267+
268+
</TabItem>
269+
<TabItem value="dynamic" label="Dynamic">
270+
251271
```js
252272
<Stack.Navigator>
253273
<Stack.Screen name="Home" component={HomeScreen} />
@@ -262,6 +282,9 @@ To customize the back button image, you can use `headerBackImageSource` ([read m
262282
</Stack.Navigator>
263283
```
264284

285+
</TabItem>
286+
</Tabs>
287+
265288
![Header custom back](/assets/headers/header-back-custom.png)
266289

267290
## Overriding the back button

versioned_docs/version-7.x/headers.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,11 @@ export default function App() {
9898
}
9999
```
100100

101-
![Header title](/assets/headers/header-title.png)
102101
</TabItem>
103102
</Tabs>
104103

104+
![Header title](/assets/headers/header-title.png)
105+
105106
## Using params in the title
106107

107108
In order to use params in the title, we need to make `options` for the screen a function that returns a configuration object. If we make `options` a function then React Navigation will call it with an object containing `{ navigation, route }` - in this case, all we care about is `route`, which is the same object that is passed to your screen props as `route` prop. You may recall that we can get the params through `route.params`, and so we do this below to extract a param and use it as a title.

versioned_docs/version-7.x/modal.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,14 @@ function App() {
177177
export default App;
178178
```
179179

180+
</TabItem>
181+
</Tabs>
182+
180183
<div style={{ display: 'flex', margin: '16px 0' }}>
181184
<video playsInline autoPlay muted loop style={{ maxWidth: '280px' }}>
182185
<source src="/assets/modal/modal.mp4" />
183186
</video>
184187
</div>
185-
</TabItem>
186-
</Tabs>
187188

188189
Here, we are creating 2 groups of screens using the `RootStack.Group` component. The first group is for our regular screens, and the second group is for our modal screens. For the modal group, we have specified `presentation: 'modal'` in `screenOptions`. This will apply this option to all the screens inside the group. This option will change the animation for the screens to animate from bottom-to-top rather than right to left. The `presentation` option for stack navigator can be either `card` (default) or `modal`. The `modal` behavior slides the screen in from the bottom and allows the user to swipe down from the top to dismiss it on iOS.
189190

versioned_docs/version-7.x/multiple-drawers.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -388,13 +388,14 @@ export default function App() {
388388
}
389389
```
390390

391+
</TabItem>
392+
</Tabs>
393+
391394
<div style={{ display: 'flex', margin: '16px 0' }}>
392395
<video playsInline autoPlay muted loop style={{ maxWidth: '280px' }}>
393396
<source src="/assets/navigators/drawer/drawer-multiple.mp4" />
394397
</video>
395398
</div>
396-
</TabItem>
397-
</Tabs>
398399

399400
But there is one problem. When we call `navigation.openDrawer()` in our `HomeScreen`, it always opens the left drawer since it's the immediate parent of the screen.
400401

versioned_docs/version-7.x/navigating.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,6 @@ function HomeScreen() {
248248
);
249249
}
250250

251-
<div style={{ display: 'flex', margin: '16px 0' }}>
252-
<video playsInline autoPlay muted loop style={{ maxWidth: '280px' }}>
253-
<source src="/assets/navigators/stack/back-home.mov" />
254-
</video>
255-
</div>
256-
257-
> On Android, React Navigation hooks in to the hardware back button and fires the `goBack()` function for you when the user presses it, so it behaves as the user would expect.
258251
// codeblock-focus-start
259252
function DetailsScreen() {
260253
const navigation = useNavigation();
@@ -289,6 +282,12 @@ export default function App() {
289282
}
290283
```
291284

285+
<div style={{ display: 'flex', margin: '16px 0' }}>
286+
<video playsInline autoPlay muted loop style={{ maxWidth: '280px' }}>
287+
<source src="/assets/navigators/stack/back-home.mov" />
288+
</video>
289+
</div>
290+
292291
:::note
293292

294293
On Android, React Navigation hooks in to the hardware back button and fires the `goBack()` function for you when the user presses it, so it behaves as the user would expect.

versioned_docs/version-7.x/tab-based-navigation.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,11 @@ export default function App() {
9898
}
9999
```
100100

101-
![Tabs minimal](/assets/navigators/tabs/tabs-minimal.png)
102101
</TabItem>
103102
</Tabs>
104103

104+
![Tabs minimal](/assets/navigators/tabs/tabs-minimal.png)
105+
105106
## Customizing the appearance
106107

107108
This is similar to how you would customize a stack navigator &mdash; there are some properties that are set when you initialize the tab navigator and others that can be customized per-screen in `options`.

0 commit comments

Comments
 (0)