Skip to content

Commit a0ef60f

Browse files
author
Abdallah Shaban
authored
React native getting started guide updates (aws-amplify#4714)
* small updates to getting started guide * clarified the inspector panel location * Expo CLI wording update * remove react-native-picker and react-native package * update to RN getting started guide * updated installation of React Native CLI * update setup steps * removed broken closing tags * fixed tag * removed open tag without closing tag * added closing tag
1 parent 55f1819 commit a0ef60f

File tree

16 files changed

+142
-66
lines changed

16 files changed

+142
-66
lines changed

src/fragments/lib-v1/datastore/js/getting-started/30_platformIntegration.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ npx create-react-app amplify-datastore --use-npm
1313
cd amplify-datastore
1414
npx amplify-app@latest
1515
```
16-
1716
</Block>
1817
<Block name="React Native">
1918

src/fragments/lib/auth/getting_started/js/getting-started-steps-basic-auth.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You will also need to install the pod dependencies for iOS:
2222
npx pod-install
2323
```
2424
</Block>
25-
<Block name="Expo">
25+
<Block name="Expo CLI">
2626

2727
Install the necessary dependencies by running the following command:
2828

src/fragments/lib/auth/js/react-native-withoauth.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ The following `props` are used for building a custom UI with buttons if you do n
2121
To use `withOAuth` in your React Native application first install the appropriate dependencies:
2222

2323
<BlockSwitcher>
24-
<Block name="Expo">
24+
<Block name="Expo CLI">
2525

2626
```sh
27-
yarn add aws-amplify-react-native aws-amplify @react-native-picker/picker
27+
yarn add aws-amplify
2828
```
2929

3030
</Block>
3131
<Block name="React Native CLI">
3232

3333
```sh
34-
yarn add aws-amplify-react-native aws-amplify @react-native-picker/picker
34+
yarn add aws-amplify
3535
```
3636

3737
You will also need to install the pod dependencies for iOS:

src/fragments/lib/auth/js/social.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ import all2 from "/src/fragments/lib/auth/js/react-native-withoauth.mdx";
360360

361361
</Block>
362362

363-
<Block name="Expo">
363+
<Block name="Expo CLI">
364364

365365
**In-App Browser Setup (optional, but recommended)**
366366

src/fragments/lib/datastore/js/getting-started/30_platformIntegration.mdx

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ The fastest way to get started is using the `amplify-app` npx script.
55
frameborder="0"
66
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
77
allowfullscreen
8-
></iframe>
9-
<br />
8+
></iframe> <br />
109

1110
Start with [Create React app](https://create-react-app.dev):
1211

@@ -15,3 +14,68 @@ npx create-react-app amplify-datastore --use-npm
1514
cd amplify-datastore
1615
npx amplify-app@latest
1716
```
17+
18+
Start with the [React Native CLI](https://reactnative.dev/docs/getting-started):
19+
20+
```bash
21+
npx [email protected] init AmplifyDataStoreRN --version 0.68.2
22+
cd AmplifyDataStoreRN
23+
npx amplify-app@latest
24+
npm install aws-amplify @react-native-community/netinfo @react-native-async-storage/async-storage
25+
```
26+
27+
You will also need to install the pod dependencies for iOS:
28+
29+
```sh
30+
npx pod-install
31+
```
32+
33+
**Use SQLite for enhanced performance (optional)**
34+
35+
React Native CLI apps can now use SQLite with DataStore. SQLite offers considerable performance advantages over the default "AsyncStorage" database.
36+
37+
To enable SQLite with DataStore for enhanced local database performance, follow the steps below:
38+
39+
```sh
40+
npx [email protected] init AmplifyDataStoreRN --version 0.68.2
41+
cd AmplifyDataStoreRN
42+
npx amplify-app@latest
43+
npm install aws-amplify @aws-amplify/datastore-storage-adapter react-native-sqlite-storage @react-native-community/netinfo @react-native-async-storage/async-storage
44+
npx pod-install
45+
```
46+
47+
Then configure the SQLite storage adapter with DataStore in your app:
48+
49+
```js
50+
import { DataStore } from 'aws-amplify';
51+
import { SQLiteAdapter } from '@aws-amplify/datastore-storage-adapter/SQLiteAdapter';
52+
53+
DataStore.configure({
54+
storageAdapter: SQLiteAdapter
55+
});
56+
```
57+
58+
<Block name="Expo CLI">
59+
60+
Start with the [Expo](https://docs.expo.dev/):
61+
62+
```bash
63+
expo init AmplifyDataStoreExpo
64+
cd AmplifyDataStoreExpo
65+
npx amplify-app@latest
66+
expo install aws-amplify @react-native-community/netinfo @react-native-async-storage/async-storage
67+
```
68+
69+
**Use SQLite for enhanced performance (optional)**
70+
71+
Expo built apps can now use SQLite with DataStore. SQLite offers considerable performance advantages over the default "AsyncStorage" database.
72+
73+
To enable SQLite with DataStore for enhanced local database performance, follow the steps below:
74+
75+
```sh
76+
expo init AmplifyDataStoreExpo
77+
cd AmplifyDataStoreExpo
78+
npx amplify-app@latest
79+
expo install aws-amplify @aws-amplify/datastore-storage-adapter expo-sqlite expo-file-system @react-native-community/netinfo @react-native-async-storage/async-storage
80+
```
81+
</Block>

src/fragments/lib/in-app-messaging/js/getting-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Make sure you have completed the below steps:
88
In your application directory, you should first install the necessary dependencies. Although Amplify In-App Messaging can be used as a standalone JavaScript library, the UI integration is currently available only for _React Native_. The integrations steps here assume a React Native application as the implementation target.
99

1010
```bash
11-
npm install -E aws-amplify@in-app-messaging aws-amplify-react-native@in-app-messaging amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage @react-native-picker/picker react-native-get-random-values react-native-url-polyfill
11+
npm install -E aws-amplify@in-app-messaging aws-amplify-react-native@in-app-messaging amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage react-native-get-random-values react-native-url-polyfill
1212
```
1313

1414
You will also need to install pod dependencies for `iOS`. Navigate to the `iOS` directory in your project and run the install command.

src/fragments/lib/in-app-messaging/js/prerequisites.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The first step is to initialize a new React Native project. This can be done using Expo or the React Native CLI.
44

55
<BlockSwitcher>
6-
<Block name="Expo">
6+
<Block name="Expo CLI">
77

88
> If this is your first time using Expo, complete the [Expo Getting Started guide](https://docs.expo.dev/) before running the below command.
99

src/fragments/start/getting-started/android/generate-model.mdx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ With the basic setup complete, you can now model the data your application will
1919
### Add the Priority and completedAt fields
2020

2121
1. Start by changing **description** to **priority**
22-
2. In the inspector panel, select **Is required** to make this field required
22+
2. In the inspector panel to the right, select **Is required** to make this field required
2323
3. For the **Type** of this field, select **Enums** > **Create New**
2424
4. Set the name of the Enum to **Priority**
2525
5. Set the value of the Enum to **LOW**, click **Add a value**, and add **NORMAL** and **HIGH**
@@ -32,16 +32,9 @@ With the basic setup complete, you can now model the data your application will
3232
## Generate the models locally
3333

3434
1. If you haven’t already done so, click **Next: Test locally in your app** on the Data modeling screen to proceed
35-
2. On the Test locally in your app screen, you will be prompted with on-screen instructions
36-
1. **What type of app are you building?**
37-
1. Platform: **Android**
38-
2. Framework / Language: **Java** or **Kotlin**
39-
3. Click **Next**
40-
2. **(Optional) Create a new app**
41-
1. You should have already created a new Android app in a previous step, so go ahead and click **Next**
42-
3. **Install Amplify CLI to pull the data model**
43-
1. You should have already installed the Amplify CLI in a previous step
44-
2. Copy and run the command shown in your project root. This command will initialize your current project with Amplify as well as generate the data models you will be using locally
35+
2. **Install Amplify CLI to pull the data model**
36+
1. You should have already installed the Amplify CLI in a previous step
37+
2. Copy and run the command shown in your project root. This command will initialize your current project with Amplify as well as generate the data models you will be using locally
4538

4639
```bash
4740
amplify pull --sandboxId <UUID>

src/fragments/start/getting-started/flutter/generate-model.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ With the basic setup complete, you can now model the data your application will
2121
1. Start by clicking **Add a field** under the **Todo** model.
2222
2. Set the **Field name** of this field to **isComplete**
2323
3. For the **Type** of this field, select **Boolean**
24-
4. In the inspector panel, select **Is required** to make this field required
24+
4. In the inspector panel to the right, select **Is required** to make this field required
2525

2626
![Add isComplete field](/images/lib/getting-started/flutter/generate-model-admin-ui-isComplete-field.png)
2727

src/fragments/start/getting-started/reactnative/generate-model.mdx

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ With the basic setup complete, you can now model the data your application will
88

99
## Create data model
1010

11-
1. Navigate to the [Data feature in AWS Amplify Studio](https://sandbox.amplifyapp.com/getting-started) , select **Build a Todo** with **React Native** and then click on **Get started**.
11+
1. Navigate to the [AWS Amplify Studio](https://sandbox.amplifyapp.com/getting-started) , select **To-do list** option in the quickstart section with **React Native** then click on **Get started**.
1212

1313
![Create new schema](/images/lib/getting-started/reactnative/generate-model-admin-ui-create.png)
1414

@@ -19,30 +19,23 @@ With the basic setup complete, you can now model the data your application will
1919
1. Start by clicking **Add a field** under the **Todo** model.
2020
2. Set the **Field name** of this field to **isComplete**
2121
3. For the **Type** of this field, select **Boolean**
22-
4. In the inspector panel, select **Is required** to make this field required
22+
4. In the inspector panel to the right, select **Is required** to make this field required
2323

2424
![Add isComplete field](/images/lib/getting-started/reactnative/generate-model-admin-ui-isComplete-field.png)
2525

2626
## Generate the models locally
2727

2828
1. If you haven’t already done so, click **Next: Test locally in your app** on the Data modeling screen to proceed
29-
2. On the Test locally in your app screen, you will be prompted with on-screen instructions
30-
1. **What type of app are you building?**
31-
1. Platform: **Cross-platform**
32-
2. Framework / Language: **React Native**
33-
3. Click **Next**
34-
2. **(Optional) Create a new app**
35-
1. You should have already created a new React Native app in a previous step, so go ahead and click **Next**
36-
3. **Install Amplify CLI to pull the data model**
37-
1. You should have already installed the Amplify CLI in a previous step
38-
2. Copy and run the command shown in your project root. This command will initialize your current project with Amplify as well as generate the data models you will be using locally
39-
29+
2. **Install Amplify CLI to pull the data model**
30+
1. You should have already installed the Amplify CLI in a previous step
31+
2. Copy and run the command shown in your project root. This command will initialize your current project with Amplify as well as generate the data models you will be using locally
32+
4033
```bash
4134
amplify pull --sandboxId <UUID>
4235
```
43-
36+
4437
4. Make a note of the sandbox id, just in case!
45-
5. Skip the remaining steps as they will be covered by the tutorial and click **Deploy** on the top right
38+
5. As the rest of the steps will be covered by the tutorial, you can skip the remaining steps in Amplify Studio and click **Deploy** on the top right
4639
3. In order to deploy a backend, you will need an AWS account. We will go over this in a later step when we’re ready to sync our app to the cloud. For now, keep the link to this page handy!
4740

4841
At this point, Amplify should have generated several directories and configuration files in your project for you. Let’s take a look at the generated GraphQL schema.

0 commit comments

Comments
 (0)