- Dependencies
-
Architecture
2.1. Assets
2.2. Components
2.3. Views
2.4. Store
2.5. Navigation
2.6. Services
2.7. Theme
2.8. Environment variables -
How to use ?
3.1. Requirements
3.2. Creating project
3.3. Set up project
3.4. Run project -
Git rules
4.1. Commit prefix
4.2. Branches prefix -
Project environments
5.1. Develop
5.2. Pre-production
5.3. Production - Deployments
- App Center
- Axios
- Flipper
- i18next + react-i18next
- Notifee
- React Query
- React native async storage
- React native device info
- React native firebase
- React navigation
- Reanimated
- Redux
Contains all images and icons of the app. It can also contain fonts files.
Contains generic components with no intelligence (all data are given to them by the props) in order to be as reusable as possible. They are ordered following the atomic design principle (atoms, molecules, organisms, templates)
Contains components corresponding to screens of the application. They contain all the intelligence of the app and load all data that need to be loaded.
We can use Redux to store that either need to be persisted or not. For that, we can use the 5 actions already available (no need to create our own):
- addPersistedData to add a persisted data from the store
const dispatch = useDispatch();
const saveToken = useCallback(
() => dispatch(addPersistedData({key: 'token', value: someValue})),
[dispatch],
);
- removePersistedData to remove a persisted data from the store
const dispatch = useDispatch();
const removeToken = useCallback(
() => dispatch(removePersistedData({key: 'token'})),
[dispatch],
);
- addData to add a not persisted data from the store (it will be reset if the app is closed)
const dispatch = useDispatch();
const saveValue = useCallback(
() => dispatch(addData({key: 'notPersisted', value: someValue})),
[dispatch],
);
- removeData to remove a not persisted data from the store
const dispatch = useDispatch();
const removeValue = useCallback(
() => dispatch(removeData({key: 'notPersisted'})),
[dispatch],
);
- resetStore to clear all the persisted data and come back to the initial state defined in
initialState.js
const dispatch = useDispatch();
const reset = useCallback(
() => dispatch(resetStore()),
[dispatch],
);
You can also get any data from the store with the useSelector
hook :
//For the persisted states
const token = useSelector(state => state.persistedData.token);
//For the others
const token = useSelector(state => state.data.notPersisted);
Contains all the navigators of the app and the Route names definitions.
Contains all API calls and Axios instance.
Centralizes the style of the application (everything is described in another README into the Theme
folder)
All env variables are described in the env.js
file. Here, you need to specify in which environment you are in order to display
the appropriate header in the environment component (useful for tests phases).
Follow the React-Native documentation to set up your environment here
/!\ Follow the guidelines from the React Native CLI QuickStart
tab, without Expo.
npx react-native init <YourProjectName> --template @zolteam/react-native-zolerplate
- Install dependencies:
yarn
`` - Install ios native dependencies:
yarn pod-install
-
In one command window run:
yarn start
to open metro bundler (logs will appear here) -
In another command window run:
-
android:
yarn android
-
ios:
yarn ios
-
Commit should look like this : "[type] description message"
Type must be one of :
- [+] new feature
- [*] iteration
- [#] bug fix
feature : /feature/[feature-name]
hotfix : /hotfix/[ticketNumber-description]
refacto : /refacto/[description]
A component called EnvironmentComponent
is available to let the user know in which environnement the app is running.
It displays a small banner which change color according to env
(red for dev, yellow for staging and green for preprod)
and a button to see current version and build number.
This banner will not be shown in production environment.
Git Branch Name: develop
API URL:
Back-office URL:
How to deploy :
Git Branch Name: preprod
API URL:
Back-office URL:
How to deploy :
Git Branch Name: main
API URL:
Back-office URL:
How to deploy :
First you need to set up appCenter packages and create apps by following this documentation.
Don't forget to change your app secret with the right values in android
and ios
folders.
To deploy the app we will use zol-msappcenter-publish
package.
All steps to use the package is described in its documentation.
More details on app Center set-up here
Deploy with this package will :
- Increase version numbers
- Generate changelogs (useful for the release notes)
- Commit changes and create a version tag
- Push tag and changes to the repo