Skip to content

Commit

Permalink
docs: provide React Native-specific set up instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed Mar 10, 2022
1 parent f4546fc commit 94a2392
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Expand Up @@ -49,3 +49,25 @@ const apolloClient = new ApolloClient({
cache: new InMemoryCache(),
});
```

### Installation with React Native

Using `apollo-link-prismic` in React Native applications requires additional setup.

After installing `apollo-link-prismic`, install the following [URL Web API](https://developer.mozilla.org/en-US/docs/Web/API/URL_API) polyfill:

```sh
npm install react-native-url-polyfill
```

Next, import the polyfill in your app’s entry file (typically this is App.js or index.js).

```javascript
// App.js or index.js

import "react-native-url-polyfill/auto";
```

`apollo-link-prismic` can now be used throughout your app.

**Note**: If the polyfill does not work after importing in your app's entry file, try the alternative ["Flexible" set up method described in `react-native-url-polyfill`'s](https://github.com/charpeni/react-native-url-polyfill#option-2-flexible).

0 comments on commit 94a2392

Please sign in to comment.