Selah/frontend
2023-06-20 15:50:25 +09:00
..
SelahReactNativeApp installing react-native 2023-06-20 15:47:00 +09:00
README.md updated readme for local android setup 2023-06-20 15:50:25 +09:00

react native app setup (not using Expo)

REACT NATIVE CLI QUICKSTART (NOT EXPO GO) QUICKSTART

follow setup guide for each specific platform (iOS or Android) and OS (Linux, Windows, MacOS): https://reactnative.dev/docs/environment-setup

  • make sure you have node and npm installed
  • cd to directory where you want this app to be installed
  • create app (already accomplished, keeping for notes):

npx react-native@latest init SelahReactNativeApp

  • select yes for installing react-native packages

NOTE: in VS Code some of the created files might show errors and complain about not being able to detect the babel.config.js file. Add this to your settings.json file in VS Code (Open command pallete: View-> Command Pallete or Ctrl+Shift-P and type "settings"):

    "eslint.workingDirectories": [
        {"mode": "auto"}
    ]

Run the app (Android emulator)

  • make sure your android emulator is running (running API 33 tiramisu per the react-native setup docs)
  • start Metro which is a js bundler that ships with react native. cd into react-native app directory and run:

npx react-native start

select yes to install react-native packages

  • let metro run in its own terminal. Open a new terminal to start the app in an android device:

npx react-native run-android

NOTE: if you get a error: unknown command 'run-android' try this command npm install --save react-native

and try again:

npx react-native run-android

You should have a running react-native app in Android!

TODO: mac/iOS local setup...