Learn how to set up a React Native project with TypeScript without Expo or any other Frameworks. Bare-Bone React-Native App gives you full control over native code. This guide we will help you steps by step from installation to creation of your first app.
3 min read.
Published at: 29-09-2024
Building a React Native app with TypeScript gives you strong typing for your code, making it easier to avoid bugs and improve development. While Expo can make the setup quicker, you might want more control over native code or third-party libraries. In this guide, we'll walk through setting up a React Native project with TypeScript without using Expo. We'll use the React Native CLI instead.
Expo is great for getting started quickly, but it has limitations. You can't easily modify native code or use certain third-party libraries that require direct access to the Android or iOS platforms. If you need more flexibility, skipping Expo might be the right choice.
Before you start, make sure you have the following installed on your machine:
You'll also need a basic understanding of TypeScript and React Native.
JAVA_HOME
Points to your Java Development Kit (JDK) installation.
ANDROID_HOME
Points to your Android SDK installation.
ANDROID_SDK
Points to the root directory of your Android SDK.
PATH
Includes paths to the platform-tools and tools directories from the Android SDK, as well as Java binaries.
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues:
To Unistall run this command:
React Native comes with TypeScript by default. To create a new project, run this command:
If you are having trouble with iOS, try to reinstall the dependencies by running:
run this command:
run this command to run your app:
or if u want to run iOS:
alternatively you can run these just by pressing a for Android and i for iOS. After running, npm start.
Now that you have successfully run the app, let's modify it.
Congratulations! You've successfully run and modified your first No Framework React Native app 🎊🎉🎈