Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit 291c647

Browse files
committed
docs: README update
1 parent 5e0ee98 commit 291c647

File tree

8 files changed

+121
-21
lines changed

8 files changed

+121
-21
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
<img alt="React Native Typescript Boilerplate" src="assets/logo.png" width="1050"/>
1+
<img alt="React Native Typescript Redux Boilerplate" src="assets/logo.png" width="1050"/>
22

3-
[![A lot of fundamental features with Typescript support React Native Boilerplate](https://img.shields.io/badge/-A%20lot%20of%20fundamental%20features%20with%20Typescript%20support%20React%20Native%20Boilerplate-orange?style=for-the-badge)](https://github.com/WrathChaos/react-native-typescript-boilerplate)
3+
[![A lot of fundamental features with Typescript support React Native Boilerplate](https://img.shields.io/badge/-A%20lot%20of%20fundamental%20features%20with%20Typescript%20support%20React%20Native%20Boilerplate-orange?style=for-the-badge)](https://github.com/WrathChaos/react-native-typescript-redux-boilerplate)
44

5-
[![npm version](https://img.shields.io/npm/v/react-native-typescript-boilerplate.svg?style=for-the-badge)](https://www.npmjs.com/package/@freakycoder/react-native-typescript-boilerplate)
6-
[![npm](https://img.shields.io/npm/dt/react-native-typescript-boilerplate.svg?style=for-the-badge)](https://www.npmjs.com/package/@freakycoder/react-native-typescript-boilerplate)
5+
[![npm version](https://img.shields.io/npm/v/react-native-typescript-redux-boilerplate.svg?style=for-the-badge)](https://www.npmjs.com/package/@freakycoder/react-native-typescript-redux-boilerplate)
6+
[![npm](https://img.shields.io/npm/dt/react-native-typescript-redux-boilerplate.svg?style=for-the-badge)](https://www.npmjs.com/package/@freakycoder/react-native-typescript-redux-boilerplate)
77
![Platform - Android and iOS](https://img.shields.io/badge/platform-Android%20%7C%20iOS-blue.svg?style=for-the-badge)
88
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
99
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier)
1010

1111
<p align="center">
12-
<img alt="React Native Typescript Boilerplate"
13-
src="assets/react-native-typescript-boilerplate.gif" height="650" />
12+
<img alt="React Native Typescript Redux Boilerplate"
13+
src="assets/react-native-typescript-redux-boilerplate.gif" height="650" />
1414
</p>
1515

1616
# 🥳 Version 3.3+
@@ -80,7 +80,7 @@ We're proudly announce that `Version 3` is here!
8080
To create a new project using the barebone boilerplate:
8181

8282
```sh
83-
git clone https://github.com/WrathChaos/react-native-typescript-boilerplate.git my-app-name
83+
git clone https://github.com/WrathChaos/react-native-typescript-redux-boilerplate.git my-app-name
8484
```
8585

8686
# 🎯 Step By Step Guide
@@ -165,9 +165,14 @@ sdk.dir=/Users/username/Library/Android/sdk
165165

166166
- [Components](./docs/components.md)
167167
- [Axios Hooks](./docs/axios-hooks.md)
168+
- [Custom Redux](./docs/redux.md)
168169
- [Event Emitter Usage](./docs/event-emitter.md)
169170
- [Project Structure](./docs/project-structure.md)
170171

172+
## Are you looking for Non-Redux Version?
173+
174+
### [React Native Typescript Boilerplate](https://github.com/WrathChaos/react-native-typescript-boilerplate)
175+
171176
# 🔮 Roadmap
172177

173178
- [x] ~~LICENSE~~
@@ -177,7 +182,8 @@ sdk.dir=/Users/username/Library/Android/sdk
177182
- [x] ~~Implement the native splash screen with [react-native-splash-screen](https://github.com/crazycodeboy/react-native-splash-screen)~~
178183
- [x] ~~Better and separated documentation~~
179184
- [x] ~~Axios Hooks~~
180-
- [ ] React Native New Architecture
185+
- [x] ~~React Native New Architecture~~
186+
- [x] ~~`Redux` Fork Version~~
181187
- [ ] `Babel Plugin Module Resolver` Documentation with Example
182188
- [ ] `Navigation Service` Documentation with Example
183189
- [ ] `Localization` Documentation with Example
@@ -186,7 +192,6 @@ sdk.dir=/Users/username/Library/Android/sdk
186192
- [ ] `Website` for the boilerplate
187193
- [ ] Splash Screen Documentation
188194
- [ ] `Detox E2E` Integration Fork Version
189-
- [ ] `Redux` Fork Version
190195
- [ ] `MobX State Tree` Fork Version
191196
- [ ] Write an article about the lib on `Medium`
192197
- [ ] Write an article about the lib on `DevTo`
@@ -203,4 +208,4 @@ FreakyCoder, kurayogun@gmail.com
203208

204209
## License
205210

206-
React Native Typescript Boilerplate is available under the MIT license. See the LICENSE file for more info.
211+
React Native Typescript Redux Boilerplate is available under the MIT license. See the LICENSE file for more info.

assets/redux.png

42 KB
Loading

docs/redux.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<img alt="React Native Typescript Boilerplate" src="../assets/logo.png" width="1050"/>
2+
<img alt="React Native Typescript Boilerplate" src="../assets/redux.png" />
3+
4+
# 🍾 [Redux](https://redux.js.org/) Custom Service Usage
5+
6+
## Features
7+
8+
- Everything already setup for redux usage
9+
- Zero configuration, but configurable if needed
10+
- If you want to change / learn something about the redux configuration please check the [Redux Service](../src/services/redux)
11+
- There is a basic example which is `User`
12+
13+
14+
## Basic Example
15+
16+
- Create your own redux reducer for each of them: [UserReducers](./src/services/redux/user/UserReducers.ts)
17+
- Write your own redux usage service: [UserService](./src/screens/home/services/userService.ts)
18+
- Set a data to redux via User Service: [User Redux Set Example](./src/screens/home/HomeScreen.tsx)
19+
```jsx
20+
UserService.setUserData(mockUserData);
21+
```
22+
23+
- Fetch a data with `react-redux`'s `useSelector` hook [User Redux Fetch Data](./src/screens/profile/ProfileScreen.tsx)
24+
25+
```jsx
26+
const userData = useSelector(
27+
(state: MainState) => state.user.userData as IUser,
28+
);
29+
```
30+
31+
32+
## Side Note
33+
34+
Of course, you can change the whole Redux usage structure. This one is just an example 👊

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "react-native-typescript-boilerplate",
2+
"name": "react-native-typescript-redux-boilerplate",
33
"version": "3.3.0",
44
"description": "React Native Template/Boilerplate for awesome applications, using Typescript with a lot of built-in ready features.",
55
"dependencies": {

src/screens/home/services/userService.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { IUser } from "@services/models/index";
1+
import { IUser } from "@services/models";
22
import { ReduxServices } from "@services/redux/ReduxService";
3-
import {
4-
setUserData,
5-
resetUserData,
6-
} from "../../../services/redux/user/UserReducers";
3+
import { setUserData, resetUserData } from "@services/redux/user/UserReducers";
74

85
class UserServiceState {
96
setUserData = (userData: IUser) => {

src/screens/profile/ProfileScreen.style.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { ExtendedTheme } from "@react-navigation/native";
2-
import { ViewStyle, StyleSheet } from "react-native";
2+
import { ViewStyle, StyleSheet, TextStyle } from "react-native";
3+
import { ScreenWidth } from "@freakycoder/react-native-helpers";
34

45
interface Style {
56
container: ViewStyle;
7+
profileContainer: ViewStyle;
8+
profileDetailContainer: ViewStyle;
9+
cardStyle: ViewStyle;
10+
valueTextStyle: TextStyle;
611
}
712

813
export default (theme: ExtendedTheme) => {
@@ -14,5 +19,34 @@ export default (theme: ExtendedTheme) => {
1419
alignItems: "center",
1520
justifyContent: "center",
1621
},
22+
profileContainer: {
23+
marginTop: 32,
24+
alignItems: "center",
25+
justifyContent: "center",
26+
},
27+
profileDetailContainer: {
28+
marginTop: 16,
29+
width: ScreenWidth * 0.9,
30+
flexDirection: "row",
31+
alignItems: "center",
32+
justifyContent: "space-around",
33+
},
34+
cardStyle: {
35+
minWidth: ScreenWidth * 0.4,
36+
height: 75,
37+
alignItems: "center",
38+
justifyContent: "center",
39+
backgroundColor: colors.background,
40+
shadowRadius: 8,
41+
shadowOpacity: 0.3,
42+
shadowColor: "#757575",
43+
shadowOffset: {
44+
width: 0,
45+
height: 3,
46+
},
47+
},
48+
valueTextStyle: {
49+
marginTop: 8,
50+
},
1751
});
1852
};

src/screens/profile/ProfileScreen.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import React, { useMemo } from "react";
22
import { View } from "react-native";
33
import { useTheme } from "@react-navigation/native";
4+
import { useSelector } from "react-redux";
45
/**
56
* ? Local Imports
67
*/
78
import createStyles from "./ProfileScreen.style";
89
import Text from "@shared-components/text-wrapper/TextWrapper";
9-
import { useSelector } from "react-redux";
1010
import { MainState } from "@services/redux/RootReducer";
1111
import { IUser } from "@services/models";
12+
import { capitalizeFirstLetter } from "@utils";
1213

1314
interface ProfileScreenProps {}
1415

@@ -25,8 +26,37 @@ const ProfileScreen: React.FC<ProfileScreenProps> = () => {
2526
<Text h1 color={colors.text}>
2627
Profile
2728
</Text>
28-
<Text>{userData.username}</Text>
29-
<Text>{userData.email}</Text>
29+
<Text h6>Data is coming from redux itself</Text>
30+
<View style={styles.profileContainer}>
31+
<View style={styles.profileDetailContainer}>
32+
<View style={styles.cardStyle}>
33+
<Text h5>User name</Text>
34+
<Text h3 bold style={styles.valueTextStyle}>
35+
{userData.username}
36+
</Text>
37+
</View>
38+
<View style={styles.cardStyle}>
39+
<Text h5>Email</Text>
40+
<Text h6 bold style={styles.valueTextStyle}>
41+
{userData.email}
42+
</Text>
43+
</View>
44+
</View>
45+
<View style={styles.profileDetailContainer}>
46+
<View style={styles.cardStyle}>
47+
<Text h5>Full name</Text>
48+
<Text h3 bold style={styles.valueTextStyle}>
49+
{userData.fullname}
50+
</Text>
51+
</View>
52+
<View style={styles.cardStyle}>
53+
<Text h5>Social Type</Text>
54+
<Text h3 bold style={styles.valueTextStyle}>
55+
{capitalizeFirstLetter(userData.socialType)}
56+
</Text>
57+
</View>
58+
</View>
59+
</View>
3060
</View>
3161
);
3262
};

src/services/redux/user/UserReducers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit";
22
/**
33
* ? Local Imports
44
*/
5-
import { IUser } from "@services/models/index";
5+
import { IUser } from "@services/models";
66

77
export interface InitialState {
88
userData: IUser | null;

0 commit comments

Comments
 (0)