I'm working on a mid sized react native application with few bridges and redux for state management. The structure which I am using right now works for now. I wanted to know what people out there are using.
Here is the directory structure I typically follow in my react native applications:
. / actions
/constants
-/ actionTypes.js
-/ api.js
/dbstore
/images
/pages
- / appscreens
-/ global
/reducers
/ initialState.js
/ pages
/ rootReducer.js /screens.js
/store
Redux Components:-
There are four folders for redux viz actions,reducers,store and constants. Reducers folder has an initialState file to store initialState of all page level reducers stored in pages folder with reduders folder, Actions folder contains action function definitions, constants folder contains actions constant as well as apis for prod,qa and dev environments while store folder is used to configure all middlewares like redux-think,logger,persist in store depending on dev and prod environments
Application screens:-
The pages folder contains globals folder having components like drawer,custom grids or listviews which might be reused in other app screens while appscreens folder contains specific application screens
Offline app components:
The images and dbstore folder contains assets which I would like to use when application is offline like placeholder to be shown until images are loaded from url or custom icons/fonts not available in react-native-vector-icons package
The structure is heavily inspired from June Domingo's movie app opensourced on github. The entire directory structure sits within app folder in reactnative projects
Sriraman
Software Engineer @ LifeOn24
My React Native apps folder structure looks like
/android /ios /app /components /containers /images /modules /stores /styles /config index.android.js index.ios.jsapp/components- All my own components are in this directoryapp/containers- All my pages are in this directoryapp/images- All imagesapp/modules- All my native modules are in this directoryapp/stores- I'm using MobX for State Management. So, I add all the MobX stores in this directoryapp/styles- All the styles are in this directoryapp/config- All my configurations like database credentials, API base url, dev mode etc., are in this directory