The React Native code base for the Disciple Tools mobile app.
Production | Development |
---|---|
- Disciple Tools Mobile App Plugin
- OAuth2 plugin (coming soon)
General:
- Offline-First (via dispatch to Redux onAppBackground & persistent FIFO request queue for API writes)
- Aggressive data fetching, preferring to get all vs. pagination (so that data is available offline)
- CNonce: PIN (3 sec)
- (Coming soon) Accessibility (double as Test IDs?)
UI/Framework-specific:
- Functional Components vs. Class
- Modular component design to mirror D.T Post Types and Fields, and dynamically respond to API changes, and support plugins
- Custom Hooks - map well to REST endpoints
- SWR (stale-while-revalidate), also meets requirement for background fetching, onFocus fetching (prevent stale data on refocus of app)
- Redux AND Context - Redux handles any persisted state, and Context is in-memory, runtime app state
- Prefer Skeletons to Spinners, except for Button Actions
- Minimize 3rd party dependencies where possible (eg, implement own Login form validation vs. something like Formik). Purpose: long-term maintenance (since this is an OSS project with volunteers), fewer library preference debates, less app bloat
- SecureStore - use as much as practical
- Component Library: N/A (removed Native Base)
- Abstract service libraries (ie, Expo, SWR, Axios) via Hooks, in case we want to swap for something else later
- Set up Expo
- Clone this repository
- Download the "Expo" app on iOS or Android:
- Run the following commands:
npm install
npm start
-
Run in Simulator:
- Press a │ open Android (Studio): https://docs.expo.dev/workflow/android-studio-emulator/
- Press i | open iOS (XCode): https://docs.expo.dev/workflow/ios-simulator/
-
Run on device (phone) via Expo:
- Scan the QR code above with Expo Go (Android) or the Camera app (iOS), or
- or, manually open Expo app on phone and select appropriate option from under "Development servers"
- (NOTE: Your phone must be on the same local network as the development computer)
-
Recently tested with the following library versions:
- Node v14 or v16 (or should work with latest)
- Expo CLI v5+
Information on the redux setup for managing data: Data Store
Run all tests:
npm run test