Skip to content

Instantly share code, notes, and snippets.

@4sskick
Last active July 24, 2024 06:18
Show Gist options
  • Save 4sskick/e70bdac76816efdb2c362b1200144be4 to your computer and use it in GitHub Desktop.
Save 4sskick/e70bdac76816efdb2c362b1200144be4 to your computer and use it in GitHub Desktop.
React Native Project from Scratch!
- make sure to use nvm, you can read from here (https://www.freecodecamp.org/news/node-version-manager-nvm-install-guide/)
- by the time I write this (30.04.24), react native latest version 0.74
- If you read the documentation guide (https://reactnative.dev/docs/environment-setup?guide=native), need to use minimum version node 18
- I use version node 20, by install using `nvm install 20.12.2`
- then use the downloaded version node, `nvm use 20.12.2`
- don't forget to install yarn, if you're using it `npm install --global yarn`
- all set!!
- ready to setup and start typing `npx react-native@latest init projectName`
- or if you wanna specify the version react native to use add `--version 0.73`
- `npx react-native@latest init projectName --version 0.73`
- wait till finish to install the dependencies
- to run on emulator / device, start by `yarn start` to run metro server
- start with `yarn android` and wait till finished
- ~~~~~OR~~~~~
- if you wanna use the expo by scratch
- start with `npx create-expo-app projectName`, wait until finish
- then `yarn android` it will install the expo go as a sandbox SDK which provided by expo it self
- by the time I write this, expo version already on 50.0.17
- to run on emulator / device, start by `yarn start` to run metro server
GENERATE apk FILE Android Platform (expo)
=========================================
- as we know, when develop using Android expo doesn;t provide the Android and iOS folder
- command `npx expo run:android` as savior!
- look for the existing folder on folder expo has on package.json file, already there script 'expo run:android'
- but when executed by command `yarn android` it doesn't generate the folder Android
- use the `npx expo run:android` instead will behave differently (seems like that CMIIW). It will generate the folder Android
- by having the Android folder, we are able to build locally for generating the .apk file by our custom config gradle
Option 1:
_________
- another options could be done by `npx expo prebuild --platform android` if wanna have Android Folder to access native code
- or `npx expo prebuild --platform ios` if wanna have access native iOS folder
credit: https://blog.swmansion.com/on-device-ai-ml-in-react-native-137918d0331b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment