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
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/deep-linking.md
+76-43Lines changed: 76 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,12 @@ While you don't need to use the `linking` prop from React Navigation, and can ha
18
18
19
19
Below, we'll go through required configurations so that the deep link integration works.
20
20
21
-
## Setup with Expo projects
21
+
## Setting up deep links
22
+
23
+
<TabsgroupId='framework'queryString="framework">
24
+
<TabItemvalue='expo'label='Expo'default>
25
+
26
+
### Configuring URL scheme
22
27
23
28
First, you will want to specify a URL scheme for your app. This corresponds to the string before `://` in a URL, so if your scheme is `example` then a link to your app would be `example://`. You can register for a scheme in your `app.json` by adding a string under the scheme key:
24
29
@@ -36,55 +41,25 @@ Next, install `expo-linking` which we'd need to get the deep link prefix:
36
41
npx expo install expo-linking
37
42
```
38
43
39
-
Then, let's configure React Navigation to use the `scheme` for parsing incoming deep links:
40
-
41
-
<TabsgroupId="config"queryString="config">
42
-
<TabItemvalue="static"label="Static"default>
44
+
Then you can use `Linking.createURL` to get the prefix for your app:
43
45
44
46
```js
45
-
import*asLinkingfrom'expo-linking';
46
-
47
-
constprefix=Linking.createURL('/');
48
-
49
-
/* content */
50
-
51
-
functionApp() {
52
-
constlinking= {
53
-
prefixes: [prefix],
54
-
};
55
-
56
-
return<Navigation linking={linking} />;
57
-
}
47
+
constlinking= {
48
+
prefixes: [Linking.createURL('/'),
49
+
};
58
50
```
59
51
60
-
</TabItem>
61
-
<TabItemvalue="dynamic"label="Dynamic">
62
-
63
-
```js
64
-
import*asLinkingfrom'expo-linking';
52
+
See more details below at [Configuring React Navigation](#configuring-react-navigation).
It is necessary to use `Linking.createURL` since the scheme differs between the [Expo Dev Client](https://docs.expo.dev/versions/latest/sdk/dev-client/) and standalone apps.
85
58
86
59
The scheme specified in `app.json` only applies to standalone apps. In the Expo client app you can deep link using `exp://ADDRESS:PORT/--/` where `ADDRESS` is often `127.0.0.1` and `PORT` is often `19000` - the URL is printed when you run `expo start`. The `Linking.createURL` function abstracts it out so that you don't need to specify them manually.
87
60
61
+
</details>
62
+
88
63
If you are using universal links, you need to add your domain to the prefixes as well:
89
64
90
65
```js
@@ -93,7 +68,7 @@ const linking = {
93
68
};
94
69
```
95
70
96
-
### Universal Links on Expo
71
+
### Universal Links on iOS
97
72
98
73
To set up iOS universal Links in your Expo app, you need to configure your [app config](https://docs.expo.dev/workflow/configuration) to include the associated domains and entitlements:
99
74
@@ -114,7 +89,7 @@ You will also need to setup [Associated Domains](https://developer.apple.com/doc
114
89
115
90
See [Expo's documentation on iOS Universal Links](https://docs.expo.dev/linking/ios-universal-links/) for more details.
116
91
117
-
### App Links on Expo
92
+
### App Links on Android
118
93
119
94
To set up Android App Links in your Expo app, you need to configure your [app config](https://docs.expo.dev/workflow/configuration) to include the `intentFilters`:
120
95
@@ -144,7 +119,8 @@ You will also need to [declare the association](https://developer.android.com/tr
144
119
145
120
See [Expo's documentation on Android App Links](https://docs.expo.dev/linking/android-app-links/) for more details.
@@ -300,6 +276,63 @@ After adding them, it should look like this:
300
276
301
277
Then, you need to [declare the association](https://developer.android.com/training/app-links/verify-android-applinks#web-assoc) between your website and your intent filters by hosting a Digital Asset Links JSON file.
302
278
279
+
</TabItem>
280
+
</Tabs>
281
+
282
+
## Configuring React Navigation
283
+
284
+
To handle deep links, you need to configure React Navigation to use the `scheme` for parsing incoming deep links:
285
+
286
+
<TabsgroupId="config"queryString="config">
287
+
<TabItemvalue="static"label="Static"default>
288
+
289
+
```js
290
+
constlinking= {
291
+
prefixes: [
292
+
'example://', // Or `Linking.createURL('/')` for Expo apps
293
+
],
294
+
};
295
+
296
+
functionApp() {
297
+
return<Navigation linking={linking} />;
298
+
}
299
+
```
300
+
301
+
</TabItem>
302
+
<TabItemvalue="dynamic"label="Dynamic">
303
+
304
+
```js
305
+
constlinking= {
306
+
prefixes: [
307
+
'example://', // Or `Linking.createURL('/')` for Expo apps
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/drawer-layout.md
+21-16Lines changed: 21 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,31 +20,36 @@ To use this package, open a Terminal in the project root and run:
20
20
npm install react-native-drawer-layout
21
21
```
22
22
23
-
Then, you need to install and configure the libraries that are required by the drawer:
23
+
The library depends on [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) for gestures and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) for animations.
24
24
25
-
1. First, install [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) (at least version 2 or 3).
25
+
<TabsgroupId='framework'queryString="framework">
26
+
<TabItemvalue='expo'label='Expo'default>
26
27
27
-
If you have a Expo managed project, in your project directory, run:
28
+
If you have a Expo managed project, in your project directory, run:
If you have a bare React Native project, in your project directory, run:
38
38
39
-
2. Configure the Reanimated Babel Plugin in your project following the [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
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.
43
+
After installation, configure the Reanimated Babel Plugin in your project following the [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
42
44
43
-
```bash
44
-
npx pod-install ios
45
-
```
45
+
</TabItem>
46
+
</Tabs>
46
47
47
-
We're done! Now you can build and run the app on your device/simulator.
48
+
If you're on a Mac and developing for iOS, you also need to install [pods](https://cocoapods.org/) to complete the linking.
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/drawer-navigator.md
+22-15Lines changed: 22 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,29 +20,36 @@ To use this navigator, ensure that you have [`@react-navigation/native` and its
20
20
npm install @react-navigation/drawer
21
21
```
22
22
23
-
Then, you need to install and configure the libraries that are required by the drawer navigator:
23
+
The navigator depends on [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) for gestures and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) for animations.
24
24
25
-
1. First, install [`react-native-gesture-handler`](https://docs.swmansion.com/react-native-gesture-handler/) and [`react-native-reanimated`](https://docs.swmansion.com/react-native-reanimated/) (at least version 2 or 3).
25
+
<TabsgroupId='framework'queryString="framework">
26
+
<TabItemvalue='expo'label='Expo'default>
26
27
27
-
If you have a Expo managed project, in your project directory, run:
28
+
If you have a Expo managed project, in your project directory, run:
If you have a bare React Native project, in your project directory, run:
38
38
39
-
2. Configure the Reanimated Babel Plugin in your project following the [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
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.
43
+
After installation, configure the Reanimated Babel Plugin in your project following the [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started).
42
44
43
-
```bash
44
-
npx pod-install ios
45
-
```
45
+
</TabItem>
46
+
</Tabs>
47
+
48
+
If you're on a Mac and developing for iOS, you also need to install [pods](https://cocoapods.org/) to complete the linking.
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/getting-started.md
+21-22Lines changed: 21 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,54 +42,44 @@ Otherwise, you can follow the instructions below to install React Navigation int
42
42
43
43
## Installation
44
44
45
-
Install the required packages in your React Native project:
45
+
The `@react-navigation/native` package contains the core functionality of React Navigation.
46
+
47
+
In your project directory, run:
46
48
47
49
```bash npm2yarn
48
50
npm install @react-navigation/native
49
51
```
50
52
51
-
React Navigation is made up of some core utilities and those are then used by navigators to create the navigation structure in your app. Don't worry too much about this for now, it'll become clear soon enough! To frontload the installation work, let's also install and configure dependencies used by most navigators, then we can move forward with starting to write some code.
53
+
### Installing dependencies
52
54
53
-
The libraries we will install now are [`react-native-screens`](https://github.com/software-mansion/react-native-screens) and [`react-native-safe-area-context`](https://github.com/th3rdwave/react-native-safe-area-context). If you already have these libraries installed and at the latest version, you are done here! Otherwise, read on.
55
+
Let's also install and configure dependencies used by most navigators. The libraries we will install now are [`react-native-screens`](https://github.com/software-mansion/react-native-screens) and [`react-native-safe-area-context`](https://github.com/th3rdwave/react-native-safe-area-context).
54
56
55
-
### Installing dependencies into an Expo managed project
You might get warnings related to peer dependencies after installation. They are usually caused by incorrect version ranges specified in some packages. You can safely ignore these warnings as long as your app builds and works as expected.
78
-
79
-
:::
80
-
81
77
If you're on a Mac and developing for iOS, you need to install the pods (via [Cocoapods](https://cocoapods.org/)) to complete the linking.
82
78
83
79
```bash
84
80
npx pod-install ios
85
81
```
86
82
87
-
:::info
88
-
89
-
When you use a navigator (such as stack navigator), you'll need to follow the installation instructions of that navigator for any additional dependencies. If you're getting an error "Unable to resolve module", you need to install that module in your project.
90
-
91
-
:::
92
-
93
83
#### Configuring `react-native-screens` on Android
94
84
95
85
[`react-native-screens`](https://github.com/software-mansion/react-native-screens) requires one additional configuration to properly work on Android.
@@ -119,8 +109,8 @@ class MainActivity: ReactActivity() {
119
109
}
120
110
```
121
111
122
-
</TabItem>
123
-
<TabItemvalue='java'label='Java'>
112
+
</TabItem>
113
+
<TabItemvalue='java'label='Java'>
124
114
125
115
```java
126
116
// highlight-start
@@ -163,12 +153,21 @@ To opt out, in `AndroidManifest.xml`, in the `<application>` tag (or `<activity>
163
153
</application>
164
154
```
165
155
156
+
</TabItem>
157
+
</Tabs>
158
+
166
159
## Setting up React Navigation
167
160
168
161
Once you've installed and configured the dependencies, you can move on to setting up your project to use React Navigation.
169
162
170
163
When using React Navigation, you configure [**navigators**](glossary-of-terms.md#navigator) in your app. Navigators handle the transition between screens in your app and provide UI such as header, tab bar etc.
171
164
165
+
:::info
166
+
167
+
When you use a navigator (such as stack navigator), you'll need to follow the installation instructions of that navigator for any additional dependencies.
168
+
169
+
:::
170
+
172
171
There are 2 primary ways to configure the navigators:
0 commit comments