Skip to content

add react native polyfill to getting started #5097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/fragments/lib/datastore/native_common/setup-env.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ Instead of using the platform integration, you can alternatively use the Amplify
import all0 from '/src/fragments/lib/datastore/native_common/setup-env-cli.mdx';

<Fragments fragments={{ all: all0 }} />

import reactnative1 from '/src/fragments/lib/datastore/react-native/getting-started/polyfills.mdx';

<Fragments fragments={{ 'react-native': reactnative1 }} />
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Start with the [React Native CLI](https://reactnative.dev/docs/getting-started):
npx [email protected] init AmplifyDataStoreRN --version 0.68.2
cd AmplifyDataStoreRN
npx amplify-app@latest
npm install aws-amplify @react-native-community/netinfo @react-native-async-storage/async-storage
npm install aws-amplify @react-native-community/netinfo @react-native-async-storage/async-storage core-js
```

You will also need to install the pod dependencies for iOS:
Expand All @@ -31,7 +31,7 @@ To enable SQLite with DataStore for enhanced local database performance, follow
npx [email protected] init AmplifyDataStoreRN --version 0.68.2
cd AmplifyDataStoreRN
npx amplify-app@latest
npm install aws-amplify @aws-amplify/datastore-storage-adapter react-native-sqlite-storage @react-native-community/netinfo @react-native-async-storage/async-storage
npm install aws-amplify @aws-amplify/datastore-storage-adapter react-native-sqlite-storage @react-native-community/netinfo @react-native-async-storage/async-storage core-js
npx pod-install
```

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Add Required Polyfills

React Native is missing some JavaScript standard library functionality that DataStore depends on. Add the following to the entry point of your app to polyfill these missing functionalities:

```js
import 'core-js/full/symbol/async-iterator';
```