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
* Removed some typos from drawer-navigator.md
* fix: Removed some typos
fix: Removed some typos from `/versioned_docs/version-6.x/auth-flow.md`
* fix: changed options to option
* Move changes over to v7
---------
Co-authored-by: Mian Muhammad Sharjeel Safdar <66178522+SharjeelSafdar@users.noreply.github.com>
Copy file name to clipboardExpand all lines: versioned_docs/version-6.x/auth-flow.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Authentication flows
4
4
sidebar_label: Authentication flows
5
5
---
6
6
7
-
Most apps require that a user authenticate in some way to have access to data associated with a user or other private content. Typically the flow will look like this:
7
+
Most apps require that a user authenticates in some way to have access to data associated with a user or other private content. Typically the flow will look like this:
8
8
9
9
- The user opens the app.
10
10
- The app loads some authentication state from encrypted persistent storage (for example, [`SecureStore`](https://docs.expo.io/versions/latest/sdk/securestore/)).
@@ -15,7 +15,7 @@ Most apps require that a user authenticate in some way to have access to data as
15
15
16
16
## What we need
17
17
18
-
This is the behavior that we want from the authentication flow: when users sign in, we want to throw away the state of the authentication flow and unmount all of the screens related to authentication, and when we press the hardware back button we expect to not be able to go back to the authentication flow.
18
+
This is the behavior that we want from the authentication flow: when users sign in, we want to throw away the state of the authentication flow and unmount all of the screens related to authentication, and when we press the hardware back button, we expect to not be able to go back to the authentication flow.
19
19
20
20
## How it will work
21
21
@@ -101,7 +101,7 @@ The main thing to notice is that we're conditionally defining screens based on t
101
101
-`SignIn` screen is only defined if `userToken` is `null` (user is not signed in)
102
102
-`Home` screen is only defined if `userToken` is non-null (user is signed in)
103
103
104
-
Here, we're conditionally defining one screen for each case. But you could also define multiple screens. For example, you probably want to define password reset, signup, etc screens as well when the user isn't signed in. Similarly for the screens accessible after sign in, you probably have more than one screen. We can use `React.Fragment` to define multiple screens:
104
+
Here, we're conditionally defining one screen for each case. But you could also define multiple screens. For example, you probably want to define password reset, signup, etc screens as well when the user isn't signed in. Similarly, for the screens accessible after signing in, you probably have more than one screen. We can use `React.Fragment` to define multiple screens:
105
105
106
106
```js
107
107
state.userToken==null? (
@@ -118,7 +118,7 @@ state.userToken == null ? (
118
118
);
119
119
```
120
120
121
-
> If you have both your login-related screens and rest of the screens in Stack navigators, we recommend to use a single Stack navigator and place the conditional inside instead of using 2 different navigators. This makes it possible to have a proper transition animation during login/logout.
121
+
> If you have both your login-related screens and rest of the screens in two different Stack navigators, we recommend to use a single Stack navigator and place the conditional inside instead of using 2 different navigators. This makes it possible to have a proper transition animation during login/logout.
122
122
123
123
## Implement the logic for restoring the token
124
124
@@ -132,8 +132,8 @@ From the previous snippet, we can see that we need 3 state variables:
132
132
133
133
So we need to:
134
134
135
-
- Add some logic for restoring token, sign in and sign out
136
-
- Expose methods for sign in and sign out to other components
135
+
- Add some logic for restoring token, signing in and signing out
136
+
- Expose methods for signing in and signing out to other components
137
137
138
138
We'll use `React.useReducer` and `React.useContext` in this guide. But if you're using a state management library such as Redux or Mobx, you can use them for this functionality instead. In fact, in bigger apps, a global state management library is more suitable for storing authentication tokens. You can adapt the same approach to your state management library.
Copy file name to clipboardExpand all lines: versioned_docs/version-6.x/drawer-navigator.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -48,9 +48,9 @@ Then, you need to install and configure the libraries that are required by the d
48
48
49
49
3. If you're on a Mac and developing for iOS, you also need to install the pods (via [Cocoapods](https://cocoapods.org/)) to complete the linking.
50
50
51
-
```sh
52
-
npx pod-install ios
53
-
```
51
+
```sh
52
+
npx pod-install ios
53
+
```
54
54
55
55
## API Definition
56
56
@@ -85,7 +85,7 @@ Optional unique ID for the navigator. This can be used with [`navigation.getPare
85
85
86
86
#### `initialRouteName`
87
87
88
-
The name of the route to render on first load of the navigator.
88
+
The name of the route to render on the first load of the navigator.
89
89
90
90
#### `screenOptions`
91
91
@@ -107,7 +107,7 @@ It supports the following values:
107
107
108
108
The default status of the drawer - whether the drawer should stay `open` or `closed` by default.
109
109
110
-
When this is set to `open`, the drawer will be open from the initial render. It can be closed normally using gestures or programmatically. However, when going back, drawer will re-open if it was closed. This is essentially the opposite of the default behavior of the drawer where it starts `closed`, and back button closes an open drawer.
110
+
When this is set to `open`, the drawer will be open from the initial render. It can be closed normally using gestures or programmatically. However, when going back, the drawer will re-open if it was closed. This is essentially the opposite of the default behavior of the drawer where it starts `closed`, and the back button closes an open drawer.
111
111
112
112
#### `detachInactiveScreens`
113
113
@@ -117,7 +117,7 @@ Boolean used to indicate whether inactive screens should be detached from the vi
117
117
118
118
Whether to use the legacy implementation based on Reanimated 1. The new implementation based on Reanimated 2 will perform better, but you need additional configuration and need to use Hermes with Flipper to debug.
119
119
120
-
This defaults to `true` in following cases:
120
+
This defaults to `true` in the following cases:
121
121
122
122
- Reanimated 2 is not configured
123
123
- App is connected to Chrome debugger (Reanimated 2 cannot be used with Chrome debugger)
@@ -129,7 +129,7 @@ Otherwise, it defaults to `false`
129
129
130
130
Function that returns React element to render as the content of the drawer, for example, navigation items
131
131
132
-
The content component receives following props by default:
132
+
The content component receives the following props by default:
133
133
134
134
-`state` - The [navigation state](navigation-state.md) of the navigator.
135
135
-`navigation` - The navigation object for the navigator.
@@ -139,7 +139,7 @@ The content component receives following props by default:
139
139
140
140
The default component for the drawer is scrollable and only contains links for the routes in the RouteConfig. You can easily override the default component to add a header, footer, or other content to the drawer. The default content component is exported as `DrawerContent`. It renders a `DrawerItemList` component inside a `ScrollView`.
141
141
142
-
By default the drawer is scrollable and supports devices with notches. If you customize the content, you can use `DrawerContentScrollView` to handle this automatically:
142
+
By default, the drawer is scrollable and supports devices with notches. If you customize the content, you can use `DrawerContentScrollView` to handle this automatically:
143
143
144
144
```js
145
145
import {
@@ -241,7 +241,7 @@ The following [options](screen-options.md) can be used to configure the screens
241
241
242
242
#### `title`
243
243
244
-
Generic title that can be used as a fallback for `headerTitle` and `drawerLabel`.
244
+
A generic title that can be used as a fallback for `headerTitle` and `drawerLabel`.
245
245
246
246
#### `lazy`
247
247
@@ -314,7 +314,7 @@ Options are `left` or `right`. Defaults to `left` for LTR languages and `right`
314
314
315
315
Type of the drawer. It determines how the drawer looks and animates.
316
316
317
-
-`front`: Traditional drawer which covers the screen with a overlay behind it.
317
+
-`front`: Traditional drawer which covers the screen with an overlay behind it.
318
318
-`back`: The drawer is revealed behind the screen on swipe.
319
319
-`slide`: Both the screen and the drawer slide on swipe to reveal the drawer.
320
320
-`permanent`: A permanent drawer is shown as a sidebar. Useful for having always visible drawer on larger screens.
@@ -553,7 +553,7 @@ navigation.toggleDrawer();
553
553
554
554
#### `jumpTo`
555
555
556
-
Navigates to an existing screen in the drawer navigator. The method accepts following arguments:
556
+
Navigates to an existing screen in the drawer navigator. The method accepts the following arguments:
557
557
558
558
-`name` - _string_ - Name of the route to jump to.
559
559
-`params` - _object_ - Screen params to pass to the destination route.
@@ -643,4 +643,4 @@ class Profile extends React.Component {
643
643
644
644
## Nesting drawer navigators inside others
645
645
646
-
If a drawer navigator is nested inside of another navigator that provides some UI, for example a tab navigator or stack navigator, then the drawer will be rendered below the UI from those navigators. The drawer will appear below the tab bar and below the header of the stack. You will need to make the drawer navigator the parent of any navigator where the drawer should be rendered on top of its UI.
646
+
If a drawer navigator is nested inside of another navigator that provides some UI, for example, a tab navigator or stack navigator, then the drawer will be rendered below the UI from those navigators. The drawer will appear below the tab bar and below the header of the stack. You will need to make the drawer navigator the parent of any navigator where the drawer should be rendered on top of its UI.
Copy file name to clipboardExpand all lines: versioned_docs/version-6.x/modal.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ function RootStackScreen() {
61
61
}
62
62
```
63
63
64
-
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 options 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.
64
+
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.
65
65
66
66
Instead of specifying this option for a group, it's also possible to specify it for a single screen using the `options` prop on `RootStack.Screen`.
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/auth-flow.md
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Authentication flows
4
4
sidebar_label: Authentication flows
5
5
---
6
6
7
-
Most apps require that a user authenticate in some way to have access to data associated with a user or other private content. Typically the flow will look like this:
7
+
Most apps require that a user authenticates in some way to have access to data associated with a user or other private content. Typically the flow will look like this:
8
8
9
9
- The user opens the app.
10
10
- The app loads some authentication state from encrypted persistent storage (for example, [`SecureStore`](https://docs.expo.io/versions/latest/sdk/securestore/)).
@@ -15,7 +15,7 @@ Most apps require that a user authenticate in some way to have access to data as
15
15
16
16
## What we need
17
17
18
-
This is the behavior that we want from the authentication flow: when users sign in, we want to throw away the state of the authentication flow and unmount all of the screens related to authentication, and when we press the hardware back button we expect to not be able to go back to the authentication flow.
18
+
This is the behavior that we want from the authentication flow: when users sign in, we want to throw away the state of the authentication flow and unmount all of the screens related to authentication, and when we press the hardware back button, we expect to not be able to go back to the authentication flow.
19
19
20
20
## How it will work
21
21
@@ -101,7 +101,7 @@ The main thing to notice is that we're conditionally defining screens based on t
101
101
-`SignIn` screen is only defined if `userToken` is `null` (user is not signed in)
102
102
-`Home` screen is only defined if `userToken` is non-null (user is signed in)
103
103
104
-
Here, we're conditionally defining one screen for each case. But you could also define multiple screens. For example, you probably want to define password reset, signup, etc screens as well when the user isn't signed in. Similarly for the screens accessible after sign in, you probably have more than one screen. We can use `React.Fragment` to define multiple screens:
104
+
Here, we're conditionally defining one screen for each case. But you could also define multiple screens. For example, you probably want to define password reset, signup, etc screens as well when the user isn't signed in. Similarly, for the screens accessible after signing in, you probably have more than one screen. We can use `React.Fragment` to define multiple screens:
105
105
106
106
```js
107
107
state.userToken==null? (
@@ -118,7 +118,7 @@ state.userToken == null ? (
118
118
);
119
119
```
120
120
121
-
> If you have both your login-related screens and rest of the screens in Stack navigators, we recommend to use a single Stack navigator and place the conditional inside instead of using 2 different navigators. This makes it possible to have a proper transition animation during login/logout.
121
+
> If you have both your login-related screens and rest of the screens in two different Stack navigators, we recommend to use a single Stack navigator and place the conditional inside instead of using 2 different navigators. This makes it possible to have a proper transition animation during login/logout.
122
122
123
123
## Implement the logic for restoring the token
124
124
@@ -132,8 +132,8 @@ From the previous snippet, we can see that we need 3 state variables:
132
132
133
133
So we need to:
134
134
135
-
- Add some logic for restoring token, sign in and sign out
136
-
- Expose methods for sign in and sign out to other components
135
+
- Add some logic for restoring token, signing in and signing out
136
+
- Expose methods for signing in and signing out to other components
137
137
138
138
We'll use `React.useReducer` and `React.useContext` in this guide. But if you're using a state management library such as Redux or Mobx, you can use them for this functionality instead. In fact, in bigger apps, a global state management library is more suitable for storing authentication tokens. You can adapt the same approach to your state management library.
139
139
@@ -324,7 +324,11 @@ So our updated code will look like following:
0 commit comments