In this lesson, you will learn how to use the app.json file to control your app’s identity and native device settings.
What is the Expo Config File?
When you build a React Native app with Expo, you aren't just writing JavaScript; you are creating a mobile application that needs to talk to the iOS and Android operating systems. The app.json file acts as the "source of truth" for your project’s metadata and native capabilities. Instead of manually editing complicated native files in Xcode or Android Studio, you define your app's behavior here, and Expo handles the heavy lifting.
Defining App Identity and Behavior
Think of app.json as a passport for your application. It contains essential information that the app stores (like the Apple App Store or Google Play Store) need to know, such as your app's name, version, and unique identifier.
Here is a simple example of what this configuration looks like:
{
"expo": {
"name": "My Awesome App",
"slug": "my-awesome-app",
"version": "1.0.0",
"ios": {
"bundleIdentifier": "com.yourname.awesomeapp",
"supportsTablet": true
},
"android": {
"package": "com.yourname.awesomeapp"
},
"orientation": "portrait"
}
}
In this snippet, you define the name that appears on the user's home screen and the slug used for URL identification. The ios and android objects allow you to drill down into platform-specific configurations. For instance, if you want your app to be locked in portrait mode to prevent screen rotation issues, you define that globally. If you need to specify unique package names for the Google Play Store, you do that within the android block.
Whenever you change a setting here, such as the app icon or the splash screen background color, Expo reads this file during the build process to ensure your native binary is generated with exactly the specifications you provided. It keeps your project clean, readable, and consistent across both platforms.
Key Takeaway: The app.json file is your central hub for configuring native project metadata and platform-specific behavior without needing to touch native code.