@ccrf01/react-native-template 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/.github/workflows/npm-publish.yml +28 -0
  2. package/.vscode/settings.json +15 -0
  3. package/README.md +58 -0
  4. package/package.json +16 -0
  5. package/template/.bundle/config +2 -0
  6. package/template/.env.development +1 -0
  7. package/template/.env.production +1 -0
  8. package/template/.eslintrc.js +392 -0
  9. package/template/.java-version +1 -0
  10. package/template/.prettierrc.js +5 -0
  11. package/template/.ruby-version +1 -0
  12. package/template/.watchmanconfig +1 -0
  13. package/template/Gemfile +23 -0
  14. package/template/Gemfile.lock +330 -0
  15. package/template/README.md +97 -0
  16. package/template/ReactotronConfig.js +17 -0
  17. package/template/__tests__/App.test.tsx +13 -0
  18. package/template/_gitignore +75 -0
  19. package/template/_node-version +1 -0
  20. package/template/android/app/build.gradle +162 -0
  21. package/template/android/app/debug.keystore +0 -0
  22. package/template/android/app/proguard-rules.pro +10 -0
  23. package/template/android/app/src/debug/AndroidManifest.xml +9 -0
  24. package/template/android/app/src/main/AndroidManifest.xml +26 -0
  25. package/template/android/app/src/main/java/com/projectname/MainActivity.kt +30 -0
  26. package/template/android/app/src/main/java/com/projectname/MainApplication.kt +27 -0
  27. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  28. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  29. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  30. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  31. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  32. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  33. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  34. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  35. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  36. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  37. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  38. package/template/android/app/src/main/res/values/strings.xml +3 -0
  39. package/template/android/app/src/main/res/values/styles.xml +9 -0
  40. package/template/android/build.gradle +37 -0
  41. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  42. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  43. package/template/android/gradle.properties +48 -0
  44. package/template/android/gradlew +251 -0
  45. package/template/android/gradlew.bat +99 -0
  46. package/template/android/keystore/keystore.properties +4 -0
  47. package/template/android/settings.gradle +6 -0
  48. package/template/android/version.properties +2 -0
  49. package/template/app.json +4 -0
  50. package/template/babel.config.js +38 -0
  51. package/template/fastlane/Fastfile +136 -0
  52. package/template/fastlane/Pluginfile +9 -0
  53. package/template/fastlane/README.md +46 -0
  54. package/template/index.js +9 -0
  55. package/template/ios/.xcode.env +11 -0
  56. package/template/ios/Podfile +35 -0
  57. package/template/ios/Podfile.lock +3669 -0
  58. package/template/ios/ProjectName/AppDelegate.swift +48 -0
  59. package/template/ios/ProjectName/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  60. package/template/ios/ProjectName/Images.xcassets/Contents.json +6 -0
  61. package/template/ios/ProjectName/Info.plist +66 -0
  62. package/template/ios/ProjectName/LaunchScreen.storyboard +47 -0
  63. package/template/ios/ProjectName/PrivacyInfo.xcprivacy +47 -0
  64. package/template/ios/ProjectName.xcodeproj/project.pbxproj +482 -0
  65. package/template/ios/ProjectName.xcodeproj/xcshareddata/xcschemes/ProjectName.xcscheme +88 -0
  66. package/template/ios/ProjectName.xcworkspace/contents.xcworkspacedata +10 -0
  67. package/template/jest.config.js +3 -0
  68. package/template/metro.config.js +20 -0
  69. package/template/package-lock.json +17073 -0
  70. package/template/package.json +156 -0
  71. package/template/src/@types/emotion.d.ts +12 -0
  72. package/template/src/@types/env.d.ts +3 -0
  73. package/template/src/@types/redux-persist-transform-immutable.d.ts +1 -0
  74. package/template/src/@types/typing.d.ts +17 -0
  75. package/template/src/AppContainer.tsx +109 -0
  76. package/template/src/assets/images/143.png +0 -0
  77. package/template/src/assets/index.ts +13 -0
  78. package/template/src/components/basic/BackButton/index.tsx +34 -0
  79. package/template/src/components/basic/Body/index.tsx +68 -0
  80. package/template/src/components/basic/Button/index.tsx +181 -0
  81. package/template/src/components/basic/Button/utils.ts +78 -0
  82. package/template/src/components/basic/ButtonGroup/index.tsx +182 -0
  83. package/template/src/components/basic/Card/index.tsx +3 -0
  84. package/template/src/components/basic/Container/index.tsx +38 -0
  85. package/template/src/components/basic/Content/index.tsx +87 -0
  86. package/template/src/components/basic/DropDown/index.tsx +354 -0
  87. package/template/src/components/basic/ExpandableOverlay/index.tsx +113 -0
  88. package/template/src/components/basic/Header/index.tsx +216 -0
  89. package/template/src/components/basic/Header/styles.ts +0 -0
  90. package/template/src/components/basic/Icons/index.tsx +131 -0
  91. package/template/src/components/basic/InputLabel/index.tsx +19 -0
  92. package/template/src/components/basic/LoadingOverlay/index.tsx +68 -0
  93. package/template/src/components/basic/MaterialTextInput/index.tsx +153 -0
  94. package/template/src/components/basic/NumberInput/index.tsx +53 -0
  95. package/template/src/components/basic/Picker/PickerContext.ts +7 -0
  96. package/template/src/components/basic/Picker/PickerHeader.tsx +130 -0
  97. package/template/src/components/basic/Picker/PickerItem.tsx +105 -0
  98. package/template/src/components/basic/Picker/PickerItemsList.tsx +135 -0
  99. package/template/src/components/basic/Picker/PickerPresenter.ts +54 -0
  100. package/template/src/components/basic/Picker/hooks/useImperativePickerHandle.ts +27 -0
  101. package/template/src/components/basic/Picker/hooks/usePickerLabel.ts +74 -0
  102. package/template/src/components/basic/Picker/hooks/usePickerSearch.ts +37 -0
  103. package/template/src/components/basic/Picker/hooks/usePickerSelection.ts +57 -0
  104. package/template/src/components/basic/Picker/index.tsx +284 -0
  105. package/template/src/components/basic/Picker/types.tsx +229 -0
  106. package/template/src/components/basic/PressableOpacity/index.tsx +20 -0
  107. package/template/src/components/basic/RootDialog/Dialog.tsx +246 -0
  108. package/template/src/components/basic/RootDialog/Manager.tsx +110 -0
  109. package/template/src/components/basic/RootDialog/animations/Animation.ts +29 -0
  110. package/template/src/components/basic/RootDialog/animations/FadeAnimation.ts +40 -0
  111. package/template/src/components/basic/RootDialog/animations/ScaleAnimation.ts +37 -0
  112. package/template/src/components/basic/RootDialog/animations/SlideAnimation.ts +89 -0
  113. package/template/src/components/basic/RootDialog/components/Backdrop.tsx +60 -0
  114. package/template/src/components/basic/RootDialog/components/BaseDialog.tsx +564 -0
  115. package/template/src/components/basic/RootDialog/components/BottomDialog.tsx +32 -0
  116. package/template/src/components/basic/RootDialog/components/DialogButton.tsx +87 -0
  117. package/template/src/components/basic/RootDialog/components/DialogContent.tsx +26 -0
  118. package/template/src/components/basic/RootDialog/components/DialogContext.tsx +8 -0
  119. package/template/src/components/basic/RootDialog/components/DialogFooter.tsx +42 -0
  120. package/template/src/components/basic/RootDialog/components/DialogTitle.tsx +53 -0
  121. package/template/src/components/basic/RootDialog/components/DraggableView.tsx +271 -0
  122. package/template/src/components/basic/RootDialog/index.ts +21 -0
  123. package/template/src/components/basic/RootDialog/type.ts +102 -0
  124. package/template/src/components/basic/Text/index.tsx +8 -0
  125. package/template/src/components/basic/index.ts +35 -0
  126. package/template/src/configs/constants/type/APIStatus.type.ts +8 -0
  127. package/template/src/configs/constants/type/Locale.type.ts +7 -0
  128. package/template/src/configs/constants/type/StorageKey.type.ts +7 -0
  129. package/template/src/configs/constants/type/ThemeType.type.ts +6 -0
  130. package/template/src/configs/constants/type/index.ts +11 -0
  131. package/template/src/configs/index.ts +22 -0
  132. package/template/src/contexts/ThemeContext.ts +6 -0
  133. package/template/src/hooks/useAppLoading.ts +26 -0
  134. package/template/src/hooks/useAppState.ts +36 -0
  135. package/template/src/hooks/useArray.ts +47 -0
  136. package/template/src/hooks/useAsync.ts +42 -0
  137. package/template/src/hooks/useAsyncStorage.ts +41 -0
  138. package/template/src/hooks/useBoolean.ts +21 -0
  139. package/template/src/hooks/useBuildTheme.ts +249 -0
  140. package/template/src/hooks/useCountDown.ts +111 -0
  141. package/template/src/hooks/useCounter.ts +27 -0
  142. package/template/src/hooks/useDebounce.ts +25 -0
  143. package/template/src/hooks/useDebouncedValidate.ts +32 -0
  144. package/template/src/hooks/useDebugInformation.ts +38 -0
  145. package/template/src/hooks/useDeviceToken.ts +20 -0
  146. package/template/src/hooks/useEncryptedStorage.ts +41 -0
  147. package/template/src/hooks/useFontFamily.ts +13 -0
  148. package/template/src/hooks/useHttp.ts +18 -0
  149. package/template/src/hooks/useInterval.ts +24 -0
  150. package/template/src/hooks/useIsForeground.ts +17 -0
  151. package/template/src/hooks/useMMKVStorage.ts +0 -0
  152. package/template/src/hooks/usePrevious.ts +12 -0
  153. package/template/src/hooks/useRenderCount.ts +10 -0
  154. package/template/src/hooks/useTheme.ts +17 -0
  155. package/template/src/hooks/useTimeCountDown.ts +91 -0
  156. package/template/src/index.tsx +65 -0
  157. package/template/src/infrastructures/NetClient/AbstractClient.ts +66 -0
  158. package/template/src/infrastructures/NetClient/ApiResponse.ts +16 -0
  159. package/template/src/infrastructures/NetClient/ApisauceClient.ts +76 -0
  160. package/template/src/infrastructures/NetClient/AxiosClient.ts +80 -0
  161. package/template/src/infrastructures/NetClient/FetchNetClient.ts +120 -0
  162. package/template/src/infrastructures/NetClient/config.ts +3 -0
  163. package/template/src/infrastructures/NetClient/interfaces/INetClient.ts +6 -0
  164. package/template/src/infrastructures/Storage/IStorage.ts +7 -0
  165. package/template/src/infrastructures/Storage/MMKVStorage.ts +41 -0
  166. package/template/src/infrastructures/common/Timeout.ts +27 -0
  167. package/template/src/infrastructures/common/colorUtils.ts +82 -0
  168. package/template/src/infrastructures/common/dateUtils.ts +39 -0
  169. package/template/src/infrastructures/common/logger.ts +115 -0
  170. package/template/src/locales/en-US/general.json +26 -0
  171. package/template/src/locales/en-US/index.ts +9 -0
  172. package/template/src/locales/en-US/screens.json +4 -0
  173. package/template/src/locales/en-US/setting.json +3 -0
  174. package/template/src/locales/i18n.ts +109 -0
  175. package/template/src/locales/zh-TW/general.json +26 -0
  176. package/template/src/locales/zh-TW/index.ts +9 -0
  177. package/template/src/locales/zh-TW/screens.json +4 -0
  178. package/template/src/locales/zh-TW/setting.json +3 -0
  179. package/template/src/models/index.ts +5 -0
  180. package/template/src/models/request.model.ts +50 -0
  181. package/template/src/navigators/DrawerNav/DrawerContent.tsx +66 -0
  182. package/template/src/navigators/DrawerNav/DrawerItem.tsx +261 -0
  183. package/template/src/navigators/DrawerNav/index.tsx +39 -0
  184. package/template/src/navigators/DrawerNav/props.ts +12 -0
  185. package/template/src/navigators/DrawerNav/types.ts +8 -0
  186. package/template/src/navigators/MainBottomTabNav/index.tsx +83 -0
  187. package/template/src/navigators/MainBottomTabNav/props.ts +16 -0
  188. package/template/src/navigators/MainBottomTabNav/types.ts +6 -0
  189. package/template/src/navigators/RootStack.tsx +43 -0
  190. package/template/src/navigators/index.tsx +40 -0
  191. package/template/src/navigators/props.ts +14 -0
  192. package/template/src/navigators/types.ts +18 -0
  193. package/template/src/navigators/utils.ts +68 -0
  194. package/template/src/redux/api/api.ts +41 -0
  195. package/template/src/redux/reducers/appSlice.ts +26 -0
  196. package/template/src/redux/reducers/index.ts +21 -0
  197. package/template/src/redux/reducers/nonPersistSlice.ts +51 -0
  198. package/template/src/redux/reducers/settingSlice.ts +48 -0
  199. package/template/src/redux/reducers/themeSlice.ts +55 -0
  200. package/template/src/redux/saga/index.ts +5 -0
  201. package/template/src/redux/saga/settingSaga.ts +21 -0
  202. package/template/src/redux/selectors/app.ts +9 -0
  203. package/template/src/redux/selectors/nonPersist.ts +23 -0
  204. package/template/src/redux/selectors/setting.ts +29 -0
  205. package/template/src/redux/selectors/theme.ts +13 -0
  206. package/template/src/redux/store/index.ts +79 -0
  207. package/template/src/redux/store/types.d.ts +5 -0
  208. package/template/src/screens/Home/index.tsx +146 -0
  209. package/template/src/screens/Settings/components/Item.tsx +45 -0
  210. package/template/src/screens/Settings/index.tsx +97 -0
  211. package/template/src/screens/Splash/index.tsx +53 -0
  212. package/template/src/services/Dialogs.tsx +226 -0
  213. package/template/src/services/PermissionCheck.ts +257 -0
  214. package/template/src/theme/Common.ts +48 -0
  215. package/template/src/theme/Fonts.ts +196 -0
  216. package/template/src/theme/Gutters.ts +63 -0
  217. package/template/src/theme/Icons.ts +28 -0
  218. package/template/src/theme/Images.ts +13 -0
  219. package/template/src/theme/Layout.ts +106 -0
  220. package/template/src/theme/Variables.ts +167 -0
  221. package/template/src/theme/components/Buttons.ts +37 -0
  222. package/template/src/theme/index.ts +8 -0
  223. package/template/src/theme/metrics.ts +57 -0
  224. package/template/src/theme/themes/default_dark/Images.ts +7 -0
  225. package/template/src/theme/themes/default_dark/Variables.ts +84 -0
  226. package/template/src/theme/themes/default_dark/index.ts +2 -0
  227. package/template/src/theme/themes/index.ts +8 -0
  228. package/template/src/theme/types.ts +152 -0
  229. package/template/src/utils/encrypt-helper.ts +118 -0
  230. package/template/src/utils/index.ts +76 -0
  231. package/template/src/utils/sys-info-data.ts +17 -0
  232. package/template/tsconfig.json +44 -0
  233. package/template.config.js +8 -0
