Skip to content

Commit 9bb8d1f

Browse files
separate deep link section for expo projects / vanilla react native projects
1 parent bfff3fa commit 9bb8d1f

File tree

4 files changed

+101
-61
lines changed

4 files changed

+101
-61
lines changed

docs/deep-linking.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ const SimpleApp = createAppContainer(createStackNavigator({
2929
}));
3030
```
3131

32+
## Set up with Expo projects
33+
34+
You need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
35+
36+
```json
37+
{
38+
"expo": {
39+
"scheme": "mychat"
40+
}
41+
}
42+
```
3243

3344
### URI Prefix
3445

@@ -37,26 +48,11 @@ Next, let's configure our navigation container to extract the path from the app'
3748
```js
3849
const SimpleApp = createAppContainer(createStackNavigator({...}));
3950

40-
// on Android, the URI prefix typically contains a host in addition to scheme
41-
// on Android, note the required / (slash) at the end of the host property
42-
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
43-
// in Expo projects you can do the following to get the URI prefix
4451
const prefix = Expo.Linking.makeUrl('/');
4552

4653
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
4754
```
4855

49-
## Set up with Expo projects
50-
51-
you need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
52-
53-
```json
54-
{
55-
"expo": {
56-
"scheme": "mychat"
57-
}
58-
}
59-
```
6056
### iOS
6157

6258
To test the URI on the simulator (Expo client app ), run the following:
@@ -88,6 +84,20 @@ Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linkin
8884

8985
## Set up with `react-native init` projects
9086

87+
### URI Prefix
88+
89+
Next, let's configure our navigation container to extract the path from the app's incoming URI.
90+
91+
```js
92+
const SimpleApp = createAppContainer(createStackNavigator({...}));
93+
94+
// on Android, the URI prefix typically contains a host in addition to scheme
95+
// on Android, note the required / (slash) at the end of the host property
96+
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
97+
98+
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
99+
```
100+
91101
### iOS
92102

93103
Let's configure the native iOS app to open based on the `mychat://` URI scheme.

website/versioned_docs/version-1.x/deep-linking.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ const SimpleApp = StackNavigator({
3030
});
3131
```
3232

33+
## Set up with Expo projects
34+
35+
You need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
36+
37+
```json
38+
{
39+
"expo": {
40+
"scheme": "mychat"
41+
}
42+
}
43+
```
3344

3445
### URI Prefix
3546

@@ -38,26 +49,11 @@ Next, let's configure our navigation container to extract the path from the app'
3849
```js
3950
const SimpleApp = StackNavigator({...});
4051

41-
// on Android, the URI prefix typically contains a host in addition to scheme
42-
// on Android, note the required / (slash) at the end of the host property
43-
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
44-
// in Expo projects you can do the following to get the URI prefix
4552
const prefix = Expo.Linking.makeUrl('/');
4653

4754
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
4855
```
4956

50-
## Set up with Expo projects
51-
52-
you need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
53-
54-
```json
55-
{
56-
"expo": {
57-
"scheme": "mychat"
58-
}
59-
}
60-
```
6157
### iOS
6258

6359
To test the URI on the simulator (Expo client app ), run the following:
@@ -89,6 +85,20 @@ Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linkin
8985

9086
## Set up with `react-native init` projects
9187

88+
### URI Prefix
89+
90+
Next, let's configure our navigation container to extract the path from the app's incoming URI.
91+
92+
```js
93+
const SimpleApp = StackNavigator({...}));
94+
95+
// on Android, the URI prefix typically contains a host in addition to scheme
96+
// on Android, note the required / (slash) at the end of the host property
97+
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
98+
99+
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
100+
```
101+
92102
### iOS
93103

94104
Let's configure the native iOS app to open based on the `mychat://` URI scheme.
@@ -110,7 +120,7 @@ In `SimpleApp/ios/SimpleApp/AppDelegate.m`:
110120

111121
In Xcode, open the project at `SimpleApp/ios/SimpleApp.xcodeproj`. Select the project in sidebar and navigate to the info tab. Scroll down to "URL Types" and add one. In the new URL type, set the identifier and the url scheme to your desired url scheme.
112122

