Setup React Native Linux Ubuntu / Mint

Install NodeJs dan npm
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
# start nvm
source ~/.nvm/nvm.sh
# download and install Node.js (you may need to restart the terminal)
nvm install 20

Buat project react native
npx react-native init myproject

Intall snap untuk download VS Code (Text Editor)
sudo apt update
sudo apt install snapd

Install VS Code
sudo snap install --classic code

Install plugin di VS Code
Misalnya > React Native Tools, ESLint, Prettier — Code Formatter, React Snippets, Auto Close Tag, Auto Rename Tag, Path Intellisense.

Extensions
react native tools
prettier (setting format on save)
color highlight
babel java script
es7 react/redux/graphql/react-native snippet
React-Native/React/Redux snippet for es6/es7
simple react snippet
npm intellisense
path intellisense
image preview

Cara menjalankan aplikasi
Aktifkan developer mode pada HP android 
Install adb untuk android
- sudo apt install adb
- adb devices
To run your project, navigate to the directory and run one of the following npx commands.
- cd myproject
- npx react-native run-android
some times you need to start Metro Bundler
- npx react-native start

check yout setup with
- npx react-native doctor

✖ Adb - No devices and/or emulators connected. Please create emulator with Android Studio or connect Android device.
 ✓ JDK - Required to compile Java code
 ✓ Android Studio - Required for building and installing your app on Android
 ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
 ✓ Gradlew - Build tool required for Android builds
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 35.0.0

Install android studio on system /opt/
Setting ANDROID_HOME
- sudo nano ~/.bashrc
export ANDROID_HOME=/home/mycomputer/Android/Sdk
export PATH="$PATH":"$ANDROID_HOME/emulator"
export PATH="$PATH":"$ANDROID_HOME/tools"
export PATH="$PATH":"$ANDROID_HOME/tools/bin"
export PATH="$PATH":"$ANDROID_HOME/platform-tools"
// /home/mycomputer/Android/Sdk depend on your sdk directory
install SDK Platform 35 or latest
intall SDK Tools - Android SDK Command Line
run emulator or connect real device

# Install react navigation
npm install @react-navigation/native
npm install @react-navigation/stack
npm install react-native-screens react-native-safe-area-context

# Install React Native Paper
npm install react-native-paper

# Install Axios
npm install axios

Source :

Komentar