npx create-react-native-app -t with-typescript
TypeScript is a superset of JavaScript which gives you static types and powerful tooling in Visual Studio Code including autocompletion and useful inline warnings for type errors.
yarn install
yarn web
- Install the CLI:
npm i -g expo-cli
- Create a project:
npx create-react-native-app -t with-typescript
ornpx create-expo-app -t expo-template-blank-typescript
cd
into the project
- Create a blank TypeScript config:
touch tsconfig.json
- Run
yarn start
ornpm run start
to automatically configure TypeScript - Rename files to TypeScript,
.tsx
for React components and.ts
for plain typescript files
💡 You can disable the TypeScript setup in Expo CLI with the environment variable
EXPO_NO_TYPESCRIPT_SETUP=1 expo start
To run your project, navigate to the directory and run one of the following yarn commands.
- yarn android Before you run app on Android emulator, follow This
- yarn ios # you need to use macOS to build the iOS project - use the Expo app if you need to do iOS development without a Mac
- yarn web
- eas build --local
eas.json
{
"cli": {
"version": ">= 3.13.3"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal",
"android": {
"buildType": "apk"
}
},
"production": {}
},
"submit": {
"production": {}
}
}
Build APK
yarn prebuild
# Build manually:
cd android && ./gradlew assembleRelease
# Build with eas-cli:
eas build -p android --profile preview