mirror of
https://github.com/zhigang1992/examples.git
synced 2026-01-12 22:47:03 +08:00
Merge pull request #9 from expo/@sjchmiela/fix_webbrowser_redirect
Fix with-webbrowser-redirect example
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import Expo, { Linking, WebBrowser } from 'expo';
|
||||
import { Linking, WebBrowser } from 'expo';
|
||||
import React from 'react';
|
||||
import { Button, StyleSheet, Text, View } from 'react-native';
|
||||
|
||||
@@ -31,12 +31,19 @@ export default class App extends React.Component {
|
||||
};
|
||||
|
||||
_openWebBrowserAsync = async () => {
|
||||
this._addLinkingListener();
|
||||
let result = await WebBrowser.openBrowserAsync(
|
||||
`https://backend-xxswjknyfi.now.sh/?linkingUri=${Linking.makeUrl('/')}`
|
||||
);
|
||||
this._removeLinkingListener();
|
||||
this.setState({ result });
|
||||
try {
|
||||
this._addLinkingListener();
|
||||
let result = await WebBrowser.openBrowserAsync(
|
||||
// We add `?` at the end of the URL since the test backend that is used
|
||||
// just appends `authToken=<token>` to the URL provided.
|
||||
`https://backend-xxswjknyfi.now.sh/?linkingUri=${Linking.makeUrl('/?')}`
|
||||
);
|
||||
this._removeLinkingListener();
|
||||
this.setState({ result });
|
||||
} catch (error) {
|
||||
alert(error);
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
_addLinkingListener = () => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"name": "with-webbrowser-redirect",
|
||||
"slug": "with-webbrowser-redirect",
|
||||
"privacy": "public",
|
||||
"sdkVersion": "27.0.0",
|
||||
"sdkVersion": "30.0.0",
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
"primaryColor": "#cccccc",
|
||||
@@ -13,6 +13,7 @@
|
||||
},
|
||||
"ios": {
|
||||
"supportsTablet": true
|
||||
}
|
||||
},
|
||||
"scheme": "expo.examples.with-webbrowser-redirect"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"private": true,
|
||||
"main": "node_modules/expo/AppEntry.js",
|
||||
"dependencies": {
|
||||
"expo": "^27.0.1",
|
||||
"expo": "^30.0.1",
|
||||
"react": "16.3.1",
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-27.0.0.tar.gz"
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user