|
| 1 | +# react-native-boilerplate 2022 |
| 2 | + |
| 3 | +## What is React Native Boilerplate |
| 4 | + |
| 5 | +It is a template that you can clone and reuse for every project. It is starting point for React Native application. |
| 6 | + |
| 7 | +## React Native Boilerplate ( 0.67.3 ) |
| 8 | + |
| 9 | +consist of: |
| 10 | + |
| 11 | +- react-native": "0.67.3" |
| 12 | +- react-navigation and its dependencies: -> React navigation 6. |
| 13 | + - @react-navigation/native: "^6.0.8 |
| 14 | + - @react-navigation/native-stack: "^6.5.0" |
| 15 | + - @react-navigation/stack: "^6.1.1" |
| 16 | + - react-native-gesture-handler: "^2.2.0" |
| 17 | + - react-native-screens: "^3.13.0" |
| 18 | + - react-native-tab-view: "^3.1.1" |
| 19 | + - react-native-masked-view/masked-view: "^0.2.6" |
| 20 | + - @react-navigation/bottom-tabs: "^6.2.0" |
| 21 | + - @react-navigation/material-top-tabs: "^6.1.1" |
| 22 | +- redux -> new reduxjs/toolkit : ^1.8.0 |
| 23 | +- react native vector icons: "^9.1.0" |
| 24 | + |
| 25 | +more: check package.json |
| 26 | + |
| 27 | +## Getting Started |
| 28 | + |
| 29 | +1. Clone this repo, `git clone https://github.com/handi-dev/react-native-boilerplate.git <your project name>` |
| 30 | +2. Go to project's root directory, `cd <your project name>` |
| 31 | +3. Remove `.git` folder, `rm -rf .git` |
| 32 | +4. Use [React Native Rename](https://github.com/junedomingo/react-native-rename) to update project name `$ npx react-native-rename <newName>` |
| 33 | +5. Run `npm install` to install dependencies |
| 34 | +6. Run `npx pod-install` from root of your project. |
| 35 | + |
| 36 | + If you got error like: `The version of CocoaPods used to generate the lockfile (x.x.x) is higher than the version of the current executable (x.x.x)`, then you can upgrade your cocoapods version. |
| 37 | + |
| 38 | + If you install cocoapods using homebrew, you can using this command: `brew upgrade cocoapods` if that does not work, try `brew install cocoapods`. |
| 39 | + |
| 40 | + If you previously install using `gem`, then use this command and run on your terminal: `sudo gem install cocoapods`. |
| 41 | + |
| 42 | + make sure your cocoapods version is updated after run that command. |
| 43 | + |
| 44 | + To check your current version of cocoapods, run `pod --version`. |
| 45 | + |
| 46 | + After that, don't forget to execute in your terminal `pod repo update` |
| 47 | + |
| 48 | + And, finally, run `npx pod-install`. Those methods must be solved that problem. |
| 49 | + |
| 50 | + Last method: If All the above steps not work, remove `Podfile.lock` in folder `ios` , and then run `npx pod-install`. |
| 51 | + |
| 52 | +7. Start the packager with `npm start` |
| 53 | +8. Connect your device or use emulator that's installed in your pc |
| 54 | +9. Run the test application: |
| 55 | + |
| 56 | +- On Android: |
| 57 | + - Run `npx react-native run-android` |
| 58 | +- On iOS: |
| 59 | + - Open `npx react-native run-ios` |
| 60 | + |
| 61 | +9. Enjoy!!! |
| 62 | + |
| 63 | +## List of Q & A |
| 64 | + |
| 65 | +#### I got error `Error: spawn ./gradlew EACCES` when run `npx react-native run-android`. |
| 66 | + |
| 67 | +Run this command `chmod 755 android/gradlew` from your root project directory |
| 68 | + |
| 69 | +#### I got error `Error: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.` |
| 70 | + |
| 71 | +- Go to your Project -> Android |
| 72 | +- Create a file local.properties |
| 73 | +- Open the file |
| 74 | +- Paste your Android SDK path depending on the operating system: |
| 75 | + |
| 76 | + - Windows: |
| 77 | + sdk.dir=C:\\Users\\`USERNAME`\\AppData\\Local\\Android\\sdk |
| 78 | + - Linux or MacOS |
| 79 | + sdk.dir=/Users/`USERNAME`/Library/Android/sdk |
| 80 | + |
| 81 | +- Replace `USERNAME` with your PC username |
| 82 | + |
| 83 | +### React Native Build Failed on M1 Macbook Pro / Air |
| 84 | + |
| 85 | +try this solution: [How to Run and Build React Native on Macbook Pro M1 Apple Silicon](https://handi.dev/blog/how-run-react-native-on-macbook-m1-apple-silicon) |
0 commit comments