Saajan / expo-firebase-starter

πŸ”₯βš›οΈπŸ“± Expo + Firebase Starter Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expo-firebase-starter πŸ”₯

Supports Expo iOS Supports Expo Android

Is a quicker way to start with Expo + Firebase projects. It includes:

  • based on Expo SDK 39.x.x
  • navigation using react-navigation 5.x.x
  • Firebase as backend for email auth
  • custom and reusable form components
  • handles different field types in forms
  • handles server errors using Formik
  • Login/Signup form built using Formik & yup
  • show/hide Password Field's visibility πŸ‘
  • uses Context API & checks user's auth state
  • implement Password Reset Screen
  • all components are now functional components and use React Hooks

Installation

  1. Create a new project using the firebase starter template.
$ npx create-react-native-app --template https://github.com/expo-community/expo-firebase-starter
  1. Rename the file example.firebaseConfig.js to firebaseConfig.js
  2. Update firebaseConfig.js with your own configuration, e.g.:
// Rename this file to "firebaseConfig.js" before use
// Replace all Xs with real Firebase API keys

export default {
  apiKey: 'XXXX',
  authDomain: 'XXXX',
  databaseURL: 'XXXX',
  projectId: 'XXXX',
  storageBucket: 'XXXX',
  messagingSenderId: 'XXXX',
  appId: 'XXXX'
};

File Strucutre

Expo Firebase Starter
β”œβ”€β”€ assets ➑️ All static assets
β”œβ”€β”€ components ➑️ All re-suable UI components for form screens
β”‚   └── Firebase ➑️ Firebase related config directory
β”‚       └── firebaseConfig.js ➑️ Firebase API keys
β”‚       └── firebase.js ➑️ Firebase app initialization & authentication helper methods
β”‚   └── Forms ➑️ Reusable form components
β”‚       └── Form.js ➑️ Reusable Form wrapper to apply Formik
β”‚       └── FormButton.js ➑️ Reusable button component that handles form submit using Formik context hook
β”‚       └── FormErrorMessage.js ➑️ Reusable component to display server errors from Firebase
β”‚       └── FormField.js ➑️ Reusable TextInput component
β”‚   └── AppButton.js ➑️ Button component
β”‚   └── AppTextInput.js ➑️ TextInput component
β”‚   └── IconButton.js ➑️ Button with icon only component
β”‚   └── SafeView.js ➑️ SafeAreaView wrapper component
β”‚   └── Spinner.js ➑️ Loading indicator component
β”œβ”€β”€ hooks ➑️ All custom hook components
β”‚   └── useStatusBar.js ➑️ A custom hook based on @react-navigation library to animate the status bar style changes
β”œβ”€β”€ navigation
β”‚   └── AppStack.js ➑️ Protected routes such as Home screen
β”‚   └── AuthStack.js ➑️ Routes such as Login screen, when the user is not authenticated
β”‚   └── AuthUserProvider.js ➑️ An Auth User Context component that shares Firebase user object when logged-in
β”‚   └── navigationTheme.js ➑️ A default theme for navigation components
β”‚   └── Routes.js ➑️ Switch between Auth and App stacks based on Firebase user logged-in state
β”œβ”€β”€ screens
β”‚   └── ForgotPassword.js ➑️ Forgot Password screen component
β”‚   └── HomeScreen.js ➑️ Protected route/screen component
β”‚   └── LoginScreen.js ➑️ Login screen component
β”‚   └── RegisterScreen.js ➑️ Register screen component
β”‚   └── WelcomeScreen.js ➑️ Initial screen component
β”œβ”€β”€ utils
β”‚   └── colors.js ➑️ Default, reusable values across the app
β”œβ”€β”€ App.js ➑️ Entry Point for Mobile apps
β”œβ”€β”€ app.json ➑️ Expo config file
└── babel.config.js ➑️ Babel config (should be using `babel-preset-expo`)

Screens

Main screens:

  • Login
  • Signup
  • Forgot password

Initial Welcome Screen

Successful Signup

Successful Login

Forgot Password

⚠️⚠️⚠️

Expo uses Firebase Web SDK and does not support all Firebase services such as phone auth. If you are looking forward to use those services, please use react-native-firebase in a vanilla react native app.

Here is more on what and why Expo cannot support complete Firebase integration


Built by @amanhimself

Happy Coding! πŸŽ‰πŸŽ‰

About

πŸ”₯βš›οΈπŸ“± Expo + Firebase Starter Kit


Languages

Language:JavaScript 100.0%