This repository is a demo app based on my article on Expo + React Native Firebase integration - it uses Expo Development Client and Config Plugins to integrate native Firebase into Expo app. Read the article for more details.
This repo was recently updated from Expo SDK 36 to 44, after two years. There's still lots of old code, which may not follow current best practices. This README might not be fully up-to-date too.
Yet another React Native CRUD app, written in TypeScript for demo purposes. Features:
- View product list
- View product details
- Add, edit and delete products
- Language/i18n support
- Google (Firebase) Analytics integration
- User accounts (Firebase auth). Sign in and Sign up support.
- Display to users their own products.
See also Technical Features
Written to show:
- Expo Dev Client and config plugins
- Expo and React Native Firebase integration
- Learn how to CRUD in React Native
For details on the Expo stuff, refer to their docs: Dev Clients/Builds, Config Plugins, React Native Firebase.
- Expo CLI 5.x or newer
- Created Firebase project with Firestore database (unless you use built-in fake API)
- (Recommended) Yarn
- Clone Repo
yarn install
- Set the
ios.bundleIdentifier
andandroid.package
inapp.json
to your custom values, you'll need them in the next step. - Create a Firebase project and download Google Services config files
- Run
yarn android
oryarn ios
. It will build the Expo project, run the bundler and start the app in simulator.
package.json
contains a few run scripts:
start
- Runs just Metro bundler for Expo Dev Client (expo start --dev-client
)android
- Builds Android project and runs it (Requires Android SDK) (expo run:android
)ios
- Builds iOS project and runs it (Requires Xcode) (expo run:ios
)
By default, the Firestore API is selected. To use the in-memory Fake API,
open src/api/index.ts
and then
const Api = new FakeApi();
//const Api = new FirestoreProductsApi();
uncomment the first line, and comment out the second one, as shown above.
- React Native
- Expo SDK 44 - semi-managed worflow - uses prebuild and config plugins
- React Navigation
- Native-base - for UI components
- Redux
- Redux Saga
- Firestore database
- React Native Firebase (Firestore, Analytics, Auth) - for native builds
- i18n-js for language support
- Two implementations of data management API: Firebase Firestore and simple in-memory dictionary based API for demo purposes. Interfaces needed to create custom implementation are provided.
- Support for event-driven APIs (for example Firestore
onSnapshot()
) - Expo Dev Client + prebuilding / config plugins - uses React Native Firebase with Expo
index.js
- React Native main fileApp.tsx
- Expo main file. Redirects tosrc/app.tsx
firebase_credentials.json
- For Expo users - credentials to Firebase JS SDKsrc
- App source codesrc/App.tsx
- Main App componentsrc/api
- Product API interfaces and implementationsFirestore
- Firestore API implementationFake
- FakeApi - simple dictionary based in-memory API impl.
src/components
- React componentssrc/core
- Redux implementation filesactions
- Redux Action definitionsconstants
- names and type names for actionsreducers
sagas
- Side effects for actions.products.saga.ts
- Connects Redux actions and store with API
src/hooks
- custom React hookssrc/i18n
- Internalization / language support filessrc/navigation
- React-navigation route and screen configurationsrc/screens
- Navigation Screen component definitionssrc/utils
- Common utility code__tests__
- Unit tests for project
Information message boxes is spamming too much about statebut I think it's OK for demo purposes