UNPKG

2.38 kBMarkdownView Raw
1# expo-web-browser
2
3Provides access to the system's web browser and supports handling redirects. On iOS, it uses SFSafariViewController or SFAuthenticationSession, depending on the method you call, and on Android it uses ChromeCustomTabs. As of iOS 11, SFSafariViewController no longer shares cookies with the Safari, so if you are using WebBrowser for authentication you will want to use WebBrowser.openAuthSessionAsync, and if you just want to open a webpage (such as your app privacy policy), then use WebBrowser.openBrowserAsync.
4
5# API documentation
6
7- [Documentation for the master branch](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/sdk/webbrowser.md)
8- [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/webbrowser/)
9
10# Installation
11
12This package is pre-installed in [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects. You may skip the rest of the installation guide if this applies to you.
13
14For bare React Native projects, you must ensure that you have [installed and configured the `@unimodules/core` package](https://github.com/unimodules/core) before continuing.
15
16### Add the package to your npm dependencies
17
18```
19npm install expo-web-browser
20```
21
22### Configure for iOS
23
24Add the dependency to your `Podfile` and then run `pod install`.
25
26```ruby
27pod 'EXWebBrowser', path: '../node_modules/expo-web-browser/ios'
28```
29
30### Configure for Android
31
321. Append the following lines to `android/settings.gradle`:
33
34```gradle
35include ':expo-web-browser'
36project(':expo-web-browser').projectDir = new File(rootProject.projectDir, '../node_modules/expo-web-browser/android')
37```
38
392. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
40```gradle
41api project(':expo-web-browser')
42```
43
443. In `MainApplication.java`, import the package and add it to the `ReactModuleRegistryProvider` list:
45```java
46import expo.modules.webbrowser.WebBrowserPackage;
47```
48```java
49private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(Arrays.<Package>asList(
50 // Your other packages will be here
51 new WebBrowserPackage()
52), Arrays.<SingletonModule>asList());
53```
54
55# Contributing
56
57Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).