Is a quicker way to start with Expo + Firebase projects. It includes:
- based on Expo SDK
40.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
- Create a new project using the firebase starter template.
$ npx create-react-native-app --template https://github.com/expo-community/expo-firebase-starter
- Rename the file
example.firebaseConfig.js
tofirebaseConfig.js
- 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'
};
- Start the project:
yarn ios
-- open on iOSyarn android
-- open on Android
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`)
Main screens:
- Login
- Signup
- 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! ππ