new-react-native-boilerplate 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/package.json +1 -1
- package/template/README.md +60 -62
package/README.md
CHANGED
|
@@ -67,6 +67,21 @@ Create a new project with one command:
|
|
|
67
67
|
npx new-react-native-boilerplate
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
To make sure you get the newest version instead of a cached one:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx new-react-native-boilerplate@latest
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or install the CLI globally and run it from anywhere:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install -g new-react-native-boilerplate
|
|
80
|
+
new-react-native-boilerplate
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
> **Moving from `@hardik59/rn-boilerplate`?** That package is deprecated. Use `npx new-react-native-boilerplate` instead. The template and setup steps are the same.
|
|
84
|
+
|
|
70
85
|
The interactive wizard asks for two things:
|
|
71
86
|
|
|
72
87
|
1. **Project name**, for example `MyAwesomeApp`
|
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -1,103 +1,101 @@
|
|
|
1
|
-
This
|
|
1
|
+
This project was created with [**new-react-native-boilerplate**](https://www.npmjs.com/package/new-react-native-boilerplate), a [React Native](https://reactnative.dev) starter with navigation, Redux Toolkit, theming and localization already set up.
|
|
2
|
+
|
|
3
|
+
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before you continue.
|
|
2
4
|
|
|
3
5
|
# Getting Started
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Step 1: Install dependencies
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
The setup wizard already ran this for you. Run it again after you clone the project or change dependencies:
|
|
8
10
|
|
|
9
|
-
```
|
|
10
|
-
yarn
|
|
11
|
+
```sh
|
|
12
|
+
yarn
|
|
13
|
+
yarn asset # link fonts and images
|
|
14
|
+
bundle install # install CocoaPods through Bundler (first time only)
|
|
15
|
+
yarn podinstall # install iOS pods (after native dependency changes)
|
|
11
16
|
```
|
|
12
17
|
|
|
13
|
-
## Step
|
|
18
|
+
## Step 2: Check the `.env` file
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
The wizard creates a `.env` file at the project root. Update the values for your API:
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
```dotenv
|
|
23
|
+
ENV=DEV
|
|
24
|
+
BASE_API_URL=https://dummyjson.com
|
|
25
|
+
IMAGE_URL=https://dev-tn-file-server.s3.ap-south-1.amazonaws.com
|
|
26
|
+
```
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
# Using npm
|
|
21
|
-
npm start
|
|
28
|
+
## Step 3: Start Metro
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
```sh
|
|
24
31
|
yarn start
|
|
25
32
|
```
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
|
|
30
|
-
|
|
31
|
-
### Android
|
|
34
|
+
To see app console logs in the Metro terminal, use this instead:
|
|
32
35
|
|
|
33
36
|
```sh
|
|
34
|
-
|
|
35
|
-
npm run android
|
|
36
|
-
|
|
37
|
-
# OR using Yarn
|
|
38
|
-
yarn android
|
|
37
|
+
yarn start-logs
|
|
39
38
|
```
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
|
|
40
|
+
## Step 4: Build and run your app
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
Keep Metro running, open a new terminal in the project root, and run one of these:
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
bundle install
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Then, and every time you update your native dependencies, run:
|
|
44
|
+
### Android
|
|
52
45
|
|
|
53
46
|
```sh
|
|
54
|
-
|
|
47
|
+
yarn android
|
|
55
48
|
```
|
|
56
49
|
|
|
57
|
-
|
|
50
|
+
### iOS
|
|
58
51
|
|
|
59
52
|
```sh
|
|
60
|
-
# Using npm
|
|
61
|
-
npm run ios
|
|
62
|
-
|
|
63
|
-
# OR using Yarn
|
|
64
53
|
yarn ios
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
|
|
68
|
-
|
|
69
|
-
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
|
|
70
|
-
|
|
71
|
-
## Step 3: Modify your app
|
|
72
54
|
|
|
73
|
-
|
|
55
|
+
# or on a specific simulator
|
|
56
|
+
yarn ios --simulator="iPhone 16 Pro"
|
|
57
|
+
```
|
|
74
58
|
|
|
75
|
-
|
|
59
|
+
If everything is set up correctly, your app opens in the Android Emulator, the iOS Simulator, or on your connected device. You can also build it directly from Android Studio or Xcode.
|
|
76
60
|
|
|
77
|
-
|
|
61
|
+
## Step 5: Modify your app
|
|
78
62
|
|
|
79
|
-
|
|
80
|
-
- **iOS**: Press <kbd>R</kbd> in iOS Simulator.
|
|
63
|
+
Open `src/App.tsx` or any screen in `src/screens/` and make a change. When you save, the app updates automatically through [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
|
|
81
64
|
|
|
82
|
-
|
|
65
|
+
To force a full reload, for example to reset the app's state:
|
|
83
66
|
|
|
84
|
-
|
|
67
|
+
- **Android**: press <kbd>R</kbd> twice, or choose **"Reload"** from the **Dev Menu**. Open it with <kbd>Ctrl</kbd> + <kbd>M</kbd> on Windows and Linux, or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> on macOS.
|
|
68
|
+
- **iOS**: press <kbd>R</kbd> in the iOS Simulator.
|
|
85
69
|
|
|
86
|
-
|
|
70
|
+
# Available Scripts
|
|
87
71
|
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
| Script | Description |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `yarn start` | Start Metro with a cleared cache |
|
|
75
|
+
| `yarn start-logs` | Start Metro and stream app console logs |
|
|
76
|
+
| `yarn android` | Build and run the Android app |
|
|
77
|
+
| `yarn ios` | Build and run the iOS app |
|
|
78
|
+
| `yarn podinstall` | Install iOS CocoaPods through Bundler |
|
|
79
|
+
| `yarn asset` | Link fonts and assets |
|
|
80
|
+
| `yarn test` | Run the Jest test suite |
|
|
81
|
+
| `yarn test:report` | Run tests with coverage and a JUnit report |
|
|
82
|
+
| `yarn lint` | Lint `.ts` and `.tsx` files |
|
|
83
|
+
| `yarn tsc` | Type-check the project |
|
|
84
|
+
| `yarn precommit` | Run the type check and lint in parallel |
|
|
85
|
+
| `yarn android-bundle-release` | Build an Android release bundle |
|
|
86
|
+
| `yarn android-run-release` | Run the Android release variant |
|
|
90
87
|
|
|
91
88
|
# Troubleshooting
|
|
92
89
|
|
|
93
|
-
|
|
90
|
+
- **Pods fail to install:** run `cd ios && bundle exec pod install --repo-update && cd ..`
|
|
91
|
+
- **`gradlew: Permission denied`:** run `chmod 755 android/gradlew`
|
|
92
|
+
- **Stale code or `.env` values:** restart Metro with `yarn start`, which already clears the cache.
|
|
93
|
+
- **Fonts or images missing:** run `yarn asset`, then rebuild the app.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
For anything else, see the React Native [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page or [open an issue](https://github.com/sharmahardik59/RNBoilerplate/issues).
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
# Learn More
|
|
98
98
|
|
|
99
|
-
- [
|
|
100
|
-
- [
|
|
101
|
-
- [Learn the Basics](https://reactnative.dev/docs/getting-started)
|
|
102
|
-
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
|
|
103
|
-
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
|
|
99
|
+
- [new-react-native-boilerplate on GitHub](https://github.com/sharmahardik59/RNBoilerplate): source code, docs and issues.
|
|
100
|
+
- [React Native website](https://reactnative.dev): learn more about React Native.
|
|
101
|
+
- [Learn the Basics](https://reactnative.dev/docs/getting-started): a guided tour of React Native.
|