0
0
React Nativemobile~5 mins

EAS Build (Expo) in React Native

Choose your learning style9 modes available
Introduction

EAS Build helps you create app files that can be installed on phones without needing a computer. It makes building your app easy and fast.

When you want to share your app with friends or testers quickly.
When you need to create app versions for iPhone or Android without setting up complex tools.
When you want to upload your app to app stores like Apple App Store or Google Play.
When you want to build your app in the cloud instead of your own computer.
When you want to automate building your app after making changes.
Syntax
React Native
eas build --platform <android|ios|all> --profile <profile-name>

Replace <android|ios|all> with the platform you want to build for.

--profile lets you choose different build settings defined in eas.json.

Examples
Builds the Android version of your app using the default profile.
React Native
eas build --platform android
Builds the iOS app using the 'production' profile from your eas.json file.
React Native
eas build --platform ios --profile production
Builds both Android and iOS versions of your app at the same time.
React Native
eas build --platform all
Sample App

This simple React Native app shows a welcome message and a button. When you press the button, it shows a popup alert saying the app was built using EAS Build.

React Native
import React from 'react';
import { Text, View, Button, Alert } from 'react-native';

export default function App() {
  return (
    <View style={{flex:1, justifyContent:'center', alignItems:'center'}}>
      <Text style={{fontSize:24, marginBottom:20}}>Welcome to EAS Build Demo</Text>
      <Button
        title="Show Build Info"
        onPress={() => Alert.alert('Build Info', 'This app was built using EAS Build!')}
      />
    </View>
  );
}
OutputSuccess
Important Notes

You need to have an Expo account and be logged in to use EAS Build.

Make sure your eas.json file is set up with build profiles before running build commands.

EAS Build runs in the cloud, so you don't need to install Android Studio or Xcode locally.

Summary

EAS Build lets you build app files for Android and iOS easily in the cloud.

Use the eas build command with platform and profile options.

It helps share your app and prepare it for app stores without complex setup.