working readme. . .
-
Project started from: Integrating Firebase authentication into an Expo mobile app Logrocket Tutorial
-
Search React Native Directory for packages
-
Run
npx expo-doctorto determine that the versions of Expo SDK dependencies in your project are compatible with your Expo SDK version. -
You can build the production bundle locally by running
npx expo exportto bypass all of the other build steps. -
Verify that your project builds and runs locally
- You can verify that your project builds on your local machine with the
npx expo run:androidandnpx expo run:ioscommands. For more information, see Android build process and iOS build process. Related:
- You can verify that your project builds on your local machine with the
# Locally compile and run the Android app in release mode
npx expo run:android --variant release
# Locally compile and run the iOS app in release mode
npx expo run:ios --configuration Release
- You can alternatively run a local build with
eas build --local— this command will run a series of steps that is as close as it can be to what runs remotely on the hosted EAS Build service. It will copy your project to a temporary directory and make any necessary changes there. Learn how to set this up and use it for debugging.
Start the development server for your project:
npx expo start
Start your Expo project with production-like settings:
npx expo start --no-dev --minify
When you run this command you are starting the Expo development server with the following characteristics:
It runs in "no-dev" mode, potentially skipping some development-specific checks and optimizations. It minifies the JavaScript code for production use, reducing its size and improving performance.
This command is useful when you want to start your Expo project with production-like settings for testing or building your app for deployment to a production environment.
-
index.jsThe rootindex.jsfile at the root of your React Native Expo project is the entry point for your Expo application. It is responsible for setting up the root component of your app. Here's an explanation of the code with comments:// Import the 'registerRootComponent' function from 'expo' import { registerRootComponent } from 'expo'; // Import the 'App' component from './App' import App from './App'; // Register the 'App' component as the root component of the application registerRootComponent(App);
Here's what each part of this
index.jsfile does:-
import { registerRootComponent } from 'expo';: This line imports theregisterRootComponentfunction from theexpopackage. This function is used to register the root component of your Expo application. -
import App from './App';: This line imports theAppcomponent from the './App' file. TheAppcomponent is typically the main entry point of your Expo app, where you define the overall structure and behavior of your application. -
registerRootComponent(App);: This line registers theAppcomponent as the root component of your Expo application. This means that when your app is launched, it will start by rendering theAppcomponent as the root of your component tree.
The comment provided in the code also explains the purpose of
registerRootComponent. It ensures that whether you load the app in Expo Go (Expo's development app) or in a native build (e.g., an APK or IPA file), the environment is set up appropriately to start your app with the specified root component.In summary, the
index.jsfile is crucial for setting up the initial configuration of your Expo app and specifying the root component that should be rendered when your app is launched. -
-
src/navigation-
index.tsxIn summary, this index.tsx file serves as the entry point for your app's navigation logic, where it checks the user's authentication status using the useAuthentication hook and renders the appropriate navigation stack based on whether the user is authenticated or not.
-
-
At the root
.envfile includes the Firebase SDK setup code. -
Commands
Install Firebase CLI
curl -sL https://firebase.tools | bashLogin to Firebase from terminal
firebase loginList Firebase projects:
firebase projects:listFirebase init
firebase initIf installed emulators you can start them with this command:
firebase emulators:start