113-
![Xcode project info URL types with mychat added](./assets/deep-linking/xcode-linking.png)
123+
![Xcode project info URL types with mychat added](/docs/assets/deep-linking/xcode-linking.png)
114124

115125
Now you can press play in Xcode, or re-build on the command line:
116126

website/versioned_docs/version-2.x/deep-linking.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ const SimpleApp = createStackNavigator({
3030
});
3131
```
3232

33+
## Set up with Expo projects
34+
35+
You need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
36+
37+
```json
38+
{
39+
"expo": {
40+
"scheme": "mychat"
41+
}
42+
}
43+
```
3344

3445
### URI Prefix
3546

@@ -38,26 +49,11 @@ Next, let's configure our navigation container to extract the path from the app'
3849
```js
3950
const SimpleApp = createStackNavigator({...});
4051

41-
// on Android, the URI prefix typically contains a host in addition to scheme
42-
// on Android, note the required / (slash) at the end of the host property
43-
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
44-
// in Expo projects you can do the following to get the URI prefix
4552
const prefix = Expo.Linking.makeUrl('/');
4653

4754
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
4855
```
4956

50-
## Set up with Expo projects
51-
52-
you need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
53-
54-
```json
55-
{
56-
"expo": {
57-
"scheme": "mychat"
58-
}
59-
}
60-
```
6157
### iOS
6258

6359
To test the URI on the simulator (Expo client app ), run the following:
@@ -89,6 +85,20 @@ Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linkin
8985

9086
## Set up with `react-native init` projects
9187

88+
### URI Prefix
89+
90+
Next, let's configure our navigation container to extract the path from the app's incoming URI.
91+
92+
```js
93+
const SimpleApp = createStackNavigator({...});
94+
95+
// on Android, the URI prefix typically contains a host in addition to scheme
96+
// on Android, note the required / (slash) at the end of the host property
97+
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
98+
99+
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
100+
```
101+
92102
### iOS
93103

94104
Let's configure the native iOS app to open based on the `mychat://` URI scheme.

website/versioned_docs/version-3.x/deep-linking.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ const SimpleApp = createAppContainer(createStackNavigator({
3030
}));
3131
```
3232

33+
## Set up with Expo projects
34+
35+
You need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
36+
37+
```json
38+
{
39+
"expo": {
40+
"scheme": "mychat"
41+
}
42+
}
43+
```
3344

3445
### URI Prefix
3546

@@ -38,26 +49,11 @@ Next, let's configure our navigation container to extract the path from the app'
3849
```js
3950
const SimpleApp = createAppContainer(createStackNavigator({...}));
4051

41-
// on Android, the URI prefix typically contains a host in addition to scheme
42-
// on Android, note the required / (slash) at the end of the host property
43-
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
44-
// in Expo projects you can do the following to get the URI prefix
4552
const prefix = Expo.Linking.makeUrl('/');
4653

4754
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
4855
```
4956

50-
## Set up with Expo projects
51-
52-
you need to specify a scheme for your app. You can register for a scheme in your `app.json` by adding a string under the scheme key:
53-
54-
```json
55-
{
56-
"expo": {
57-
"scheme": "mychat"
58-
}
59-
}
60-
```
6157
### iOS
6258

6359
To test the URI on the simulator (Expo client app ), run the following:
@@ -89,6 +85,20 @@ Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linkin
8985

9086
## Set up with `react-native init` projects
9187

88+
### URI Prefix
89+
90+
Next, let's configure our navigation container to extract the path from the app's incoming URI.
91+
92+
```js
93+
const SimpleApp = createAppContainer(createStackNavigator({...}));
94+
95+
// on Android, the URI prefix typically contains a host in addition to scheme
96+
// on Android, note the required / (slash) at the end of the host property
97+
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
98+
99+
const MainApp = () => <SimpleApp uriPrefix={prefix} />;
100+
```
101+
92102
### iOS
93103

94104
Let's configure the native iOS app to open based on the `mychat://` URI scheme.

0 commit comments

Comments
 (0)