Skip to content

Commit fcb5e31

Browse files
committed
Fixes to examples
1 parent d10eea6 commit fcb5e31

12 files changed

+39
-40
lines changed

versioned_docs/version-7.x/auth-flow.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ We want the following behavior from our authentication flow:
3333
We can configure different screens to be available based on some condition. For example, if the user is signed in, we can define `Home`, `Profile`, `Settings` etc. If the user is not signed in, we can define `SignIn` and `SignUp` screens.
3434

3535
<Tabs groupId="config" queryString="config">
36-
<TabItem value="static" label="Static">
36+
<TabItem value="static" label="Static" default>
3737

3838
To do this, we need a couple of things:
3939

@@ -449,9 +449,9 @@ In our component, we will:
449449

450450
So our component will look like this:
451451
<Tabs groupId="config" queryString="config">
452-
<TabItem value="static" label="Static">
452+
<TabItem value="static" label="Static" default>
453453

454-
```js name="Signing in and signing out with AuthContext" snack version=7
454+
```js name="Signing in and signing out with AuthContext" snack version=7 dependencies=expo-secure-store
455455
// codeblock-focus-start
456456
import * as React from 'react';
457457
import * as SecureStore from 'expo-secure-store';
@@ -625,7 +625,6 @@ const RootStack = createNativeStackNavigator({
625625
screen: SignInScreen,
626626
options: {
627627
title: 'Sign in',
628-
animationTypeForReplace: state.isSignout ? 'pop' : 'push',
629628
},
630629
if: useIsSignedOut,
631630
},
@@ -639,7 +638,7 @@ const Navigation = createStaticNavigation(RootStack);
639638
</TabItem>
640639
<TabItem value="dynamic" label="Dynamic">
641640

642-
```js name="Signing in and signing out with AuthContext" snack version=7
641+
```js name="Signing in and signing out with AuthContext" snack version=7 dependencies=expo-secure-store
643642
// codeblock-focus-start
644643
import * as React from 'react';
645644
import * as SecureStore from 'expo-secure-store';
@@ -843,7 +842,7 @@ You can similarly fill in the other screens according to your requirements.
843842
Consider the following example:
844843

845844
<Tabs groupId="config" queryString="config">
846-
<TabItem value="static" label="Static">
845+
<TabItem value="static" label="Static" default>
847846

848847
```js
849848
const RootStack = createNativeStackNavigator({
@@ -898,7 +897,7 @@ This can be a problem, we probably want the user to be taken to the `SignIn` scr
898897
So our updated code will look like following:
899898

900899
<Tabs groupId="config" queryString="config">
901-
<TabItem value="static" label="Static">
900+
<TabItem value="static" label="Static" default>
902901

903902
```js
904903
const RootStack = createNativeStackNavigator({
@@ -957,7 +956,7 @@ const RootStack = createNativeStackNavigator({
957956
If you have a bunch of shared screens, you can also use [`navigationKey` with a `Group`](group.md#navigationkey) to remove all of the screens in the group. For example:
958957

959958
<Tabs groupId="config" queryString="config">
960-
<TabItem value="static" label="Static">
959+
<TabItem value="static" label="Static" default>
961960

962961
```js
963962
const RootStack = createNativeStackNavigator({

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default function App() {
120120

121121
To open and close drawer, use the following helpers:
122122
<Tabs groupId="config" queryString="config">
123-
<TabItem value="static" label="Static">
123+
<TabItem value="static" label="Static" default>
124124

125125
```js name="Drawer open and close" snack version=7
126126
import * as React from 'react';
@@ -432,7 +432,7 @@ export default function App() {
432432
Each of these functions, behind the scenes, are simply dispatching actions:
433433

434434
<Tabs groupId="config" queryString="config">
435-
<TabItem value="static" label="Static">
435+
<TabItem value="static" label="Static" default>
436436

437437
```js name="Navigation dispatcher" snack version=7
438438
import * as React from 'react';

versioned_docs/version-7.x/elements.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ For example, you can use this with `headerTransparent` to render a blur view to
164164
<Tabs groupId="config" queryString="config">
165165
<TabItem value="static" label="Static" default>
166166

167-
```js name="Header blur" snack version=7 dependencies=expo-blur@~12.9.1
167+
```js name="Header blur" snack version=7 dependencies=expo-blur
168168
import * as React from 'react';
169169
import { Button, View, StyleSheet } from 'react-native';
170170
import {
@@ -231,7 +231,7 @@ export default App;
231231
</TabItem>
232232
<TabItem value="dynamic" label="Dynamic">
233233

234-
```js name="Header blur" snack version=7 dependencies=expo-blur@~12.9.1
234+
```js name="Header blur" snack version=7 dependencies=expo-blur
235235
import * as React from 'react';
236236
import { Button, View, StyleSheet } from 'react-native';
237237
import { NavigationContainer } from '@react-navigation/native';

versioned_docs/version-7.x/group.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ After creating the navigator, it can be used as children of the `Navigator` comp
4040
<Tabs groupId="config" queryString="config">
4141
<TabItem value="static" label="Static" default>
4242

43-
```js name="Stack groups" snack version=7 dependencies=@react-navigation/elements
43+
```js name="Stack groups" snack version=7
4444
import * as React from 'react';
4545
import { View, Text } from 'react-native';
4646
import { Button } from '@react-navigation/elements';
@@ -105,7 +105,7 @@ export default function App() {
105105
</TabItem>
106106
<TabItem value="dynamic" label="Dynamic">
107107

108-
```js name="Stack groups" snack version=7 dependencies=@react-navigation/elements
108+
```js name="Stack groups" snack version=7
109109
import * as React from 'react';
110110
import { View, Text } from 'react-native';
111111
import { Button } from '@react-navigation/elements';

versioned_docs/version-7.x/handling-safe-area.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ To fix this you can, once again, apply safe area insets to your content. This wi
328328
In some cases you might need more control over which paddings are applied. For example, you can only apply the top and the bottom padding by changing the `style` object:
329329

330330
<Tabs groupId="config" queryString="config">
331-
<TabItem value="static" label="Static">
331+
<TabItem value="static" label="Static" default>
332332

333333
```js name="useSafeAreaInsets hook" snack version=7
334334
import * as React from 'react';

versioned_docs/version-7.x/navigating-without-navigation-prop.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function navigate(name, params) {
7979
Then, in any of your javascript modules, import the `RootNavigation` and call functions which you exported from it. You may use this approach outside of your React components and, in fact, it works as well when used from within them.
8080

8181
<Tabs groupId="config" queryString="config">
82-
<TabItem value="static" label="Static">
82+
<TabItem value="static" label="Static" default>
8383

8484
```js name="Using navigate in any js module" snack version=7
8585
import * as React from 'react';
@@ -237,7 +237,7 @@ For an example, consider the following scenario, you have a screen somewhere in
237237
To avoid this, you can use the `isReady()` method available on the ref as shown in the above examples.
238238

239239
<Tabs groupId="config" queryString="config">
240-
<TabItem value="static" label="Static">
240+
<TabItem value="static" label="Static" default>
241241

242242
```js name="Handling navigation init" snack version=7
243243
import * as React from 'react';

versioned_docs/version-7.x/navigation-container.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Example:
6767
<Tabs groupId="config" queryString="config">
6868
<TabItem value="static" label="Static" default>
6969

70-
```js name="Using refs" snack version=7 dependencies=@react-navigation/elements
70+
```js name="Using refs" snack version=7
7171
import * as React from 'react';
7272
import { View, Text } from 'react-native';
7373
import { Button } from '@react-navigation/elements';
@@ -115,7 +115,7 @@ export default function App() {
115115
</TabItem>
116116
<TabItem value="dynamic" label="Dynamic">
117117

118-
```js name="Using refs" snack version=7 dependencies=@react-navigation/elements
118+
```js name="Using refs" snack version=7
119119
import * as React from 'react';
120120
import { View, Text } from 'react-native';
121121
import { Button } from '@react-navigation/elements';

versioned_docs/version-7.x/navigation-context.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Example:
1616
<Tabs groupId="config" queryString="config">
1717
<TabItem value="static" label="Static" default>
1818

19-
```js name="Navigation context" snack version=7 dependencies=@react-navigation/elements
19+
```js name="Navigation context" snack version=7
2020
import * as React from 'react';
2121
import { View, Text } from 'react-native';
2222
import { Button } from '@react-navigation/elements';
@@ -80,7 +80,7 @@ export default App;
8080
</TabItem>
8181
<TabItem value="dynamic" label="Dynamic">
8282

83-
```js name="Navigation context" snack version=7 dependencies=@react-navigation/elements
83+
```js name="Navigation context" snack version=7
8484
import * as React from 'react';
8585
import { View, Text } from 'react-native';
8686
import { Button } from '@react-navigation/elements';

versioned_docs/version-7.x/navigation-object.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The `navigate` method lets us navigate to another screen in your app. It takes t
7575
<Tabs groupId="config" queryString="config">
7676
<TabItem value="static" label="Static" default>
7777

78-
```js name="Navigate method" snack version=7 dependencies=@react-navigation/elements
78+
```js name="Navigate method" snack version=7
7979
import * as React from 'react';
8080
import { View, Text } from 'react-native';
8181
import { Button } from '@react-navigation/elements';
@@ -143,7 +143,7 @@ export default App;
143143
</TabItem>
144144
<TabItem value="dynamic" label="Dynamic">
145145
146-
```js name="Navigate method" snack version=7 dependencies=@react-navigation/elements
146+
```js name="Navigate method" snack version=7
147147
import * as React from 'react';
148148
import { View, Text } from 'react-native';
149149
import { Button } from '@react-navigation/elements';
@@ -249,7 +249,7 @@ By default, `goBack` will go back from the screen that it is called from:
249249
<Tabs groupId="config" queryString="config">
250250
<TabItem value="static" label="Static" default>
251251

252-
```js name="Navigate method" snack version=7 dependencies=@react-navigation/elements
252+
```js name="Navigate method" snack version=7
253253
import * as React from 'react';
254254
import { View, Text } from 'react-native';
255255
import { Button } from '@react-navigation/elements';
@@ -316,7 +316,7 @@ export default App;
316316
</TabItem>
317317
<TabItem value="dynamic" label="Dynamic">
318318
319-
```js name="Navigate method" snack version=7 dependencies=@react-navigation/elements
319+
```js name="Navigate method" snack version=7
320320
import * as React from 'react';
321321
import { View, Text } from 'react-native';
322322
import { Button } from '@react-navigation/elements';
@@ -380,7 +380,7 @@ The `reset` method lets us replace the navigator state with a new state:
380380
<Tabs groupId="config" queryString="config">
381381
<TabItem value="static" label="Static" default>
382382

383-
```js name="Navigate - replace and reset" snack version=7 dependencies=@react-navigation/elements
383+
```js name="Navigate - replace and reset" snack version=7
384384
import * as React from 'react';
385385
import { Button } from '@react-navigation/elements';
386386
import { View, Text } from 'react-native';
@@ -498,7 +498,7 @@ export default App;
498498
</TabItem>
499499
<TabItem value="dynamic" label="Dynamic">
500500

501-
```js name="Navigate - replace and reset" snack version=7 dependencies=@react-navigation/elements
501+
```js name="Navigate - replace and reset" snack version=7
502502
import * as React from 'react';
503503
import { Button } from '@react-navigation/elements';
504504
import { View, Text } from 'react-native';
@@ -620,7 +620,7 @@ The `setParams` method lets us update the params (`route.params`) of the current
620620
<Tabs groupId="config" queryString="config">
621621
<TabItem value="static" label="Static" default>
622622

623-
```js name="Navigate - setParams" snack version=7 dependencies=@react-navigation/elements
623+
```js name="Navigate - setParams" snack version=7
624624
import * as React from 'react';
625625
import { Button } from '@react-navigation/elements';
626626
import { View, Text } from 'react-native';
@@ -708,7 +708,7 @@ export default App;
708708
</TabItem>
709709
<TabItem value="dynamic" label="Dynamic">
710710

711-
```js name="Navigate - setParams" snack version=7 dependencies=@react-navigation/elements
711+
```js name="Navigate - setParams" snack version=7
712712
import * as React from 'react';
713713
import { Button } from '@react-navigation/elements';
714714
import { View, Text } from 'react-native';
@@ -796,7 +796,7 @@ The `setOptions` method lets us set screen options from within the component. Th
796796
<Tabs groupId="config" queryString="config">
797797
<TabItem value="static" label="Static" default>
798798

799-
```js name="Navigate - setOptions" snack version=7 dependencies=@react-navigation/elements
799+
```js name="Navigate - setOptions" snack version=7
800800
import * as React from 'react';
801801
import { View, Text, TextInput } from 'react-native';
802802
import { Button } from '@react-navigation/elements';
@@ -872,7 +872,7 @@ export default App;
872872
</TabItem>
873873
<TabItem value="dynamic" label="Dynamic">
874874

875-
```js name="Navigate - setOptions" snack version=7 dependencies=@react-navigation/elements
875+
```js name="Navigate - setOptions" snack version=7
876876
import * as React from 'react';
877877
import { View, Text, TextInput } from 'react-native';
878878
import { Button } from '@react-navigation/elements';
@@ -957,7 +957,7 @@ Screens can add listeners on the `navigation` object with the `addListener` meth
957957
<Tabs groupId="config" queryString="config">
958958
<TabItem value="static" label="Static" default>
959959

960-
```js name="Navigation events" snack version=7 dependencies=@react-navigation/elements
960+
```js name="Navigation events" snack version=7
961961
import * as React from 'react';
962962
import { View, Text } from 'react-native';
963963
import { Button } from '@react-navigation/elements';
@@ -1022,7 +1022,7 @@ export default function App() {
10221022
</TabItem>
10231023
<TabItem value="dynamic" label="Dynamic">
10241024

1025-
```js name="Navigation events" snack version=7 dependencies=@react-navigation/elements
1025+
```js name="Navigation events" snack version=7
10261026
import * as React from 'react';
10271027
import { View, Text } from 'react-native';
10281028
import { Button } from '@react-navigation/elements';

versioned_docs/version-7.x/screen-options.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can pass a prop named `options` to the `Screen` component to configure a scr
2020
<Tabs groupId="config" queryString="config">
2121
<TabItem value="static" label="Static" default>
2222

23-
```js name="Screen title option" snack version=7 dependencies=@react-navigation/elements
23+
```js name="Screen title option" snack version=7
2424
import * as React from 'react';
2525
import { View, Text } from 'react-native';
2626
import Button from '@react-navigation/elements';
@@ -83,7 +83,7 @@ export default function App() {
8383
</TabItem>
8484
<TabItem value="dynamic" label="Dynamic">
8585

86-
```js name="Screen title option" snack version=7 dependencies=@react-navigation/elements
86+
```js name="Screen title option" snack version=7
8787
import * as React from 'react';
8888
import { View, Text } from 'react-native';
8989
import Button from '@react-navigation/elements';
@@ -186,7 +186,7 @@ Example:
186186
<Tabs groupId="config" queryString="config">
187187
<TabItem value="static" label="Static" default>
188188

189-
```js name="Screen options for group" snack version=7 dependencies=@react-navigation/elements
189+
```js name="Screen options for group" snack version=7
190190
import * as React from 'react';
191191
import { View, Text } from 'react-native';
192192
import { Button } from '@react-navigation/elements';
@@ -248,7 +248,7 @@ export default function App() {
248248
</TabItem>
249249
<TabItem value="dynamic" label="Dynamic">
250250

251-
```js name="Screen options for group" snack version=7 dependencies=@react-navigation/elements
251+
```js name="Screen options for group" snack version=7
252252
import * as React from 'react';
253253
import { View, Text } from 'react-native';
254254
import { Button } from '@react-navigation/elements';

versioned_docs/version-7.x/testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ We recommend using [React Native Testing Library](https://callstack.github.io/re
6363
Example:
6464

6565
<Tabs groupId="config" queryString="config">
66-
<TabItem value="static" label="Static">
66+
<TabItem value="static" label="Static" default>
6767

6868
```js name='Testing with jest'
6969
import * as React from 'react';

versioned_docs/version-7.x/themes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ import { DefaultTheme, DarkTheme } from '@react-navigation/native';
329329
On iOS 13+ and Android 10+, you can get user's preferred color scheme (`'dark'` or `'light'`) with the ([Appearance API](https://reactnative.dev/docs/appearance)).
330330

331331
<Tabs groupId="config" queryString="config">
332-
<TabItem value="static" label="Static">
332+
<TabItem value="static" label="Static" default>
333333

334334
```js name="Operating system color theme" snack version=7
335335
import * as React from 'react';
@@ -554,7 +554,7 @@ export default function App() {
554554
To gain access to the theme in any component that is rendered inside the navigation container:, you can use the `useTheme` hook. It returns the theme object:
555555

556556
<Tabs groupId="config" queryString="config">
557-
<TabItem value="static" label="Static">
557+
<TabItem value="static" label="Static" default>
558558

559559
```js name="System themes" snack version=7
560560
import * as React from 'react';

0 commit comments

Comments
 (0)