Skip to content

add more information about deep link for expo projects #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/deep-linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,50 @@ const SimpleApp = createAppContainer(createStackNavigator({...}));
// on Android, the URI prefix typically contains a host in addition to scheme
// on Android, note the required / (slash) at the end of the host property
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
// in Expo projects you can do the following to get the URI prefix
const prefix = Expo.Linking.makeUrl('/');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to have an entirely separate section for expo projects / vanilla react native projects, and just repeat this entire code example in both sections but with the prefix line that is relevant to the platform. it's a bit cleaner when you can just pick the section relevant to you and follow that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, thanks! I'll do that.


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

## Set up with Expo projects

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should capitalize the first word in the paragraph, so "You need" rather than "you need"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦🏾‍♂️
sorry haha


```json
{
"expo": {
"scheme": "mychat"
}
}
```
### iOS

To test the URI on the simulator (Expo client app ), run the following:

```
xcrun simctl openurl booted [ put your URI prefix in here ]

// for example

xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric

```


### Android

To test the intent handling in Android (Expo client app ), run the following:

```
adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in here ]" com.simpleapp

// for example

adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp

```

Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linking.html) for more information about how to configure linking in projects built with Expo.

## Set up with `react-native init` projects
Expand Down
45 changes: 44 additions & 1 deletion website/versioned_docs/version-1.x/deep-linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,52 @@ Next, let's configure our navigation container to extract the path from the app'
const SimpleApp = StackNavigator({...});

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

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

## Set up with Expo projects

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:

```json
{
"expo": {
"scheme": "mychat"
}
}
```
### iOS

To test the URI on the simulator (Expo client app ), run the following:

```
xcrun simctl openurl booted [ put your URI prefix in here ]

// for example

xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric

```


### Android

To test the intent handling in Android (Expo client app ), run the following:

```
adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in here ]" com.simpleapp

// for example

adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp

```

Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linking.html) for more information about how to configure linking in projects built with Expo.

## Set up with `react-native init` projects
Expand Down Expand Up @@ -94,11 +133,15 @@ To configure the external linking in Android, you can create a new intent in the
In `SimpleApp/android/app/src/main/AndroidManifest.xml`, add the new `VIEW` type `intent-filter` inside the `MainActivity` entry:

```
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mychat" android:host="mychat" />
<data android:scheme="mychat" android:host="mychat" />
</intent-filter>
```

Expand Down
44 changes: 43 additions & 1 deletion website/versioned_docs/version-2.x/deep-linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,50 @@ const SimpleApp = createStackNavigator({...});
// on Android, the URI prefix typically contains a host in addition to scheme
// on Android, note the required / (slash) at the end of the host property
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
// in Expo projects you can do the following to get the URI prefix
const prefix = Expo.Linking.makeUrl('/');

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

## Set up with Expo projects

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:

```json
{
"expo": {
"scheme": "mychat"
}
}
```
### iOS

To test the URI on the simulator (Expo client app ), run the following:

```
xcrun simctl openurl booted [ put your URI prefix in here ]

// for example

xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric

```


### Android

To test the intent handling in Android (Expo client app ), run the following:

```
adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in here ]" com.simpleapp

// for example

adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp

```

Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linking.html) for more information about how to configure linking in projects built with Expo.

## Set up with `react-native init` projects
Expand Down Expand Up @@ -95,11 +133,15 @@ To configure the external linking in Android, you can create a new intent in the
In `SimpleApp/android/app/src/main/AndroidManifest.xml`, add the new `intent-filter` inside the `MainActivity` entry with a `VIEW` type action:

```
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mychat" android:host="mychat" />
<data android:scheme="mychat" android:host="mychat" />
</intent-filter>
```

Expand Down
44 changes: 43 additions & 1 deletion website/versioned_docs/version-3.x/deep-linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,50 @@ const SimpleApp = createAppContainer(createStackNavigator({...}));
// on Android, the URI prefix typically contains a host in addition to scheme
// on Android, note the required / (slash) at the end of the host property
const prefix = Platform.OS == 'android' ? 'mychat://mychat/' : 'mychat://';
// in Expo projects you can do the following to get the URI prefix
const prefix = Expo.Linking.makeUrl('/');

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

## Set up with Expo projects

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:

```json
{
"expo": {
"scheme": "mychat"
}
}
```
### iOS

To test the URI on the simulator (Expo client app ), run the following:

```
xcrun simctl openurl booted [ put your URI prefix in here ]

// for example

xcrun simctl openurl booted exp://127.0.0.1:19004/--/chat/Eric

```


### Android

To test the intent handling in Android (Expo client app ), run the following:

```
adb shell am start -W -a android.intent.action.VIEW -d "[ put your URI prefix in here ]" com.simpleapp

// for example

adb shell am start -W -a android.intent.action.VIEW -d "exp://127.0.0.1:19004/--/chat/Eric" com.simpleapp

```

Read the [Expo linking guide](https://docs.expo.io/versions/latest/guides/linking.html) for more information about how to configure linking in projects built with Expo.

## Set up with `react-native init` projects
Expand Down Expand Up @@ -95,11 +133,15 @@ To configure the external linking in Android, you can create a new intent in the
In `SimpleApp/android/app/src/main/AndroidManifest.xml`, add the new `intent-filter` inside the `MainActivity` entry with a `VIEW` type action:

```
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mychat" android:host="mychat" />
<data android:scheme="mychat" android:host="mychat" />
</intent-filter>
```

Expand Down