Skip to content

Commit

Permalink
Fixes to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Feb 28, 2024
1 parent f78c2e9 commit a2a5d9e
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 40 deletions.
15 changes: 7 additions & 8 deletions versioned_docs/version-7.x/auth-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ We want the following behavior from our authentication flow:
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.

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

To do this, we need a couple of things:

Expand Down Expand Up @@ -449,9 +449,9 @@ In our component, we will:

So our component will look like this:
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

```js name="Signing in and signing out with AuthContext" snack version=7
```js name="Signing in and signing out with AuthContext" snack version=7 dependencies=expo-secure-store
// codeblock-focus-start
import * as React from 'react';
import * as SecureStore from 'expo-secure-store';
Expand Down Expand Up @@ -625,7 +625,6 @@ const RootStack = createNativeStackNavigator({
screen: SignInScreen,
options: {
title: 'Sign in',
animationTypeForReplace: state.isSignout ? 'pop' : 'push',
},
if: useIsSignedOut,
},
Expand All @@ -639,7 +638,7 @@ const Navigation = createStaticNavigation(RootStack);
</TabItem>
<TabItem value="dynamic" label="Dynamic">

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

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

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

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

```js
const RootStack = createNativeStackNavigator({
Expand Down Expand Up @@ -957,7 +956,7 @@ const RootStack = createNativeStackNavigator({
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:

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

```js
const RootStack = createNativeStackNavigator({
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-7.x/drawer-based-navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default function App() {

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

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

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

```js name="Navigation dispatcher" snack version=7
import * as React from 'react';
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-7.x/elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ For example, you can use this with `headerTransparent` to render a blur view to
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static" default>

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

```js name="Header blur" snack version=7 dependencies=expo-blur@~12.9.1
```js name="Header blur" snack version=7 dependencies=expo-blur
import * as React from 'react';
import { Button, View, StyleSheet } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-7.x/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ After creating the navigator, it can be used as children of the `Navigator` comp
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static" default>

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

```js name="Stack groups" snack version=7 dependencies=@react-navigation/elements
```js name="Stack groups" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-7.x/handling-safe-area.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ To fix this you can, once again, apply safe area insets to your content. This wi
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:

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

```js name="useSafeAreaInsets hook" snack version=7
import * as React from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function navigate(name, params) {
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.

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

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

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

```js name="Handling navigation init" snack version=7
import * as React from 'react';
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-7.x/navigation-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Example:
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static" default>

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

```js name="Using refs" snack version=7 dependencies=@react-navigation/elements
```js name="Using refs" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-7.x/navigation-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Example:
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static" default>

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

```js name="Navigation context" snack version=7 dependencies=@react-navigation/elements
```js name="Navigation context" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down
24 changes: 12 additions & 12 deletions versioned_docs/version-7.x/navigation-object.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The `navigate` method lets us navigate to another screen in your app. It takes t
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static" default>

```js name="Navigate method" snack version=7 dependencies=@react-navigation/elements
```js name="Navigate method" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down Expand Up @@ -143,7 +143,7 @@ export default App;
</TabItem>
<TabItem value="dynamic" label="Dynamic">
```js name="Navigate method" snack version=7 dependencies=@react-navigation/elements
```js name="Navigate method" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down Expand Up @@ -249,7 +249,7 @@ By default, `goBack` will go back from the screen that it is called from:
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static" default>

```js name="Navigate method" snack version=7 dependencies=@react-navigation/elements
```js name="Navigate method" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down Expand Up @@ -316,7 +316,7 @@ export default App;
</TabItem>
<TabItem value="dynamic" label="Dynamic">
```js name="Navigate method" snack version=7 dependencies=@react-navigation/elements
```js name="Navigate method" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down Expand Up @@ -380,7 +380,7 @@ The `reset` method lets us replace the navigator state with a new state:
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static" default>

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

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

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

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

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

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

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

```js name="Navigation events" snack version=7 dependencies=@react-navigation/elements
```js name="Navigation events" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down
8 changes: 4 additions & 4 deletions versioned_docs/version-7.x/screen-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You can pass a prop named `options` to the `Screen` component to configure a scr
<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static" default>

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

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

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

```js name="Screen options for group" snack version=7 dependencies=@react-navigation/elements
```js name="Screen options for group" snack version=7
import * as React from 'react';
import { View, Text } from 'react-native';
import { Button } from '@react-navigation/elements';
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-7.x/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ We recommend using [React Native Testing Library](https://callstack.github.io/re
Example:

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

```js name='Testing with jest'
import * as React from 'react';
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-7.x/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ import { DefaultTheme, DarkTheme } from '@react-navigation/native';
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)).

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

```js name="Operating system color theme" snack version=7
import * as React from 'react';
Expand Down Expand Up @@ -554,7 +554,7 @@ export default function App() {
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:

<Tabs groupId="config" queryString="config">
<TabItem value="static" label="Static">
<TabItem value="static" label="Static" default>

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

0 comments on commit a2a5d9e

Please sign in to comment.