@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,156 @@
1
+ {
2
+ "name": "ProjectName",
3
+ "version": "0.0.1",
4
+ "build": "1",
5
+ "private": true,
6
+ "scripts": {
7
+ "android": "react-native run-android",
8
+ "ios": "react-native run-ios --simulator 'iPhone 17 Pro Max'",
9
+ "lint": "eslint .",
10
+ "start:dev": "npm run watch-del; APP_ENV=development react-native start",
11
+ "start:prod": "npm run watch-del; APP_ENV=production react-native start",
12
+ "test": "jest",
13
+ "watch-del": "watchman watch-del-all"
14
+ },
15
+ "dependencies": {
16
+ "@emotion/native": "^11.11.0",
17
+ "@emotion/react": "^11.14.0",
18
+ "@freakycoder/react-native-bounceable": "^2.1.0",
19
+ "@hookform/resolvers": "^5.2.1",
20
+ "@react-native-async-storage/async-storage": "^2.2.0",
21
+ "@react-native-community/blur": "^4.4.1",
22
+ "@react-native-community/datetimepicker": "^8.6.0",
23
+ "@react-native-community/hooks": "^100.1.0",
24
+ "@react-native-community/netinfo": "^11.4.1",
25
+ "@react-native-community/toolbar-android": "^0.2.1",
26
+ "@react-native-masked-view/masked-view": "^0.3.2",
27
+ "@react-native-picker/picker": "^2.11.4",
28
+ "@react-native-vector-icons/ant-design": "^12.4.0",
29
+ "@react-native-vector-icons/common": "^12.4.0",
30
+ "@react-native-vector-icons/evil-icons": "^12.4.0",
31
+ "@react-native-vector-icons/fontawesome6": "^12.3.0",
32
+ "@react-native-vector-icons/ionicons": "^12.3.0",
33
+ "@react-native-vector-icons/lucide": "^12.4.0",
34
+ "@react-native-vector-icons/material-design-icons": "^12.4.0",
35
+ "@react-native/new-app-screen": "0.83.1",
36
+ "@react-navigation/bottom-tabs": "^7.10.1",
37
+ "@react-navigation/drawer": "^7.7.13",
38
+ "@react-navigation/elements": "^2.9.5",
39
+ "@react-navigation/material-top-tabs": "^7.4.13",
40
+ "@react-navigation/native": "^7.1.28",
41
+ "@react-navigation/native-stack": "^7.9.2",
42
+ "@react-navigation/stack": "^7.6.16",
43
+ "@reduxjs/toolkit": "^2.11.2",
44
+ "apisauce": "^3.2.2",
45
+ "buffer": "^6.0.3",
46
+ "cli-color": "^2.0.4",
47
+ "crypto-es": "^3.1.2",
48
+ "deepmerge": "^4.3.1",
49
+ "formik": "^2.4.9",
50
+ "i18next": "^25.7.4",
51
+ "immutable": "^5.1.4",
52
+ "intl-pluralrules": "^2.0.1",
53
+ "lodash": "^4.17.21",
54
+ "moment": "^2.30.1",
55
+ "moment-timezone": "^0.6.0",
56
+ "react": "19.2.0",
57
+ "react-i18next": "^16.5.3",
58
+ "react-native": "0.83.1",
59
+ "react-native-auto-size-text": "^1.1.1",
60
+ "react-native-blob-util": "^0.24.6",
61
+ "react-native-crypto-js": "^1.0.0",
62
+ "react-native-device-info": "^15.0.1",
63
+ "react-native-encrypted-storage": "^4.0.3",
64
+ "react-native-gesture-handler": "^2.30.0",
65
+ "react-native-get-random-values": "^2.0.0",
66
+ "react-native-keyboard-aware-scroll-view": "^0.9.5",
67
+ "react-native-linear-gradient": "^2.8.3",
68
+ "react-native-localize": "^3.6.1",
69
+ "react-native-material-ripple": "^0.9.1",
70
+ "react-native-mmkv": "^3.3.1",
71
+ "react-native-modal": "^14.0.0-rc.1",
72
+ "react-native-modalize": "^2.1.1",
73
+ "react-native-pager-view": "^8.0.0",
74
+ "react-native-paper": "^5.14.5",
75
+ "react-native-permissions": "^5.4.4",
76
+ "react-native-pressable-opacity": "^1.0.10",
77
+ "react-native-reanimated": "^4.2.1",
78
+ "react-native-render-html": "^6.3.4",
79
+ "react-native-root-siblings": "^5.0.1",
80
+ "react-native-safe-area-context": "^5.6.2",
81
+ "react-native-screens": "^4.20.0",
82
+ "react-native-svg": "^15.15.1",
83
+ "react-native-wheel-pick": "^1.2.6",
84
+ "react-native-worklets": "^0.7.2",
85
+ "react-redux": "^9.2.0",
86
+ "react-usestateref": "^2.0.0",
87
+ "redux": "^5.0.1",
88
+ "redux-persist": "^6.0.0",
89
+ "redux-saga": "^1.4.2",
90
+ "regenerator-runtime": "^0.14.1",
91
+ "reselect": "^5.1.1",
92
+ "rn-encryption": "^3.0.7",
93
+ "rn-material-ui-textfield": "^1.0.9",
94
+ "tinycolor2": "^1.6.0",
95
+ "tsyringe": "^4.10.0",
96
+ "typesafe-actions": "^5.1.0",
97
+ "yup": "^1.7.1",
98
+ "zod": "^4.2.5"
99
+ },
100
+ "devDependencies": {
101
+ "@babel/core": "^7.25.2",
102
+ "@babel/plugin-transform-private-methods": "^7.27.1",
103
+ "@babel/preset-env": "^7.25.3",
104
+ "@babel/runtime": "^7.25.0",
105
+ "@react-native-community/cli": "20.0.0",
106
+ "@react-native-community/cli-platform-android": "20.0.0",
107
+ "@react-native-community/cli-platform-ios": "20.0.0",
108
+ "@react-native/babel-preset": "0.83.1",
109
+ "@react-native/eslint-config": "0.83.1",
110
+ "@react-native/metro-config": "0.83.1",
111
+ "@react-native/typescript-config": "0.83.0",
112
+ "@types/cli-color": "^2.0.6",
113
+ "@types/d3": "^7.4.3",
114
+ "@types/d3-shape": "^3.1.7",
115
+ "@types/jest": "^29.5.13",
116
+ "@types/lodash": "^4.17.20",
117
+ "@types/node": "^24.3.1",
118
+ "@types/qs": "^6.14.0",
119
+ "@types/react": "^19.2.0",
120
+ "@types/react-native-crypto-js": "^1.0.3",
121
+ "@types/react-native-vector-icons": "^6.4.18",
122
+ "@types/react-test-renderer": "^19.1.0",
123
+ "@types/tinycolor2": "^1.4.6",
124
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
125
+ "@typescript-eslint/parser": "^8.50.0",
126
+ "babel-plugin-module-resolver": "^5.0.2",
127
+ "eslint": "^8.19.0",
128
+ "eslint-import-resolver-typescript": "^4.4.4",
129
+ "eslint-plugin-import": "^2.32.0",
130
+ "eslint-plugin-import-newlines": "^1.4.0",
131
+ "eslint-plugin-jsdoc": "^55.4.0",
132
+ "eslint-plugin-jsx-a11y": "^6.10.2",
133
+ "eslint-plugin-newline-destructuring": "^1.2.2",
134
+ "eslint-plugin-prefer-arrow": "^1.2.3",
135
+ "eslint-plugin-simple-import-sort": "^12.1.1",
136
+ "eslint-plugin-sort-destructure-keys": "^2.0.0",
137
+ "eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
138
+ "jest": "^29.6.3",
139
+ "plist": "^3.1.0",
140
+ "prettier": "2.8.8",
141
+ "react-native-dotenv": "^3.4.11",
142
+ "react-native-svg-transformer": "^1.5.1",
143
+ "react-test-renderer": "19.2.0",
144
+ "reactotron-react-native": "^5.1.16",
145
+ "reactotron-react-native-mmkv": "^0.2.8",
146
+ "reactotron-redux": "^3.2.0",
147
+ "semver": "^7.7.2",
148
+ "typescript": "^5.8.3"
149
+ },
150
+ "engines": {
151
+ "node": ">=20"
152
+ },
153
+ "volta": {
154
+ "node": "22.19.0"
155
+ }
156
+ }
@@ -0,0 +1,12 @@
1
+ import '@emotion/react'
2
+
3
+ import {ThemeNavigationColors, ThemeMetricsSizes, ThemeParam} from '@/theme/types'
4
+
5
+ declare module '@emotion/react' {
6
+ export interface Theme {
7
+ colors: ThemeNavigationColors;
8
+ size: ThemeMetricsSizes;
9
+ param: ThemeParam;
10
+ roundness: number;
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ declare module '@env' {
2
+ export const REACT_APP_DEBUG: string;
3
+ }
@@ -0,0 +1 @@
1
+ declare module 'redux-persist-transform-immutable';
@@ -0,0 +1,17 @@
1
+ declare module '*.json' {
2
+ const value: any;
3
+ export default value;
4
+ }
5
+
6
+ declare module "*.svg" {
7
+ import React from 'react';
8
+ import { SvgProps } from "react-native-svg";
9
+ const content: React.FC<SvgProps>;
10
+ export default content;
11
+ }
12
+
13
+ declare module '*.png' {
14
+ import { ImageSourcePropType } from 'react-native'
15
+ const content: ImageSourcePropType
16
+ export default content
17
+ }
@@ -0,0 +1,109 @@
1
+ import { Theme as EmotionTheme, ThemeProvider as EmotionThemeProvider } from '@emotion/react'
2
+ import React, { useCallback, useEffect } from 'react'
3
+ import * as RNLocalize from 'react-native-localize'
4
+ import { Provider as PaperProvider } from 'react-native-paper'
5
+ import { RootSiblingParent } from 'react-native-root-siblings'
6
+ import { useDispatch, useSelector } from 'react-redux'
7
+
8
+ import LoadingOverlay from '@/components/basic/LoadingOverlay'
9
+ import { ThemeContext } from '@/contexts/ThemeContext'
10
+ import useAppState from '@/hooks/useAppState'
11
+ import useBuildTheme from '@/hooks/useBuildTheme'
12
+ import logger from '@/infrastructures/common/logger'
13
+ import i18n, { findBestMatchedDeviceLanguage } from '@/locales/i18n'
14
+ import AppNavigationContainer from '@/navigators'
15
+ import { setInitiated } from '@/redux/reducers/nonPersistSlice'
16
+ import { setLocale } from '@/redux/reducers/settingSlice'
17
+ import { selectInitiated } from '@/redux/selectors/nonPersist'
18
+ import { selectLocale } from '@/redux/selectors/setting'
19
+
20
+ const AppContainer = (): React.ReactElement => {
21
+ const dispatch = useDispatch()
22
+ const theme = useBuildTheme()
23
+ const { Colors, MetricsSizes, NavigationTheme, PaperTheme } = theme
24
+ const initiated = useSelector(selectInitiated)
25
+ const lang = useSelector(selectLocale)
26
+ const appState = useAppState({})
27
+
28
+ React.useEffect(() => {
29
+ logger.debug('AppContainer: appState: ', appState)
30
+ }, [appState])
31
+
32
+ const emotionTheme: EmotionTheme = {
33
+ colors: PaperTheme.colors,
34
+ size: MetricsSizes,
35
+ roundness: PaperTheme.roundness,
36
+ param: theme.Param,
37
+ }
38
+
39
+ // TODO: Linking handler for Deep Linking
40
+ // TODO: Receive Push Notification handler
41
+
42
+ useEffect(() => {
43
+ logger.log('lang: ', lang)
44
+ logger.log(`i18n.language: ${i18n.language ? i18n.language : 'null'}`)
45
+ const preferredLocale = RNLocalize.getLocales()[0]
46
+ const deviceLocale = preferredLocale.languageTag
47
+ logger.log('deviceLocale: ' + deviceLocale)
48
+
49
+ // Set app locale as device's locale
50
+ if (lang === null || lang === undefined) {
51
+ setupLocale(deviceLocale)
52
+ } else {
53
+ i18n.changeLanguage(lang)
54
+ .then(() => {
55
+ dispatch(setInitiated(true))
56
+ })
57
+ .catch((error) => {
58
+
59
+ })
60
+ .finally(() => {
61
+ // finally
62
+ })
63
+ }
64
+ // RNLocalize.addEventListener('change', handleLocalizationChange)
65
+
66
+ // return () => {
67
+ // RNLocalize.removeEventListener('change', handleLocalizationChange)
68
+ // }
69
+ }, [lang])
70
+
71
+ const handleLocalizationChange = () => {
72
+ const preferredLocale = RNLocalize.getLocales()[0]
73
+ const deviceLocale = preferredLocale.languageTag
74
+ logger.log('handleLocalizationChange deviceLocale: ' + deviceLocale)
75
+ setupLocale(deviceLocale)
76
+ }
77
+
78
+ const setupLocale = useCallback((deviceLocale: string) => {
79
+ const appLang = findBestMatchedDeviceLanguage(deviceLocale)
80
+ logger.log(`appLang: ${appLang}`)
81
+ i18n.changeLanguage(appLang)
82
+ .then(() => {
83
+ dispatch(setLocale(appLang))
84
+ dispatch(setInitiated(true))
85
+ })
86
+ .catch((error) => {
87
+
88
+ })
89
+ .finally(() => {
90
+ // finally
91
+ })
92
+ }, [])
93
+
94
+ return (
95
+ <ThemeContext.Provider value={theme}>
96
+ <EmotionThemeProvider theme={emotionTheme}>
97
+ <PaperProvider theme={PaperTheme}>
98
+ <RootSiblingParent>
99
+ {initiated ? <AppNavigationContainer theme={NavigationTheme} /> : <></>}
100
+ <LoadingOverlay indicatorColor={Colors.primary} />
101
+ </RootSiblingParent>
102
+ </PaperProvider>
103
+ </EmotionThemeProvider>
104
+ </ThemeContext.Provider>
105
+ )
106
+ }
107
+
108
+ export default AppContainer
109
+ AppContainer.displayName = 'AppContainer'
@@ -0,0 +1,13 @@
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
+
4
+ import { ImageRequireSource, ImageSourcePropType } from 'react-native'
5
+
6
+ const _images = {
7
+ cloud: require('./images/143.png') as ImageRequireSource,
8
+ }
9
+
10
+ type ImagesType = typeof _images
11
+ export type IImage = { [P in keyof ImagesType]: ImageRequireSource }
12
+
13
+ export const images: IImage = _images as IImage
@@ -0,0 +1,34 @@
1
+ import React, { FunctionComponent } from 'react'
2
+ // import Icon from 'react-native-vector-icons/MaterialIcons';
3
+ import { TouchableOpacity } from 'react-native'
4
+
5
+ import { PressableOpacity } from '@/components/basic'
6
+ import useTheme from '@/hooks/useTheme'
7
+ import { Theme } from '@/theme/types'
8
+
9
+ import IconX from '../Icons'
10
+
11
+
12
+ interface IBackButtonProps {
13
+ onPress: () => void
14
+ color?: string
15
+ }
16
+ const BackButton: FunctionComponent<IBackButtonProps> = ({ color, onPress }: IBackButtonProps) => {
17
+ const { Colors, Gutters } = useTheme()
18
+ const { accent, onPrimary } = Colors
19
+
20
+ return (
21
+ <PressableOpacity
22
+ onPress={onPress}
23
+ style={[]}
24
+ >
25
+ <IconX
26
+ origin={IconX.MATERIAL_DESIGN_ICONS}
27
+ name={'arrow-back-ios'}
28
+ color={color ? color : onPrimary}
29
+ size={32}
30
+ />
31
+ </PressableOpacity>
32
+ )
33
+ }
34
+ export default BackButton
@@ -0,0 +1,68 @@
1
+ import React from 'react'
2
+ import { View, ViewStyle } from 'react-native'
3
+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
4
+ import Svg, { Path } from 'react-native-svg'
5
+
6
+ import useTheme from '@/hooks/useTheme'
7
+
8
+ interface IBodyProps {
9
+ insetBottom?: boolean
10
+ children: React.ReactNode[] | React.ReactNode
11
+ style?: ViewStyle | ViewStyle[]
12
+ withRoundedTopRight?: boolean
13
+ topRightColor?: string
14
+ }
15
+
16
+ const Body: React.FC<IBodyProps> = ({ children, insetBottom = false, style = {}, topRightColor, withRoundedTopRight = false }: IBodyProps) => {
17
+ const insets = useSafeAreaInsets()
18
+ const { Colors, Fonts, Gutters, Layout } = useTheme()
19
+ const defaultTopRightColor = topRightColor ?? Colors.primary
20
+
21
+ const path = React.useMemo(
22
+ () =>
23
+ [
24
+ 'M 0 0',
25
+ 'C 0 0 50 0 50 50',
26
+ 'L 50 0',
27
+ 'L 0 0',
28
+ ].join(' '),
29
+ []
30
+ )
31
+
32
+ return (
33
+ <View
34
+ style={[
35
+ Layout.fill,
36
+ Layout.column,
37
+ Layout.fullWidth,
38
+ { height: '100%' },
39
+ // Gutters.tinyTPadding,
40
+ insetBottom ? { paddingBottom: insets.bottom } : {},
41
+ withRoundedTopRight ? {
42
+ backgroundColor: 'white',
43
+ // borderTopRightRadius:40,
44
+ // paddingTop: 28,
45
+ } : {},
46
+ style,
47
+ ]}
48
+ >
49
+ {children}
50
+ {/* {withRoundedTopRight && (
51
+ <View
52
+ style={{
53
+ position: 'absolute',
54
+ top: 0,
55
+ right: 0,
56
+ }}
57
+ pointerEvents="none"
58
+ >
59
+ <Svg width={50} height={50} viewBox="0 0 50 50">
60
+ <Path fill={defaultTopRightColor} stroke={defaultTopRightColor} d={path} />
61
+ </Svg>
62
+ </View>
63
+ )} */}
64
+ </View>
65
+ )
66
+ }
67
+
68
+ export default React.memo(Body)
@@ -0,0 +1,181 @@
1
+ import React, { useCallback } from 'react'
2
+ import { StyleProp, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native'
3
+ import {
4
+ Button as PButton,
5
+ ButtonProps,
6
+ IconButton,
7
+ Surface,
8
+ Text,
9
+ TouchableRipple,
10
+ } from 'react-native-paper'
11
+ import { IconSource } from 'react-native-paper/src/components/Icon'
12
+ import color from 'tinycolor2'
13
+
14
+ import useTheme from '@/hooks/useTheme'
15
+ import logger from '@/infrastructures/common/logger'
16
+
17
+ import { getButtonColor } from './utils'
18
+
19
+ export type ButtonType = 'text' | 'round' | 'outline' | 'contain' | 'icon'
20
+
21
+ export interface IButtonProps {
22
+ onPress?: () => void | Promise<void>
23
+ // isRound?: boolean
24
+ type?: ButtonType
25
+ text?: string
26
+ buttonSize?: 'small' | 'medium' | 'large'
27
+ isPrimary?: boolean
28
+ buttonColor?: string
29
+ textColor?: string
30
+ borderColor?: string
31
+ style?: ViewStyle | ViewStyle[]
32
+ contentStyle?: ViewStyle | ViewStyle[]
33
+ textStyle?: TextStyle | TextStyle[]
34
+ icon?: IconSource | React.ReactElement // React.ReactElement|string
35
+ iconSize?: number
36
+ disabled?: boolean
37
+ textColorOnTextOnly?: boolean
38
+ }
39
+ const Button: React.FC<IButtonProps> = ({
40
+ borderColor: customBorderColor,
41
+ buttonColor: customButtonColor,
42
+ buttonSize = 'small',
43
+ contentStyle,
44
+ disabled = false,
45
+ icon,
46
+ iconSize,
47
+ isPrimary = true,
48
+ onPress = () => { },
49
+ style,
50
+ text,
51
+ textColor: customTextColor,
52
+ textColorOnTextOnly = false,
53
+ textStyle,
54
+ type = 'text',
55
+ }: IButtonProps) => {
56
+ const theme = useTheme()
57
+ const [tempDisable, setTempDisable] = React.useState(false)
58
+ const {
59
+ Colors,
60
+ Common,
61
+ darkMode,
62
+ Fonts,
63
+ Gutters,
64
+ Layout,
65
+ } = theme
66
+ const isMode = React.useCallback(
67
+ (typeToCompare: ButtonType) => {
68
+ return type === typeToCompare
69
+ },
70
+ [type]
71
+ )
72
+ const mode = React.useMemo(() => {
73
+ if (type === 'round') {
74
+ return 'contained'
75
+ }
76
+ if (type === 'contain') {
77
+ return 'contained-tonal'
78
+ }
79
+ if (type === 'outline') {
80
+ return 'outlined'
81
+ }
82
+
83
+ return 'text'
84
+ }, [type])
85
+ let _textColor = customTextColor
86
+ if (textColorOnTextOnly) {
87
+ _textColor = undefined
88
+ }
89
+ const { backgroundColor, borderColor, textColor } = getButtonColor(isMode, Colors, darkMode, isPrimary, type, disabled, _textColor, customButtonColor, customBorderColor, textColorOnTextOnly)
90
+ let _buttonStyle = Object.assign({}, Common.button.base)
91
+ let _contentStyle = Object.assign({}, Common.button.content)
92
+ if (isMode('icon')) {
93
+ _contentStyle = Object.assign(_contentStyle, Common.button.contentIconOnly)
94
+ }
95
+ if (isMode('outline')) {
96
+ _buttonStyle = Object.assign(_buttonStyle, {
97
+ ...Common.button.outline,
98
+ borderColor,
99
+ })
100
+ }
101
+
102
+ switch (buttonSize) {
103
+ case 'medium':
104
+ _contentStyle = Object.assign(_contentStyle, { minHeight: 60 })
105
+ _buttonStyle = Object.assign(_buttonStyle, { borderRadius: 30 })
106
+ break
107
+ case 'large':
108
+ break
109
+ }
110
+
111
+ const onPressHandler = useCallback(() => {
112
+ if (tempDisable) {
113
+ return
114
+ }
115
+ setTempDisable(true)
116
+ setTimeout(() => {
117
+ setTempDisable(false)
118
+ }, 500)
119
+ void onPress()
120
+ }, [tempDisable])
121
+
122
+ if (type === 'icon' && icon !== undefined) {
123
+ const rippleColor = color(textColor).setAlpha(0.12)
124
+ .toPercentageRgbString()
125
+
126
+ /* return (
127
+ <TouchableRipple
128
+ style={[
129
+ Common.button.base,
130
+ _buttonStyle,
131
+ // { backgroundColor: backgroundColor },
132
+ style ? style : {},
133
+ {
134
+ borderRadius: 20,
135
+ },
136
+ ]}
137
+ onPress={onPress}
138
+ // activeOpacity={0.6}
139
+ disabled={disabled}
140
+ rippleColor={rippleColor}
141
+ >
142
+ <View style={[_contentStyle, { alignItems: 'center', justifyContent: 'center' }, contentStyle]}>
143
+ {icon !== undefined && icon}
144
+ </View>
145
+ </TouchableRipple>
146
+ ) */
147
+ return (
148
+ <IconButton
149
+ onPress={() => void onPress()}
150
+ disabled={disabled}
151
+ style={[{ borderRadius: 12, margin: 0 }, style]}
152
+ size={iconSize || 24}
153
+ containerColor={backgroundColor}
154
+ icon={React.isValidElement(icon) ? (props) => icon : (icon)}
155
+ iconColor={textColor}
156
+ />
157
+ )
158
+ }
159
+
160
+ return (
161
+ <PButton
162
+ mode={mode}
163
+ onPress={onPressHandler}
164
+ disabled={disabled}
165
+ style={[
166
+ Common.button.base,
167
+ _buttonStyle,
168
+ style ? style : {},
169
+ ]}
170
+ contentStyle={[_contentStyle, contentStyle]}
171
+ labelStyle={[textStyle ? textStyle : {}, textColorOnTextOnly && customTextColor ? { color: customTextColor } : {}]}
172
+ textColor={textColor}
173
+ buttonColor={backgroundColor}
174
+ icon={React.isValidElement(icon) ? (props) => icon : (icon as IconSource)}
175
+ >
176
+ {text ? text : ''}
177
+ </PButton>
178
+ )
179
+ }
180
+
181
+ export default Button
@@ -0,0 +1,78 @@
1
+ import { black, white } from 'react-native-paper/src/styles/themes/v2/colors'
2
+
3
+ import { isDark } from '@/infrastructures/common/colorUtils'
4
+ import { ThemeNavigationColors } from '@/theme/types'
5
+
6
+ import { ButtonType } from './index'
7
+
8
+ const getButtonColor = (isType: (type: ButtonType) => boolean, colors: ThemeNavigationColors, darkMode: boolean, isPrimary: boolean, type: ButtonType, disabled?: boolean, customTextColor?: string, customButtonColor?: string, customBorderColor?: string, textColorOnTextOnly?: boolean) => {
9
+ const backgroundColor = getButtonBackgroundColor(isType, colors, darkMode, isPrimary, type, disabled, customButtonColor)
10
+ const borderColor = getBorderColor(isType, colors, darkMode, isPrimary, type, disabled, customTextColor, customButtonColor, customBorderColor)
11
+ const textColor = getTextColor(isType, colors, darkMode, isPrimary, type, disabled, customTextColor, backgroundColor, textColorOnTextOnly)
12
+
13
+ return {
14
+ backgroundColor,
15
+ borderColor,
16
+ textColor,
17
+ }
18
+ }
19
+ const getButtonBackgroundColor = (isType: (type: ButtonType) => boolean, colors: ThemeNavigationColors, darkMode: boolean, isPrimary: boolean, type: ButtonType, disabled?: boolean, customButtonColor?: string) => {
20
+ if (customButtonColor && !disabled) {
21
+ return customButtonColor
22
+ }
23
+
24
+ if (disabled) {
25
+ if (isType('outline') || isType('text')) {
26
+ return 'transparent'
27
+ }
28
+
29
+ return colors.surfaceDisabled
30
+ }
31
+ if (isType('round')) {
32
+ return colors.primary
33
+ }
34
+ if (isType('contain')) {
35
+ return colors.secondaryContainer
36
+ }
37
+
38
+ return 'transparent'
39
+ }
40
+ const getBorderColor = (isType: (type: ButtonType) => boolean, colors: ThemeNavigationColors, darkMode: boolean, isPrimary: boolean, type: ButtonType, disabled?: boolean, customTextColor?: string, customButtonColor?: string, customBorderColor?: string) => {
41
+ if (disabled && isType('outline')) {
42
+ return colors.surfaceDisabled
43
+ }
44
+ if ((customBorderColor || customTextColor) && isType('outline')) {
45
+ return customBorderColor || customTextColor
46
+ }
47
+ if (isType('outline')) {
48
+ return colors.primary
49
+ }
50
+
51
+ return 'transparent'
52
+ }
53
+ const getTextColor = (isType: (type: ButtonType) => boolean, colors: ThemeNavigationColors, darkMode: boolean, isPrimary: boolean, type: ButtonType, disabled?: boolean, customTextColor?: string, backgroundColor?: string, textColorOnTextOnly?: boolean) => {
54
+ if (customTextColor && !disabled) {
55
+ return customTextColor
56
+ }
57
+ if (disabled) {
58
+ return colors.onSurfaceDisabled
59
+ }
60
+ if (darkMode) {
61
+ if (isType('round') || isType('contain')) {
62
+ return isDark({ dark: darkMode, backgroundColor }) ? white : black
63
+ }
64
+ }
65
+ if (isType('outline') || isType('text') || isType('icon')) {
66
+ return colors.primary
67
+ }
68
+ if (isType('round')) {
69
+ return colors.onPrimary
70
+ }
71
+ if (isType('contain')) {
72
+ return colors.onSecondaryContainer
73
+ }
74
+ }
75
+
76
+ export {
77
+ getButtonColor,
78
+ }