This repository has been archived by the owner on Dec 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
Upon launching the app, a web page in mobile Safari opens firs #98
Comments
已经用react-native-safari-view配合解决 import {
Linking,
Platform
} from 'react-native'; // eslint-disable-line import/no-unresolved, max-len
import SafariView from 'react-native-safari-view';
let previousOnLinkChange;
export const dance = (authUrl) => {
// Use SafariView on iOS
if (Platform.OS === 'ios') {
if (previousOnLinkChange) {
Linking.removeEventListener('url', previousOnLinkChange);
}
return SafariView.show({
url: authUrl,
readerMode: false,
fromBottom: true,
tintColor: '#000',
barTintColor: '#fff'
}).then(() => new Promise((resolve, reject) => {
const handleUrl = (url) => {
if (!url || url.indexOf('fail') > -1) {
reject(url);
} else {
resolve(url);
}
SafariView.dismiss();
};
const onLinkChange = ({url}) => {
Linking.removeEventListener('url', onLinkChange);
previousOnLinkChange = undefined;
handleUrl(url);
};
Linking.addEventListener('url', onLinkChange);
previousOnLinkChange = onLinkChange;
}));
}
// Or Linking.openURL on Android
else {
if (previousOnLinkChange) {
Linking.removeEventListener('url', previousOnLinkChange);
}
return Linking.openURL(authUrl)
.then(() => new Promise((resolve, reject) => {
const handleUrl = (url) => {
if (!url || url.indexOf('fail') > -1) {
reject(url);
} else {
resolve(url);
}
};
const onLinkChange = ({url}) => {
Linking.removeEventListener('url', onLinkChange);
previousOnLinkChange = undefined;
handleUrl(url);
};
Linking.addEventListener('url', onLinkChange);
previousOnLinkChange = onLinkChange;
}));
}
};
export const request = fetch; |
@bashen1 same message came for me also. did the above solution worked for you ? |
@ayushnawani Yes |
@bashen1 you should create one pull request so it can be merged. @adamjmcgrath is it possible? |
Sure, happy to look at a PR. Although see my comment #86 (comment) about including |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We noticed an issue in your app that contributes to a lower quality user experience than Apple users expect:
 - Upon launching the app, a web page in mobile Safari opens first, then returns to the app. The user should be able to use the app immediately upon launch.
Next Steps
To resolve this issue, please revise your app to address all instances of this type of issue.
The text was updated successfully, but these errors were encountered: