You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have an error ECACCES this is not bloking, you can use it even if you have this error.
25
+
:::
26
+
23
27
## Running the project
24
28
25
29
Assuming you have all the requirements installed, you can setup and run the project by running:
26
30
27
31
-`yarn install` to install the dependencies
28
-
- create your [configuration file `App/Config/index.js`](https://github.com/thecodingmachine/react-native-boilerplate/tree/master/template/src/Config) from `index.dev.js` (if you are in dev environment) and fill the missing values
32
+
- create your [configuration file `src/Config/index.js`](https://github.com/thecodingmachine/react-native-boilerplate/tree/master/template/src/Config) from `index.dev.js` (if you are in dev environment) and fill the missing values
To help generate appicons, you can use an online tool like [appicon](https://appicon.co/) to generate for both iOS and Android all icons and image sets.
8
+
9
+
### iOS
10
+
To change the appicon of the iOS application, you need to replace all the content of
Copy file name to clipboardExpand all lines: documentation/docs/3_Guides/3_2_SplashScreenLoadingData.md
+16-56Lines changed: 16 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,11 @@ slug: /SplashScreenLoadingData
3
3
title: Splash screen & loading data
4
4
---
5
5
6
-
🚧 It's a Work In Progress section 🚧
7
-
8
6
In many applications, you need to load data from API before displaying any content.
9
7
To do that, we built a solid navigation based on a splash screen to load data before the content shows, and [inline require](https://reactnative.dev/docs/ram-bundles-inline-requires#inline-requires) to improve performance.
All stores are based on redux-toolkit to simplify the process of API calls by using the `createAsyncThunk` function (hidden by the `buildAction` action which is a store builder function)
126
-
So when the action pass through the middleware thunk, the service `initializeStartupService` is launched.
// Here we load the user 1 for example, but you can for example load the connected user
97
+
awaitdispatch(FetchOne.action(1))
98
+
}),
99
+
reducers:buildReducers({ itemKey:null }), // We do not want to modify some item by default
134
100
}
135
101
```
136
102
137
-
So you can replace the fake call simulated with the Promise by real api calls like this:
138
-
139
-
```javascript
140
-
exportdefaultasync () => {
141
-
constresponse=awaitapi.get(`users/${userId}`)
142
-
returnresponse.data
143
-
}
144
-
```
103
+
All stores are based on redux-toolkit to simplify the process of API calls by using the `createAsyncThunk` function (hidden by the `buildAction` action which is a store builder function).
104
+
So, to load data on splash screen you just have to add dispatched action in the buildAction.
Copy file name to clipboardExpand all lines: documentation/docs/3_Guides/3_3_AddAStore.md
+54-1Lines changed: 54 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,4 +3,57 @@ slug: /AddAStore
3
3
title: Add a store
4
4
---
5
5
6
-
🚧 It's a Work In Progress section 🚧
6
+
🚧 It's a Work In Progress section 🚧
7
+
8
+
## The Architecture
9
+
The root file include the configuration of redux. The two important const are `reducers` and `persistConfig`
10
+
11
+
```javascript
12
+
constreducers=combineReducers({
13
+
startup,
14
+
user,
15
+
})
16
+
17
+
constpersistConfig= {
18
+
key:'root',
19
+
storage: AsyncStorage,
20
+
whitelist: [],
21
+
}
22
+
```
23
+
24
+
`whitelist` in presistConfig could includes store to persist
25
+
26
+
`reducers` should includes all modules
27
+
28
+
## Modules
29
+
30
+
A module is a group of action, state and reducers for a same domain. For example, in the boilerplate there are two modules : `Startup` and `User`
31
+
in each module there is a `index.js` file which combines each store feature (`fetchOne.js` for the User modules) . We decide to separate each features in one file in order to avoid very big incomprehensible files.
32
+
So each feature includes its scoped state, actions and related reducers.
0 commit comments