@@ -0,0 +1,196 @@
1
+ /**
2
+ * This file contains all application's style relative to fonts
3
+ */
4
+ import { StyleSheet } from 'react-native'
5
+
6
+ import logger from '@/infrastructures/common/logger'
7
+ import {
8
+ FontScale,
9
+ MD3Fonts,
10
+ StyleType,
11
+ ThemeFonts,
12
+ ThemeFontSize,
13
+ ThemeVariables,
14
+ } from '@/theme/types'
15
+ import { normalize } from '@/utils'
16
+
17
+ type FontWithSizeName = 'text' | 'buttonText' | 'textInput'
18
+ export type FontWithSize = {[key in FontWithSizeName]: StyleType}
19
+ export type FontAlign = {
20
+ textCenter: StyleType
21
+ textVCenter: StyleType
22
+ textJustify: StyleType
23
+ textLeft: StyleType
24
+ textRight: StyleType
25
+ }
26
+
27
+ export type MD3FontType = {
28
+ display: StyleType
29
+ headline: StyleType
30
+ title: StyleType
31
+ label: StyleType
32
+ body: StyleType
33
+ }
34
+
35
+ type CustomFontName =
36
+ 'textShadow'|
37
+ 'settingText'
38
+
39
+ type CustomFontType = {[key in CustomFontName]: StyleType}
40
+ export type FontType = MD3FontType & CustomFontType
41
+
42
+ export type MergeThemeFonts = ThemeFonts & {
43
+ // titleFontStyle: TextStyle
44
+ }
45
+
46
+ /**
47
+ *
48
+ * @param Theme can be spread like {Colors, Gutters, Layout, Common, ...args}
49
+ * @return {*}
50
+ * @param fontScale
51
+ */
52
+ export default ({ Colors: colors, ScaledFontSize: scaledFontSize }: ThemeVariables, fontScale: FontScale): MergeThemeFonts => {
53
+ const fontSize = scaledFontSize[fontScale]
54
+ const md3Fonts: MD3Fonts = {
55
+ displaySmall: {
56
+ fontSize: scaledFontSize[FontScale.SMALL].xxlarge,
57
+ letterSpacing: 0,
58
+ lineHeight: 44,
59
+ },
60
+ displayMedium: {
61
+ fontSize: scaledFontSize[FontScale.MEDIUM].xxlarge,
62
+ letterSpacing: 0,
63
+ lineHeight: 52,
64
+ },
65
+ displayLarge: {
66
+ fontSize: scaledFontSize[FontScale.LARGE].xxlarge,
67
+ letterSpacing: 0,
68
+ lineHeight: 64,
69
+ },
70
+ headlineSmall: {
71
+ fontSize: scaledFontSize[FontScale.SMALL].xlarge,
72
+ letterSpacing: 0,
73
+ fontWeight: '400',
74
+ lineHeight: 32,
75
+ },
76
+ headlineMedium: {
77
+ fontSize: scaledFontSize[FontScale.MEDIUM].xlarge,
78
+ fontWeight: '400',
79
+ letterSpacing: 0,
80
+ lineHeight: 36,
81
+ },
82
+ headlineLarge: {
83
+ fontSize: scaledFontSize[FontScale.LARGE].xlarge,
84
+ fontWeight: '400',
85
+ letterSpacing: 0,
86
+ lineHeight: 44,
87
+ },
88
+ titleSmall: { fontSize: scaledFontSize[FontScale.SMALL].large, fontWeight: 'bold' },
89
+ titleMedium: { fontSize: scaledFontSize[FontScale.MEDIUM].large, fontWeight: 'bold' },
90
+ titleLarge: { fontSize: scaledFontSize[FontScale.LARGE].large, fontWeight: 'bold' },
91
+ labelSmall: { fontSize: scaledFontSize[FontScale.SMALL].small },
92
+ labelMedium: { fontSize: scaledFontSize[FontScale.MEDIUM].small },
93
+ labelLarge: { fontSize: scaledFontSize[FontScale.LARGE].small },
94
+ bodySmall: { fontSize: scaledFontSize[FontScale.SMALL].medium },
95
+ bodyMedium: { fontSize: normalize(scaledFontSize[FontScale.MEDIUM].medium) },
96
+ bodyLarge: { fontSize: scaledFontSize[FontScale.LARGE].medium },
97
+ default: { fontSize: scaledFontSize[FontScale.MEDIUM].medium },
98
+ }
99
+
100
+ return StyleSheet.create<ThemeFonts & FontAlign & MD3Fonts>({
101
+ display: {
102
+ fontSize: fontSize.xxlarge,
103
+ fontWeight: '400',
104
+ },
105
+ headline: {
106
+ fontSize: fontSize.xlarge,
107
+ fontWeight: '400',
108
+ },
109
+ title: {
110
+ fontSize: fontSize.large,
111
+ fontWeight: '500',
112
+ },
113
+ label: {
114
+ fontSize: fontSize.small,
115
+ fontWeight: '500',
116
+ },
117
+ body: {
118
+ fontSize: fontSize.medium,
119
+ fontWeight: '400',
120
+ },
121
+ textSmall: {
122
+ fontSize: fontSize.small,
123
+ color: colors.text,
124
+ },
125
+ textMedium: {
126
+ fontSize: fontSize.medium,
127
+ color: colors.text,
128
+ },
129
+ textLarge: {
130
+ fontSize: fontSize.large,
131
+ color: colors.text,
132
+ },
133
+ textXlarge: {
134
+ fontSize: fontSize.xlarge,
135
+ color: colors.text,
136
+ },
137
+ textXxlarge: {
138
+ fontSize: fontSize.xxlarge,
139
+ color: colors.text,
140
+ },
141
+ buttonTextSmall: {
142
+ fontSize: fontSize.small,
143
+ },
144
+ buttonTextMedium: {
145
+ fontSize: fontSize.medium,
146
+ },
147
+ buttonTextLarge: {
148
+ fontSize: fontSize.large,
149
+ },
150
+ buttonTextXlarge: {
151
+ fontSize: fontSize.xlarge,
152
+ },
153
+ buttonTextXxlarge: {
154
+ fontSize: fontSize.xxlarge,
155
+ },
156
+ textInputSmall: {
157
+ fontSize: fontSize.small - 2,
158
+ },
159
+ textInputMedium: {
160
+ fontSize: fontSize.medium - 2,
161
+ },
162
+ textInputLarge: {
163
+ fontSize: fontSize.large - 2,
164
+ },
165
+ textInputXlarge: {
166
+ fontSize: fontSize.xlarge - 2,
167
+ },
168
+ textInputXxlarge: {
169
+ fontSize: fontSize.xxlarge - 2,
170
+ },
171
+ textCenter: { textAlign: 'center' },
172
+ textVCenter: { textAlignVertical: 'center' },
173
+ textJustify: { textAlign: 'justify' },
174
+ textLeft: { textAlign: 'left' },
175
+ textRight: { textAlign: 'right' },
176
+ ...md3Fonts,
177
+
178
+ // Custom Font
179
+ textShadow: {
180
+ color: '#fff',
181
+ textShadowColor: 'rgba(0, 0, 0, 0.75)',
182
+ textShadowOffset: { width: 1, height: 1 },
183
+ textShadowRadius: 2,
184
+ },
185
+ settingText: {
186
+ fontSize: normalize(20),
187
+ fontWeight: '600',
188
+ },
189
+ })
190
+
191
+ // return Object.assign(styles, {
192
+ // bodyFontStyle,
193
+ // buttonFontStyle,
194
+ // titleFontStyle,
195
+ // }) as MergeThemeFonts
196
+ }
@@ -0,0 +1,63 @@
1
+ import { StyleSheet } from 'react-native'
2
+
3
+ import { StyleType, ThemeGutters, ThemeMetricsSizes, ThemeVariables } from '@/theme/types'
4
+
5
+ export type GutterType = {
6
+ BMargin: StyleType
7
+ TMargin: StyleType
8
+ RMargin: StyleType
9
+ LMargin: StyleType
10
+ VMargin: StyleType
11
+ HMargin: StyleType
12
+ Margin: StyleType
13
+ BPadding: StyleType
14
+ TPadding: StyleType
15
+ RPadding: StyleType
16
+ LPadding: StyleType
17
+ VPadding: StyleType
18
+ HPadding: StyleType
19
+ Padding: StyleType
20
+ }
21
+ /**
22
+ * Generate Styles depending on MetricsSizes vars availabled at ./Theme/Variables
23
+ * Styles are like :
24
+ * <size><direction><op>: {
25
+ * <op><direction>: <value>
26
+ * }
27
+ * where:
28
+ * <size>: is the key of the variable included in MetricsSizes
29
+ * <direction>: can be ['Bottom','Top','Right','Left','Horizontal','Vertical']
30
+ * <op>: can be ['Margin', 'Padding']
31
+ * <value>: is the value of the <size>
32
+ */
33
+
34
+ /**
35
+ *
36
+ * @param Theme can be spread like {Colors, NavigationColors, Gutters, Layout, Common, ...args}
37
+ * @return {*}
38
+ */
39
+ export default ({ MetricsSizes: metricsSizes }: ThemeVariables): ThemeGutters => {
40
+ return StyleSheet.create({
41
+ ...Object.entries(metricsSizes).reduce(
42
+ (acc, [key, value]) => ({
43
+ ...acc,
44
+ /* Margins */
45
+ [`${key}BMargin`]: { marginBottom: value },
46
+ [`${key}TMargin`]: { marginTop: value },
47
+ [`${key}RMargin`]: { marginRight: value },
48
+ [`${key}LMargin`]: { marginLeft: value },
49
+ [`${key}VMargin`]: { marginVertical: value },
50
+ [`${key}HMargin`]: { marginHorizontal: value },
51
+ /* Paddings */
52
+ [`${key}BPadding`]: { paddingBottom: value },
53
+ [`${key}TPadding`]: { paddingTop: value },
54
+ [`${key}RPadding`]: { paddingRight: value },
55
+ [`${key}LPadding`]: { paddingLeft: value },
56
+ [`${key}VPadding`]: { paddingVertical: value },
57
+ [`${key}HPadding`]: { paddingHorizontal: value },
58
+ [`${key}Padding`]: { padding: value },
59
+ }),
60
+ {},
61
+ ),
62
+ }) as ThemeGutters
63
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This file contains all application's style relative to fonts
3
+ */
4
+ import { StyleSheet } from 'react-native'
5
+
6
+ import { ThemeIcon, ThemeVariables } from '@/theme/types'
7
+
8
+ /**
9
+ *
10
+ * @param Theme can be spread like {Colors, Gutters, Layout, Common, ...args}
11
+ * @return {*}
12
+ */
13
+ export default ({ IconSize: iconSize }: ThemeVariables): ThemeIcon => {
14
+ return StyleSheet.create({
15
+ ...Object.entries(iconSize).reduce(
16
+ (acc, [key, value]) => ({
17
+ ...acc,
18
+ /* Margins */
19
+ [`${key}Icon`]: {
20
+ width: value,
21
+ height: value,
22
+ },
23
+ }),
24
+ {},
25
+ ),
26
+ }) as ThemeIcon
27
+ }
28
+
@@ -0,0 +1,13 @@
1
+ import { ThemeImages, ThemeVariables } from '@/theme/types'
2
+
3
+ /**
4
+ *
5
+ * @param Theme can be spread like {Colors, Gutters, Layout, Common, ...args}
6
+ * @return {*}
7
+ */
8
+ export default ({}: ThemeVariables): ThemeImages => {
9
+ // {
10
+ // logo: require('@/Assets/Images/TOM.png'),
11
+ // }
12
+ return {}
13
+ }
@@ -0,0 +1,106 @@
1
+ import { StyleSheet } from 'react-native'
2
+
3
+ import { StyleType, ThemeLayout, ThemeVariables } from '@/theme/types'
4
+
5
+ const layoutStyle = {
6
+ /* Column Layouts */
7
+ column: {
8
+ display: 'flex',
9
+ flexDirection: 'column',
10
+ },
11
+ columnReverse: { flexDirection: 'column-reverse' },
12
+ colCenter: {
13
+ flexDirection: 'column',
14
+ alignItems: 'center',
15
+ justifyContent: 'center',
16
+ },
17
+ colVCenter: {
18
+ flexDirection: 'column',
19
+ alignItems: 'center',
20
+ },
21
+ colHCenter: {
22
+ flexDirection: 'column',
23
+ justifyContent: 'center',
24
+ },
25
+ /* Row Layouts */
26
+ row: { flexDirection: 'row' },
27
+ rowReverse: { flexDirection: 'row-reverse' },
28
+ rowCenter: {
29
+ flexDirection: 'row',
30
+ alignItems: 'center',
31
+ justifyContent: 'center',
32
+ },
33
+ rowVCenter: {
34
+ flexDirection: 'row',
35
+ justifyContent: 'center',
36
+ },
37
+ rowHCenter: {
38
+ flexDirection: 'row',
39
+ alignItems: 'center',
40
+ },
41
+ /* Default Layouts */
42
+ center: {
43
+ alignItems: 'center',
44
+ justifyContent: 'center',
45
+ },
46
+ alignItemsCenter: { alignItems: 'center' },
47
+ alignItemsEnd: { alignItems: 'flex-end' },
48
+ alignItemsStart: { alignItems: 'flex-start' },
49
+ alignItemsStretch: { alignItems: 'stretch' },
50
+ justifyContentStart: { justifyContent: 'flex-start' },
51
+ justifyContentEnd: { justifyContent: 'flex-end' },
52
+ justifyContentCenter: { justifyContent: 'center' },
53
+ justifyContentAround: { justifyContent: 'space-around' },
54
+ justifyContentBetween: { justifyContent: 'space-between' },
55
+ scrollSpaceAround: {
56
+ flexGrow: 1,
57
+ justifyContent: 'space-around',
58
+ },
59
+ scrollSpaceBetween: {
60
+ flexGrow: 1,
61
+ justifyContent: 'space-between',
62
+ },
63
+ selfStretch: { alignSelf: 'stretch' },
64
+ selfFlexStart: { alignSelf: 'flex-start' },
65
+ /* Sizes Layouts */
66
+ fill: { flex: 1 },
67
+ fullSize: {
68
+ height: '100%',
69
+ width: '100%',
70
+ },
71
+ fullWidth: { width: '100%' },
72
+ fullHeight: { height: '100%' },
73
+ /* Operation Layout */
74
+ mirror: { transform: [{ scaleX: -1 }] },
75
+ rotate90: { transform: [{ rotate: '90deg' }] },
76
+ rotate90Inverse: { transform: [{ rotate: '-90deg' }] },
77
+ flexWrap: { flexWrap: 'wrap' },
78
+
79
+ abs: {
80
+ position: 'absolute',
81
+ },
82
+ absFill: {
83
+ position: 'absolute',
84
+ top: 0,
85
+ left: 0,
86
+ right: 0,
87
+ bottom: 0,
88
+ },
89
+ htmlRender: {
90
+ p: {
91
+ marginTop: 0,
92
+ },
93
+ },
94
+ }
95
+ type LayoutStyleType = typeof layoutStyle
96
+ export type ILayout = { [P in keyof LayoutStyleType]: StyleType }
97
+ /**
98
+ *
99
+ * @param Theme can be spread like {Colors, Gutters, Layout, Common, ...args}
100
+ * @return {*}
101
+ */
102
+ export default ({}: ThemeVariables): ThemeLayout<ILayout> => {
103
+ const layout = StyleSheet.create(layoutStyle as ILayout)
104
+
105
+ return layout
106
+ }
@@ -0,0 +1,167 @@
1
+ /**
2
+ * This file contains the application's variables.
3
+ *
4
+ * Define color, sizes, etc. here instead of duplicating them throughout the components.
5
+ * That allows to change them more easily later on.
6
+ */
7
+
8
+ import {
9
+ FontScale,
10
+ ThemeFontSize,
11
+ ThemeIconSize,
12
+ ThemeMetricsSizes,
13
+ ThemeNavigationColors,
14
+ ThemeScaledFontSize,
15
+ } from '@/theme/types'
16
+
17
+ export const ownColor = {
18
+ accent: 'rgb(84, 99, 77)',
19
+ tintPrimary: '#E87B00',
20
+ buttonText: '#101010',
21
+ iconColor: 'rgb(67, 72, 63)',
22
+ transparent: 'rgba(0,0,0,0)',
23
+ negative: '#e3e3e3',
24
+ onNegative: '#000000',
25
+ inputBackground: '#FFFFFF',
26
+ // statusBarBackgroundColor: 'rgba(2, 110, 0, .6)',
27
+ statusBarBackgroundColor: 'rgba(0, 0, 0, .0)',
28
+ topBarBackgroundColor: '#f0ced7',
29
+ // Bottom Tab
30
+ bottomTabActiveTextColor: '#009688',
31
+ bottomTabInactiveTextColor: '#A8A8A8',
32
+ homeBottomTabBackgroundColor: '#1565c0',
33
+ rewardsBottomTabBackgroundColor: '#009688',
34
+ storeListBottomTabBackgroundColor: '#607D8B',
35
+
36
+ itemBackgroundColor: '#F5EFE6',
37
+
38
+ grey: '#EBEBEB',
39
+ white: '#FFFFF',
40
+ }
41
+
42
+ const navColors: Partial<ThemeNavigationColors> = {
43
+ // React Navigation colors
44
+ border: '#ccc',
45
+ text: 'rgb(82, 82, 82)',
46
+ card: '#FFFFFF',
47
+ notification: '#FF0000',
48
+
49
+ // Paper MD3 colors
50
+ primary: 'rgb(0, 95, 175)',
51
+ onPrimary: 'rgb(255, 255, 255)',
52
+ primaryContainer: 'rgb(212, 227, 255)',
53
+ onPrimaryContainer: 'rgb(0, 28, 58)',
54
+ secondary: 'rgb(84, 95, 113)',
55
+ onSecondary: 'rgb(255, 255, 255)',
56
+ secondaryContainer: 'rgb(216, 227, 248)',
57
+ onSecondaryContainer: 'rgb(17, 28, 43)',
58
+ tertiary: 'rgb(110, 86, 118)',
59
+ onTertiary: 'rgb(255, 255, 255)',
60
+ tertiaryContainer: 'rgb(247, 216, 255)',
61
+ onTertiaryContainer: 'rgb(39, 20, 48)',
62
+ error: 'rgb(186, 26, 26)',
63
+ onError: 'rgb(255, 255, 255)',
64
+ errorContainer: 'rgb(255, 218, 214)',
65
+ onErrorContainer: 'rgb(65, 0, 2)',
66
+ background: 'rgb(253, 252, 255)',
67
+ onBackground: 'rgb(26, 28, 30)',
68
+ surface: 'rgb(253, 252, 255)',
69
+ onSurface: 'rgb(26, 28, 30)',
70
+ surfaceVariant: 'rgb(224, 226, 236)',
71
+ onSurfaceVariant: 'rgb(67, 71, 78)',
72
+ outline: 'rgb(116, 119, 127)',
73
+ outlineVariant: 'rgb(195, 198, 207)',
74
+ shadow: 'rgb(0, 0, 0)',
75
+ scrim: 'rgb(0, 0, 0)',
76
+ inverseSurface: 'rgb(47, 48, 51)',
77
+ inverseOnSurface: 'rgb(241, 240, 244)',
78
+ inversePrimary: 'rgb(165, 200, 255)',
79
+ elevation: {
80
+ level0: 'transparent',
81
+ level1: 'rgb(240, 244, 251)',
82
+ level2: 'rgb(233, 239, 249)',
83
+ level3: 'rgb(225, 235, 246)',
84
+ level4: 'rgb(223, 233, 245)',
85
+ level5: 'rgb(218, 230, 244)',
86
+ },
87
+ surfaceDisabled: 'rgba(26, 28, 30, 0.12)',
88
+ onSurfaceDisabled: 'rgba(26, 28, 30, 0.38)',
89
+ backdrop: 'rgba(45, 49, 56, 0.4)',
90
+ }
91
+
92
+ /**
93
+ * Colors
94
+ */
95
+ export const Colors: Partial<ThemeNavigationColors> = Object.assign(navColors, ownColor)
96
+
97
+ /**
98
+ * FontSize
99
+ */
100
+ export const FontSize: ThemeFontSize = {
101
+ small: 13,
102
+ medium: 18,
103
+ large: 22,
104
+ xlarge: 29,
105
+ xxlarge: 43,
106
+ }
107
+ export const ScaledFontSize: ThemeScaledFontSize = {
108
+ [FontScale.SMALL]: {
109
+ small: 11,
110
+ medium: 12,
111
+ large: 14,
112
+ xlarge: 24,
113
+ xxlarge: 36,
114
+ },
115
+ [FontScale.MEDIUM]: {
116
+ small: 13,
117
+ medium: 18,
118
+ large: 22,
119
+ xlarge: 29,
120
+ xxlarge: 43,
121
+ },
122
+ [FontScale.LARGE]: {
123
+ small: 15,
124
+ medium: 22,
125
+ large: 30,
126
+ xlarge: 40,
127
+ xxlarge: 57,
128
+ },
129
+ }
130
+
131
+ export const IconSize: ThemeIconSize = {
132
+ small: 24,
133
+ medium: 32,
134
+ large: 45,
135
+ xlarge: 60,
136
+ xxlarge: 90,
137
+ }
138
+
139
+ /**
140
+ * Metrics Sizes
141
+ */
142
+ const tiny = 7
143
+ const small = tiny * 2
144
+ const medium = small * 2
145
+ const large = medium * 2
146
+ export const MetricsSizes: ThemeMetricsSizes = {
147
+ tiny,
148
+ small,
149
+ medium,
150
+ large,
151
+ }
152
+ const roundness = 4
153
+ export default {
154
+ Colors,
155
+ IconSize,
156
+ // FontSize,
157
+ ScaledFontSize,
158
+ MetricsSizes,
159
+ Param: {
160
+ itemRoundness: 20,
161
+ roundness,
162
+ animation: {
163
+ scale: 1.0,
164
+ },
165
+ headerHeight: 48,
166
+ },
167
+ }
@@ -0,0 +1,37 @@
1
+ import { StyleSheet } from 'react-native'
2
+
3
+ import { ButtonsStyle, IThemeCommonParams } from '@/theme/types'
4
+
5
+ export default ({ Colors: colors, Gutters: gutters, Layout: layout, Param: param }: IThemeCommonParams): ButtonsStyle => {
6
+ const roundness = param?.roundness || 4
7
+ const borderRadius = roundness * 6
8
+ const base = {
9
+ borderRadius: borderRadius,
10
+ }
11
+ const rounded = {
12
+ ...base,
13
+ borderRadius: borderRadius,
14
+ }
15
+ const outline = {
16
+ ...base,
17
+ borderRadius: borderRadius,
18
+ borderWidth: 1,
19
+ }
20
+ const content = {
21
+ ...layout.row,
22
+ minWidth: 40,
23
+ minHeight: 40,
24
+ }
25
+ const contentIconOnly = {
26
+ ...content,
27
+ minWidth: 40,
28
+ }
29
+
30
+ return StyleSheet.create({
31
+ base,
32
+ content,
33
+ contentIconOnly,
34
+ rounded,
35
+ outline: { ...outline },
36
+ })
37
+ }
@@ -0,0 +1,8 @@
1
+ export { default as Common } from './Common'
2
+ export { default as Fonts } from './Fonts'
3
+ export { default as Gutters } from './Gutters'
4
+ export { default as Icons } from './Icons'
5
+ export { default as Images } from './Images'
6
+ export { default as Layout } from './Layout'
7
+ export { default as themes } from './themes'
8
+ export { default as DefaultVariables } from './Variables'
@@ -0,0 +1,57 @@
1
+ import { Dimensions, Platform } from 'react-native'
2
+ const { height, width } = Dimensions.get('window')
3
+
4
+ const metrics = {
5
+ s5: 5,
6
+ s8: 8,
7
+ s10: 10,
8
+ s16: 16,
9
+ s20: 20,
10
+ s30: 30,
11
+ s40: 40,
12
+ s50: 50,
13
+ s60: 60,
14
+
15
+ borderWidth: 0.4,
16
+
17
+ horizontalLineHeight: 1,
18
+
19
+ screenWidth: width < height ? width : height,
20
+ screenHeight: width < height ? height : width,
21
+ drawerWidth: (4 / 5) * width,
22
+ navBarHeight: Platform.OS === 'ios' ? 64 : 54,
23
+
24
+ buttonRadius: 4,
25
+
26
+ icons: {
27
+ tiny: 15,
28
+ small: 32,
29
+ medium: 40,
30
+ large: 48,
31
+ xl: 56,
32
+ },
33
+
34
+ images: {
35
+ small: 20,
36
+ medium: 40,
37
+ large: 60,
38
+ logo: 200,
39
+ },
40
+
41
+ iconButton: { padding: 4 },
42
+
43
+ padding: {
44
+ all: 10,
45
+ horizontal: 10,
46
+ vertical: 8,
47
+ },
48
+
49
+ size: {
50
+ tiny: 5,
51
+ small: 10,
52
+ regular: 15,
53
+ large: 20,
54
+ },
55
+ }
56
+
57
+ export default metrics
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Images should be stored in the `App/Images` directory and referenced using variables defined here.
3
+ */
4
+
5
+ export default () => {
6
+ return { logo: { uri: 'https://thecodingmachine.github.io/react-native-boilerplate/img/TOM-small.png' } }
7
+ }