Search code examples
react-nativesfsafariviewcontroller

Implement Safari View Controller in React Native


We currently uploaded our app to the apple store and got the following answer:

We recommend implementing the Safari View Controller API to display web content within your app. The Safari View Controller allows the display of a URL and inspection of the certificate from an embedded browser in an app so that customers can verify the webpage URL and SSL certificate to confirm they are entering their sign in credentials into a legitimate page.

Currently i am using this code to open the web site from our app

Linking.openURL('here-goes-the-url')

So i am kind of lost what this answer from apple exactly means. Should i use a WebView inside my app to show the website content? I tried that but there i could not see any url or certificate as mentioned in the apple review.

What i found so far was something like that: https://www.npmjs.com/package/react-native-safari-view-controller

But this repo is not maintained since 2 years.

Does anyone can make it more clear for me what the reviewer means with that answer? Can i use the

WebBrowser.openBrowserAsync('url')

to achieve what they want?

Best regards


Solution

  • So right now, by using Linking.openURL... you're sending your users to an external browser (safari on iOS).

    The reviewer wants you to offer a better user experience by keeping your users into your app while still giving them all the features safari has.

    To do that you have to use something called a Safari View Controller (on iOS) which is basically like opening safari within your app.

    Even-though the library you pointed to does exactly that, it's no longer maintained and it just works for iOS, so instead I'd use something more modern that works for Android as well:

    https://github.com/proyecto26/react-native-inappbrowser