new-react-native-boilerplate 0.0.0-stage → 1.0.0

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 (227) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +314 -2
  3. package/package.json +49 -4
  4. package/run.sh +36 -0
  5. package/setup.js +141 -0
  6. package/template/.bundle/config +2 -0
  7. package/template/.editorconfig +14 -0
  8. package/template/.eslintrc.js +49 -0
  9. package/template/.husky/commit-msg +4 -0
  10. package/template/.husky/pre-commit +1 -0
  11. package/template/.prettierrc.js +6 -0
  12. package/template/.watchmanconfig +1 -0
  13. package/template/Gemfile +17 -0
  14. package/template/Gemfile.lock +114 -0
  15. package/template/README.md +103 -0
  16. package/template/__tests__/App.test.tsx +13 -0
  17. package/template/__tests__/CustomTextInput.test.jsx +29 -0
  18. package/template/android/app/build.gradle +119 -0
  19. package/template/android/app/debug.keystore +0 -0
  20. package/template/android/app/proguard-rules.pro +10 -0
  21. package/template/android/app/src/main/AndroidManifest.xml +27 -0
  22. package/template/android/app/src/main/assets/fonts/Poppins-Bold.ttf +0 -0
  23. package/template/android/app/src/main/assets/fonts/Poppins-Medium.ttf +0 -0
  24. package/template/android/app/src/main/assets/fonts/Poppins-Regular.ttf +0 -0
  25. package/template/android/app/src/main/assets/fonts/Poppins-SemiBold.ttf +0 -0
  26. package/template/android/app/src/main/assets/fonts/futura_book.otf +0 -0
  27. package/template/android/app/src/main/assets/fonts/futura_medium.otf +0 -0
  28. package/template/android/app/src/main/java/com/boilerplatereactnative/MainActivity.kt +22 -0
  29. package/template/android/app/src/main/java/com/boilerplatereactnative/MainApplication.kt +27 -0
  30. package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  31. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  32. package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  33. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  34. package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  35. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  36. package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  37. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  38. package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  39. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  40. package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  41. package/template/android/app/src/main/res/values/strings.xml +3 -0
  42. package/template/android/app/src/main/res/values/styles.xml +9 -0
  43. package/template/android/build.gradle +21 -0
  44. package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  45. package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  46. package/template/android/gradle.properties +49 -0
  47. package/template/android/gradlew +248 -0
  48. package/template/android/gradlew.bat +98 -0
  49. package/template/android/link-assets-manifest.json +29 -0
  50. package/template/android/settings.gradle +6 -0
  51. package/template/app.json +4 -0
  52. package/template/babel.config.js +43 -0
  53. package/template/eslint.config.mjs +175 -0
  54. package/template/index.d.ts +1 -0
  55. package/template/index.js +10 -0
  56. package/template/ios/.xcode.env +11 -0
  57. package/template/ios/BoilerPlateReactNative/AppDelegate.swift +11 -0
  58. package/template/ios/BoilerPlateReactNative/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  59. package/template/ios/BoilerPlateReactNative/Images.xcassets/Contents.json +6 -0
  60. package/template/ios/BoilerPlateReactNative/Info.plist +102 -0
  61. package/template/ios/BoilerPlateReactNative/LaunchScreen.storyboard +47 -0
  62. package/template/ios/BoilerPlateReactNative/PrivacyInfo.xcprivacy +37 -0
  63. package/template/ios/BoilerPlateReactNative/SceneDelegate.swift +54 -0
  64. package/template/ios/BoilerPlateReactNative.xcodeproj/project.pbxproj +531 -0
  65. package/template/ios/BoilerPlateReactNative.xcodeproj/xcshareddata/xcschemes/BoilerPlateReactNative.xcscheme +88 -0
  66. package/template/ios/BoilerPlateReactNative.xcworkspace/contents.xcworkspacedata +10 -0
  67. package/template/ios/BoilerPlateReactNative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  68. package/template/ios/Podfile +34 -0
  69. package/template/ios/Podfile.lock +2552 -0
  70. package/template/ios/link-assets-manifest.json +29 -0
  71. package/template/jest.config.js +13 -0
  72. package/template/jest.setup.js +30 -0
  73. package/template/metro.config.js +15 -0
  74. package/template/package.json +88 -0
  75. package/template/plugins/compile-js/_prompts.js +6 -0
  76. package/template/plugins/compile-js/index.js +9 -0
  77. package/template/plugins/compile-js/plugin.js +103 -0
  78. package/template/plugins/compile-js/tsconfig.build.json +20 -0
  79. package/template/plugins/index.js +46 -0
  80. package/template/plugins/printSuccess/_prompts.js +1 -0
  81. package/template/plugins/printSuccess/index.js +9 -0
  82. package/template/plugins/printSuccess/plugin.js +40 -0
  83. package/template/react-native.config.js +7 -0
  84. package/template/src/App.tsx +27 -0
  85. package/template/src/assets/fonts/Poppins-Bold.ttf +0 -0
  86. package/template/src/assets/fonts/Poppins-Medium.ttf +0 -0
  87. package/template/src/assets/fonts/Poppins-Regular.ttf +0 -0
  88. package/template/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
  89. package/template/src/assets/fonts/futura_book.otf +0 -0
  90. package/template/src/assets/fonts/futura_medium.otf +0 -0
  91. package/template/src/assets/images/check.png +0 -0
  92. package/template/src/assets/images/check@2x.png +0 -0
  93. package/template/src/assets/images/check@3x.png +0 -0
  94. package/template/src/assets/images/email.png +0 -0
  95. package/template/src/assets/images/email@2x.png +0 -0
  96. package/template/src/assets/images/email@3x.png +0 -0
  97. package/template/src/assets/images/icBack.png +0 -0
  98. package/template/src/assets/images/icBack@2x.png +0 -0
  99. package/template/src/assets/images/icBack@3x.png +0 -0
  100. package/template/src/assets/images/icClose.png +0 -0
  101. package/template/src/assets/images/icClose@2x.png +0 -0
  102. package/template/src/assets/images/icClose@3x.png +0 -0
  103. package/template/src/assets/images/icComment.png +0 -0
  104. package/template/src/assets/images/icComment@2x.png +0 -0
  105. package/template/src/assets/images/icComment@3x.png +0 -0
  106. package/template/src/assets/images/icLike.png +0 -0
  107. package/template/src/assets/images/icLike@2x.png +0 -0
  108. package/template/src/assets/images/icLike@3x.png +0 -0
  109. package/template/src/assets/images/icSearch.png +0 -0
  110. package/template/src/assets/images/icSearch@2x.png +0 -0
  111. package/template/src/assets/images/icSearch@3x.png +0 -0
  112. package/template/src/assets/images/icSetting.png +0 -0
  113. package/template/src/assets/images/icSetting@2x.png +0 -0
  114. package/template/src/assets/images/icSetting@3x.png +0 -0
  115. package/template/src/assets/images/icShare.png +0 -0
  116. package/template/src/assets/images/icShare@2x.png +0 -0
  117. package/template/src/assets/images/icShare@3x.png +0 -0
  118. package/template/src/assets/images/line.png +0 -0
  119. package/template/src/assets/images/line@2x.png +0 -0
  120. package/template/src/assets/images/line@3x.png +0 -0
  121. package/template/src/assets/images/lock.png +0 -0
  122. package/template/src/assets/images/lock@2x.png +0 -0
  123. package/template/src/assets/images/lock@3x.png +0 -0
  124. package/template/src/assets/images/notification.png +0 -0
  125. package/template/src/assets/images/notification@2x.png +0 -0
  126. package/template/src/assets/images/notification@3x.png +0 -0
  127. package/template/src/assets/images/oct_dark.png +0 -0
  128. package/template/src/assets/images/oct_light.png +0 -0
  129. package/template/src/assets/images/onboard.png +0 -0
  130. package/template/src/assets/images/password_hide.png +0 -0
  131. package/template/src/assets/images/password_hide@2x.png +0 -0
  132. package/template/src/assets/images/password_hide@3x.png +0 -0
  133. package/template/src/assets/images/password_show.png +0 -0
  134. package/template/src/assets/images/password_show@2x.png +0 -0
  135. package/template/src/assets/images/password_show@3x.png +0 -0
  136. package/template/src/assets/images/right_arrow.png +0 -0
  137. package/template/src/assets/images/right_arrow@2x.png +0 -0
  138. package/template/src/assets/images/right_arrow@3x.png +0 -0
  139. package/template/src/assets/images/star.png +0 -0
  140. package/template/src/assets/images/star@2x.png +0 -0
  141. package/template/src/assets/images/star@3x.png +0 -0
  142. package/template/src/assets/images/uncheck.png +0 -0
  143. package/template/src/assets/images/uncheck@2x.png +0 -0
  144. package/template/src/assets/images/uncheck@3x.png +0 -0
  145. package/template/src/assets/images/user.png +0 -0
  146. package/template/src/assets/images/user@2x.png +0 -0
  147. package/template/src/assets/images/user@3x.png +0 -0
  148. package/template/src/components/atoms/ButtonContainer.tsx +52 -0
  149. package/template/src/components/atoms/ImageContainer.tsx +10 -0
  150. package/template/src/components/atoms/RemoteImage.tsx +8 -0
  151. package/template/src/components/atoms/RoundImageBorder.tsx +35 -0
  152. package/template/src/components/atoms/TextContainer.tsx +38 -0
  153. package/template/src/components/atoms/WrapperContainer.tsx +43 -0
  154. package/template/src/components/atoms/index.ts +6 -0
  155. package/template/src/components/molecules/AuthHeader.tsx +55 -0
  156. package/template/src/components/molecules/CustomTextInput.tsx +102 -0
  157. package/template/src/components/molecules/EmptyComp.tsx +16 -0
  158. package/template/src/components/molecules/ErrorComp.tsx +25 -0
  159. package/template/src/components/molecules/FooterView.tsx +41 -0
  160. package/template/src/components/molecules/HeaderComp.tsx +51 -0
  161. package/template/src/components/molecules/HomeHeader.tsx +63 -0
  162. package/template/src/components/molecules/HomeListHeader.tsx +48 -0
  163. package/template/src/components/molecules/HomeListItems.tsx +86 -0
  164. package/template/src/components/molecules/Loader.tsx +25 -0
  165. package/template/src/components/molecules/ModalSheet.tsx +146 -0
  166. package/template/src/components/molecules/RememberMe.tsx +58 -0
  167. package/template/src/components/molecules/SearchBar.tsx +46 -0
  168. package/template/src/components/molecules/index.ts +12 -0
  169. package/template/src/constants/apiConstant.ts +12 -0
  170. package/template/src/constants/fontFamily.ts +8 -0
  171. package/template/src/constants/imagePath.ts +25 -0
  172. package/template/src/constants/index.ts +3 -0
  173. package/template/src/constants/storageKeys.ts +5 -0
  174. package/template/src/models/ApiErrorResponse.ts +19 -0
  175. package/template/src/models/HomeData.ts +17 -0
  176. package/template/src/models/User.ts +11 -0
  177. package/template/src/navigations/AuthStack.tsx +20 -0
  178. package/template/src/navigations/MainStack.tsx +19 -0
  179. package/template/src/navigations/Routes.tsx +22 -0
  180. package/template/src/navigations/navigationProps.ts +8 -0
  181. package/template/src/redux/hooks.ts +10 -0
  182. package/template/src/redux/reducers/auth.ts +43 -0
  183. package/template/src/redux/reducers/common.ts +24 -0
  184. package/template/src/redux/reducers/index.ts +31 -0
  185. package/template/src/redux/reducers/product.ts +37 -0
  186. package/template/src/redux/reducers/settings.ts +55 -0
  187. package/template/src/redux/store.ts +19 -0
  188. package/template/src/redux/types.ts +6 -0
  189. package/template/src/screens/Home/Home.tsx +65 -0
  190. package/template/src/screens/Login/Login.tsx +35 -0
  191. package/template/src/screens/Login/components/LoginForm.tsx +88 -0
  192. package/template/src/screens/Login/hooks/useLogin.ts +38 -0
  193. package/template/src/screens/Login/styles.ts +17 -0
  194. package/template/src/screens/Login/types.ts +10 -0
  195. package/template/src/screens/Onboarding/Onboarding.tsx +87 -0
  196. package/template/src/screens/Onboarding/styles.ts +25 -0
  197. package/template/src/screens/PostDetails/PostDetails.tsx +168 -0
  198. package/template/src/screens/PostDetails/styles.ts +82 -0
  199. package/template/src/screens/Signup/Signup.tsx +32 -0
  200. package/template/src/screens/Signup/components/SignupForm.tsx +113 -0
  201. package/template/src/screens/Signup/hooks/useSignup.ts +38 -0
  202. package/template/src/screens/Signup/styles.ts +18 -0
  203. package/template/src/screens/Signup/type.ts +12 -0
  204. package/template/src/screens/index.ts +5 -0
  205. package/template/src/services/apiService.ts +144 -0
  206. package/template/src/services/authService.ts +79 -0
  207. package/template/src/services/productService.ts +45 -0
  208. package/template/src/services/statusHandler.ts +17 -0
  209. package/template/src/styles/breakpoints.ts +11 -0
  210. package/template/src/styles/themes.ts +45 -0
  211. package/template/src/styles/unistyles.ts +25 -0
  212. package/template/src/translations/ar.json +47 -0
  213. package/template/src/translations/en.json +47 -0
  214. package/template/src/translations/fr.json +47 -0
  215. package/template/src/translations/index.ts +32 -0
  216. package/template/src/typings/env.d.ts +5 -0
  217. package/template/src/typings/global.d.ts +3 -0
  218. package/template/src/utils/handleLocalStorage.ts +31 -0
  219. package/template/src/utils/i18nHelpers.ts +20 -0
  220. package/template/src/utils/index.ts +66 -0
  221. package/template/src/utils/scaling.ts +13 -0
  222. package/template/src/utils/themeHelpers.ts +10 -0
  223. package/template/src/utils/validationForm.ts +23 -0
  224. package/template/src/utils/validations.ts +69 -0
  225. package/template/tsconfig.json +22 -0
  226. package/template/yarn.lock +7728 -0
  227. package/template.config.js +6 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sharmahardik59
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,315 @@
1
- # Temporary Holding Version
1
+ # RNBoilerPlate: React Native App QuickStart
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm version](https://img.shields.io/npm/v/new-react-native-boilerplate.svg)](https://www.npmjs.com/package/new-react-native-boilerplate)
4
+ [![npm downloads](https://img.shields.io/npm/dm/new-react-native-boilerplate.svg)](https://www.npmjs.com/package/new-react-native-boilerplate)
5
+ [![license](https://img.shields.io/npm/l/new-react-native-boilerplate.svg)](https://github.com/sharmahardik59/RNBoilerplate/blob/main/LICENSE)
6
+ ![React Native](https://img.shields.io/badge/React%20Native-0.88-61dafb)
7
+ ![TypeScript](https://img.shields.io/badge/TypeScript-ready-3178c6)
8
+
9
+ ⚛️ A production-ready React Native boilerplate. One command creates a new app with navigation, state management, data fetching, theming and localization already set up, so you can start building features right away. 📱✨
10
+
11
+ ---
12
+
13
+ ## Table of Contents
14
+
15
+ - [Key Features](#key-features)
16
+ - [Requirements](#requirements)
17
+ - [Installation](#installation)
18
+ - [What the Setup Wizard Does](#what-the-setup-wizard-does)
19
+ - [Running the App](#running-the-app)
20
+ - [Environment Variables](#environment-variables)
21
+ - [Available Scripts](#available-scripts)
22
+ - [Project Structure](#project-structure)
23
+ - [Libraries Included](#libraries-included)
24
+ - [Troubleshooting](#troubleshooting)
25
+ - [Contributing](#contributing)
26
+ - [Acknowledgements](#acknowledgements)
27
+ - [License](#license)
28
+
29
+ ---
30
+
31
+ ## Key Features
32
+
33
+ - 🌗 **Light / Dark mode**: theme switching built in, powered by `react-native-unistyles`.
34
+ - 🌍 **Localization**: i18n setup with English, French and Arabic translations.
35
+ - 🗃️ **Global state and storage**: Redux Toolkit with typed hooks, plus fast local storage with MMKV.
36
+ - 🔄 **API layer**: a preconfigured Axios service layer with status handling.
37
+ - 🔐 **Authentication stack**: Login, Signup and Onboarding screens with Formik and Yup validation.
38
+ - 🧭 **Main stack**: React Navigation (native stack) with separate Auth and Main flows.
39
+ - 🧱 **Atomic components**: reusable atoms and molecules such as inputs, headers, loaders and modal sheets.
40
+ - 🧪 **Testing and quality**: Jest, React Native Testing Library, ESLint, Prettier, Husky and Commitlint.
41
+ - 🏷️ **Custom name and bundle ID**: the wizard renames the project and sets your bundle ID automatically.
42
+
43
+ ---
44
+
45
+ ## Requirements
46
+
47
+ | Tool | Version | Notes |
48
+ | --- | --- | --- |
49
+ | [Node.js](https://nodejs.org/) | **>= 22.11** | LTS recommended |
50
+ | [Yarn](https://classic.yarnpkg.com/) | 1.22.x | The generated project uses Yarn |
51
+ | [Ruby](https://www.ruby-lang.org/) + [Bundler](https://bundler.io/) | Ruby 2.6.10 or later | Used to install CocoaPods |
52
+ | [Xcode](https://developer.apple.com/xcode/) | **16 or later** | iOS only (macOS); targets iOS 15.1+ |
53
+ | [CocoaPods](https://cocoapods.org/) | latest | iOS only, installed through Bundler |
54
+ | [Android Studio](https://developer.android.com/studio) | latest | Android SDK, emulator and JDK 17 |
55
+
56
+ > **Note:** Complete the official [React Native environment setup](https://reactnative.dev/docs/set-up-your-environment) for your OS and target platform before you continue.
57
+ >
58
+ > The setup wizard is a Bash script, so run it on **macOS** or **Linux**. On Windows, use **WSL**.
59
+
60
+ ---
61
+
62
+ ## Installation
63
+
64
+ Create a new project with one command:
65
+
66
+ ```bash
67
+ npx new-react-native-boilerplate
68
+ ```
69
+
70
+ The interactive wizard asks for two things:
71
+
72
+ 1. **Project name**, for example `MyAwesomeApp`
73
+ 2. **Bundle ID**, for example `com.mycompany.myawesomeapp` (defaults to `com.<projectname>`)
74
+
75
+ ```text
76
+ ? What would you like to name your new project? › MyAwesomeApp
77
+ ? What is the bundle ID for your new project? › com.myawesomeapp
78
+ ```
79
+
80
+ When it finishes, your project is ready and your terminal is already inside the new project folder.
81
+
82
+ ---
83
+
84
+ ## What the Setup Wizard Does
85
+
86
+ After you answer the two prompts, the wizard runs these steps automatically:
87
+
88
+ 1. Creates a React Native project from this template with `@react-native-community/cli`.
89
+ 2. Renames the app and sets your bundle ID on iOS and Android with `react-native-rename`.
90
+ 3. Removes the template's helper files, such as `plugins/` and its setup scripts.
91
+ 4. Creates a default `.env` file. See [Environment Variables](#environment-variables).
92
+ 5. Installs JavaScript dependencies with `yarn`.
93
+ 6. Links fonts and assets with `react-native-asset`.
94
+ 7. Makes `android/gradlew` executable.
95
+ 8. Installs Ruby gems with `bundle install` and iOS pods with `yarn podinstall`.
96
+
97
+ ---
98
+
99
+ ## Running the App
100
+
101
+ ### 1. Start Metro
102
+
103
+ From the project root:
104
+
105
+ ```bash
106
+ yarn start
107
+ ```
108
+
109
+ To see app console logs in the Metro terminal, use this instead:
110
+
111
+ ```bash
112
+ yarn start-logs
113
+ ```
114
+
115
+ ### 2. Run on a device or simulator
116
+
117
+ Keep Metro running and open a **new terminal** in the project root.
118
+
119
+ #### Android
120
+
121
+ ```bash
122
+ yarn android
123
+ ```
124
+
125
+ #### iOS
126
+
127
+ ```bash
128
+ yarn ios
129
+ ```
130
+
131
+ To run on a specific simulator:
132
+
133
+ ```bash
134
+ yarn ios --simulator="iPhone 16 Pro"
135
+ ```
136
+
137
+ > If you add or update native dependencies, reinstall pods before running iOS:
138
+ >
139
+ > ```bash
140
+ > yarn podinstall
141
+ > ```
142
+
143
+ ### 3. Release builds (Android)
144
+
145
+ ```bash
146
+ yarn android-bundle-release # build a release bundle
147
+ yarn android-run-release # run the release variant
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Environment Variables
153
+
154
+ Environment variables are loaded from `.env` at the project root through `react-native-dotenv`. The wizard creates this file for you with values that work with the demo login and auth flow:
155
+
156
+ ```dotenv
157
+ ENV=DEV
158
+ BASE_API_URL=https://dummyjson.com
159
+ IMAGE_URL=https://dev-tn-file-server.s3.ap-south-1.amazonaws.com
160
+ ```
161
+
162
+ | Variable | Description |
163
+ | --- | --- |
164
+ | `ENV` | Current environment (`DEV`, `STAGING`, `PROD`) |
165
+ | `BASE_API_URL` | Base URL for all API requests made through Axios |
166
+ | `IMAGE_URL` | Base URL for remote images |
167
+
168
+ > ⚠️ Never commit real secrets. Keep `.env` out of version control and share values securely.
169
+ >
170
+ > After you change `.env`, restart Metro with a clean cache by running `yarn start`.
171
+
172
+ ---
173
+
174
+ ## Available Scripts
175
+
176
+ | Script | Description |
177
+ | --- | --- |
178
+ | `yarn start` | Start Metro with a cleared cache |
179
+ | `yarn start-logs` | Start Metro and stream app console logs |
180
+ | `yarn android` | Build and run the Android app |
181
+ | `yarn ios` | Build and run the iOS app |
182
+ | `yarn podinstall` | Install iOS CocoaPods through Bundler |
183
+ | `yarn asset` | Link fonts and assets with `react-native-asset` |
184
+ | `yarn test` | Run the Jest test suite |
185
+ | `yarn test:report` | Run tests with coverage and a JUnit report |
186
+ | `yarn lint` | Lint `.ts` and `.tsx` files with ESLint |
187
+ | `yarn tsc` | Type-check the project |
188
+ | `yarn precommit` | Run the type check and lint in parallel |
189
+ | `yarn android-bundle-release` | Build an Android release bundle |
190
+ | `yarn android-run-release` | Run the Android release variant |
191
+
192
+ ---
193
+
194
+ ## Project Structure
195
+
196
+ ```text
197
+ .
198
+ ├── android/ # Native Android project
199
+ ├── ios/ # Native iOS project
200
+ ├── __tests__/ # Jest tests
201
+ ├── src/
202
+ │ ├── App.tsx # App entry: providers and navigation
203
+ │ ├── assets/ # Fonts and images
204
+ │ ├── components/
205
+ │ │ ├── atoms/ # Basic building blocks (Text, Button, Image…)
206
+ │ │ └── molecules/ # Composite components (Inputs, Headers, Loader…)
207
+ │ ├── constants/ # API endpoints, fonts, image paths, storage keys
208
+ │ ├── models/ # TypeScript models for API data
209
+ │ ├── navigations/ # Auth stack, Main stack and Routes
210
+ │ ├── redux/ # Store, reducers (slices) and typed hooks
211
+ │ ├── screens/ # Home, Login, Signup, Onboarding, PostDetails
212
+ │ ├── services/ # Axios API service, auth and product services
213
+ │ ├── styles/ # Themes, breakpoints and Unistyles config
214
+ │ ├── translations/ # en, fr, ar language files and i18n setup
215
+ │ ├── typings/ # Global and env type declarations
216
+ │ └── utils/ # Helpers: storage, scaling, validation, theme
217
+ ├── .env # Environment variables (created by the wizard)
218
+ ├── babel.config.js
219
+ ├── metro.config.js
220
+ ├── tsconfig.json
221
+ └── package.json
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Libraries Included
227
+
228
+ | Category | Libraries |
229
+ | --- | --- |
230
+ | **Navigation** | [@react-navigation/native](https://www.npmjs.com/package/@react-navigation/native), [@react-navigation/native-stack](https://www.npmjs.com/package/@react-navigation/native-stack), [react-native-screens](https://www.npmjs.com/package/react-native-screens), [react-native-safe-area-context](https://www.npmjs.com/package/react-native-safe-area-context), [react-native-gesture-handler](https://www.npmjs.com/package/react-native-gesture-handler) |
231
+ | **State and data** | [@reduxjs/toolkit](https://www.npmjs.com/package/@reduxjs/toolkit), [react-redux](https://www.npmjs.com/package/react-redux), [axios](https://www.npmjs.com/package/axios), [react-native-mmkv](https://www.npmjs.com/package/react-native-mmkv) |
232
+ | **Forms** | [formik](https://www.npmjs.com/package/formik), [yup](https://www.npmjs.com/package/yup) |
233
+ | **Localization** | [i18next](https://www.npmjs.com/package/i18next), [react-i18next](https://www.npmjs.com/package/react-i18next), [@os-team/i18next-react-native-language-detector](https://www.npmjs.com/package/@os-team/i18next-react-native-language-detector) |
234
+ | **UI and animation** | [react-native-unistyles](https://www.npmjs.com/package/react-native-unistyles), [react-native-reanimated](https://www.npmjs.com/package/react-native-reanimated), [react-native-keyboard-aware-scroll-view](https://www.npmjs.com/package/react-native-keyboard-aware-scroll-view) |
235
+ | **Utilities** | [react-native-restart](https://www.npmjs.com/package/react-native-restart), [react-native-dotenv](https://www.npmjs.com/package/react-native-dotenv) |
236
+ | **Testing and tooling** | [jest](https://www.npmjs.com/package/jest), [@testing-library/react-native](https://www.npmjs.com/package/@testing-library/react-native), [eslint](https://www.npmjs.com/package/eslint), [prettier](https://www.npmjs.com/package/prettier), [husky](https://www.npmjs.com/package/husky), [commitlint](https://www.npmjs.com/package/commitlint) |
237
+
238
+ ---
239
+
240
+ ## Troubleshooting
241
+
242
+ <details>
243
+ <summary><strong>iOS: <code>pod install</code> fails</strong></summary>
244
+
245
+ ```bash
246
+ cd ios
247
+ bundle install
248
+ bundle exec pod install --repo-update
249
+ cd ..
250
+ ```
251
+
252
+ </details>
253
+
254
+ <details>
255
+ <summary><strong>Android: <code>Permission denied</code> for gradlew</strong></summary>
256
+
257
+ ```bash
258
+ chmod 755 android/gradlew
259
+ ```
260
+
261
+ </details>
262
+
263
+ <details>
264
+ <summary><strong>Metro shows stale code or env values</strong></summary>
265
+
266
+ ```bash
267
+ yarn start # already runs with --reset-cache
268
+ ```
269
+
270
+ If the problem continues, delete `node_modules` and reinstall:
271
+
272
+ ```bash
273
+ rm -rf node_modules && yarn
274
+ ```
275
+
276
+ </details>
277
+
278
+ <details>
279
+ <summary><strong>Fonts or images not showing</strong></summary>
280
+
281
+ ```bash
282
+ yarn asset
283
+ ```
284
+
285
+ Then rebuild the native app with `yarn android` or `yarn ios`.
286
+
287
+ </details>
288
+
289
+ ---
290
+
291
+ ## Contributing
292
+
293
+ Contributions, issues and feature requests are welcome.
294
+
295
+ 1. Fork the [repository](https://github.com/sharmahardik59/RNBoilerplate).
296
+ 2. Create a branch: `git checkout -b feature/my-feature`.
297
+ 3. Commit your changes: `git commit -m "feat: add my feature"`.
298
+ 4. Push the branch: `git push origin feature/my-feature`.
299
+ 5. Open a Pull Request.
300
+
301
+ Found a bug? [Open an issue](https://github.com/sharmahardik59/RNBoilerplate/issues).
302
+
303
+ ---
304
+
305
+ ## Acknowledgements
306
+
307
+ This project was inspired by [theCodingMachine's React Native Boilerplate](https://github.com/thecodingmachine/react-native-boilerplate). Its architecture and design principles were adapted to fit this project's needs. Thanks to them for their contributions to the React Native community.
308
+
309
+ ---
310
+
311
+ ## License
312
+
313
+ [MIT](./LICENSE) © Hardik Sharma
314
+
315
+ If this boilerplate helps you, please ⭐ [star the repo](https://github.com/sharmahardik59/RNBoilerplate).
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "new-react-native-boilerplate",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "A React Native boilerplate for building cross-platform mobile apps.",
5
+ "bin": {
6
+ "new-react-native-boilerplate": "run.sh"
7
+ },
8
+ "files": [
9
+ "run.sh",
10
+ "setup.js",
11
+ "template.config.js",
12
+ "template"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/sharmahardik59/RNBoilerplate.git"
17
+ },
18
+ "keywords": [
19
+ "react-native",
20
+ "react-native-rename",
21
+ "starter-kit",
22
+ "typescript",
23
+ "javascript",
24
+ "boilerplate",
25
+ "code",
26
+ "latest",
27
+ "dynamic",
28
+ "bundleId",
29
+ "smooth",
30
+ "performance",
31
+ "experience",
32
+ "hybrid",
33
+ "android",
34
+ "iOS",
35
+ "mobile application"
36
+ ],
37
+ "author": "Hardik Sharma",
38
+ "license": "MIT",
39
+ "bugs": {
40
+ "url": "https://github.com/sharmahardik59/RNBoilerplate/issues"
41
+ },
42
+ "homepage": "https://github.com/sharmahardik59/RNBoilerplate#readme",
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "dependencies": {
47
+ "kleur": "^4.1.5",
48
+ "prompts": "^2.4.2",
49
+ "fs-extra": "^11.4.1"
50
+ }
51
+ }
package/run.sh ADDED
@@ -0,0 +1,36 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # --- START: Resolve the actual script directory ---
5
+ # This handles script being run as a symlink, which is what npx does.
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -L "$SOURCE" ]; do # Use -L to check for symlink, more portable than -h
8
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
11
+ done
12
+ SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
13
+ # --- END: Resolve the actual script directory ---
14
+
15
+ # Run the setup script using its absolute path
16
+ node "$SCRIPT_DIR/setup.js"
17
+
18
+ # Find the latest created directory, which will be our project
19
+ PROJECT_NAME=$(ls -td -- */ | head -n 1 | cut -d'/' -f1)
20
+
21
+ # Check if a project name was found
22
+ if [ -z "$PROJECT_NAME" ]; then
23
+ echo "Could not determine the project directory. Please 'cd' into it manually."
24
+ exit 1
25
+ fi
26
+
27
+ # Change into the project directory
28
+ cd "$PROJECT_NAME"
29
+
30
+ # You can add any other commands you want to run inside the project directory here
31
+ echo "Successfully changed into the project directory: $PROJECT_NAME"
32
+ echo "You are now in the project directory. You can run your yarn commands."
33
+
34
+ # Optional: Start an interactive shell session in the new directory
35
+ # This will keep the terminal open in the new directory
36
+ exec "$SHELL"
package/setup.js ADDED
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("child_process");
4
+ const prompts = require("prompts");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+
8
+ async function main() {
9
+ console.log(`
10
+ '########::'########::::'###:::::'######::'########::::::::::'##::: ##::::'###::::'########:'####:'##::::'##:'########:
11
+ ##.... ##: ##.....::::'## ##:::'##... ##:... ##..::::::::::: ###:: ##:::'## ##:::... ##..::. ##:: ##:::: ##: ##.....::
12
+ ##:::: ##: ##::::::::'##:. ##:: ##:::..::::: ##::::::::::::: ####: ##::'##:. ##::::: ##::::: ##:: ##:::: ##: ##:::::::
13
+ ########:: ######:::'##:::. ##: ##:::::::::: ##::::'#######: ## ## ##:'##:::. ##:::: ##::::: ##:: ##:::: ##: ######:::
14
+ ##.. ##::: ##...:::: #########: ##:::::::::: ##::::........: ##. ####: #########:::: ##::::: ##::. ##:: ##:: ##...::::
15
+ ##::. ##:: ##::::::: ##.... ##: ##::: ##:::: ##::::::::::::: ##:. ###: ##.... ##:::: ##::::: ##:::. ## ##::: ##:::::::
16
+ ##:::. ##: ########: ##:::: ##:. ######::::: ##::::::::::::: ##::. ##: ##:::: ##:::: ##::::'####:::. ###:::: ########:
17
+ ..:::::..::........::..:::::..:::......::::::..::::::::::::::..::::..::..:::::..:::::..:::::....:::::...:::::........::
18
+ `);
19
+ console.log("Welcome to the React Native BoilerPlate!");
20
+
21
+ const questions = [
22
+ {
23
+ type: "text",
24
+ name: "projectName",
25
+ message: "What would you like to name your new project?",
26
+ validate: (value) => (value ? true : "Project name cannot be empty."),
27
+ },
28
+ {
29
+ type: "text",
30
+ name: "bundleId",
31
+ message: "What is the bundle ID for your new project?",
32
+ initial: (prev) => `com.${prev.toLowerCase()}`,
33
+ validate: (value) => (value ? true : "Bundle ID cannot be empty."),
34
+ },
35
+ ];
36
+
37
+ let canceled = false;
38
+ const { projectName, bundleId } = await prompts(questions, {
39
+ onCancel: () => {
40
+ canceled = true;
41
+ },
42
+ });
43
+
44
+ if (canceled) {
45
+ console.log("\nSetup canceled. No changes were made.");
46
+ process.exit(0);
47
+ }
48
+
49
+ const projectPath = path.join(process.cwd(), projectName);
50
+
51
+ try {
52
+ console.log(`\nCreating new project at: ${projectPath}...`);
53
+ execSync(
54
+ `npx @react-native-community/cli init "${projectName}" --template new-react-native-boilerplate@git+https://github.com/sharmahardik59/RNBoilerplate.git --pm yarn`,
55
+ { stdio: "inherit" }
56
+ );
57
+
58
+ console.log(
59
+ `\nRenaming project to "${projectName}" with bundle ID "${bundleId}"...`
60
+ );
61
+ execSync(
62
+ `npx react-native-rename "${projectName}" -b "${bundleId}" --skipGitStatusCheck`,
63
+ {
64
+ cwd: projectPath,
65
+ stdio: "inherit",
66
+ }
67
+ );
68
+
69
+ // Final cleanup
70
+ const finalPackageJsonPath = path.join(projectPath, "package.json");
71
+ if (fs.existsSync(finalPackageJsonPath)) {
72
+ const packageJson = JSON.parse(
73
+ fs.readFileSync(finalPackageJsonPath, "utf8")
74
+ );
75
+ delete packageJson.scripts.setup; // remove old setup script if it exists
76
+ delete packageJson.scripts.postinstall; // remove old postinstall script
77
+ fs.writeFileSync(
78
+ finalPackageJsonPath,
79
+ JSON.stringify(packageJson, null, 2)
80
+ );
81
+ }
82
+ const oldSetupJsPath = path.join(projectPath, "setup.js");
83
+ if (fs.existsSync(oldSetupJsPath)) {
84
+ fs.unlinkSync(oldSetupJsPath);
85
+ }
86
+
87
+ // Remove plugins directory
88
+ const pluginsPath = path.join(projectPath, "plugins");
89
+ if (fs.existsSync(pluginsPath)) {
90
+ console.log("\nRemoving plugins directory...");
91
+ fs.rmSync(pluginsPath, { recursive: true, force: true });
92
+ }
93
+
94
+ // Create .env file
95
+ const envContent = `ENV=DEV
96
+ BASE_API_URL=https://dummyjson.com
97
+ IMAGE_URL=https://dev-tn-file-server.s3.ap-south-1.amazonaws.com`;
98
+ const envPath = path.join(projectPath, ".env");
99
+ console.log("\nCreating .env file...");
100
+ fs.writeFileSync(envPath, envContent);
101
+
102
+ // Create run.sh file
103
+ const runShContent = `#!/bin/bash
104
+ yarn
105
+ npx react-native-asset
106
+ chmod 755 android/gradlew
107
+ bundle install
108
+ yarn podinstall
109
+ rm -rf run.sh`;
110
+ const runShPath = path.join(projectPath, "run.sh");
111
+ console.log("\nCreating run.sh file...");
112
+ fs.writeFileSync(runShPath, runShContent);
113
+ execSync(`chmod +x run.sh`, {
114
+ cwd: projectPath,
115
+ stdio: "inherit",
116
+ });
117
+
118
+ console.log("\nRunning initial setup script...");
119
+ execSync(`./run.sh`, {
120
+ cwd: projectPath,
121
+ stdio: "inherit",
122
+ });
123
+
124
+ console.log(
125
+ `\n✅ Success! Your new project "${projectName}" is ready.\n\n`
126
+ );
127
+ console.log(
128
+ `You can now run the following commands to start your project:\n`
129
+ );
130
+ console.log(`yarn android\nyarn ios --simulator="iPhone 15 Pro"`);
131
+ console.log(
132
+ `\nTo display console logs in your Metro bundler terminal, run the following command:\n`
133
+ );
134
+ console.log(`yarn start-logs\n\n`);
135
+ } catch (err) {
136
+ console.error(`\n❌ An error occurred during setup: ${err.message}`);
137
+ process.exit(1);
138
+ }
139
+ }
140
+
141
+ main();
@@ -0,0 +1,2 @@
1
+ BUNDLE_PATH: "vendor/bundle"
2
+ BUNDLE_FORCE_RUBY_PLATFORM: 1
@@ -0,0 +1,14 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+ end_of_line = lf
10
+ # editorconfig-tools is unable to ignore longs strings or urls
11
+ max_line_length = off
12
+
13
+ [CHANGELOG.md]
14
+ indent_size = false
@@ -0,0 +1,49 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ es2024: true,
5
+ },
6
+ extends: [
7
+ '@react-native',
8
+ 'eslint:recommended',
9
+ 'plugin:@typescript-eslint/recommended',
10
+ 'plugin:react/recommended',
11
+ 'airbnb',
12
+ 'airbnb-typescript',
13
+ 'airbnb-typescript/base',
14
+ 'standard',
15
+ ],
16
+ ignorePatterns: ['plugins/**/*', 'metro.config.js'],
17
+ parser: '@typescript-eslint/parser',
18
+ parserOptions: {
19
+ ecmaVersion: 'latest',
20
+ project: './tsconfig.json',
21
+ sourceType: 'module',
22
+ tsconfigRootDir: '.',
23
+ },
24
+ plugins: ['@typescript-eslint', 'react'],
25
+ root: true,
26
+ rules: {
27
+ '@typescript-eslint/comma-dangle': 0,
28
+ '@typescript-eslint/no-shadow': ['error'],
29
+ '@typescript-eslint/quotes': 0,
30
+ 'import/no-cycle': 0,
31
+ 'no-shadow': 0,
32
+ 'no-undef': 0,
33
+ 'object-curly-newline': 0,
34
+ 'react/function-component-definition': 0,
35
+ 'react/jsx-props-no-spreading': 0,
36
+ 'react/require-default-props': 0,
37
+ },
38
+ settings: {
39
+ 'import/resolver': {
40
+ node: {
41
+ extensions: ['.ts', '.tsx'],
42
+ },
43
+ typescript: {},
44
+ },
45
+ react: {
46
+ version: '18.x',
47
+ },
48
+ },
49
+ };
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx --no -- commitlint --edit ${1}
@@ -0,0 +1 @@
1
+ npm test
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ arrowParens: 'avoid',
3
+ printWidth: 100,
4
+ singleQuote: true,
5
+ trailingComma: 'all',
6
+ };
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
+ ruby ">= 2.6.10"
5
+
6
+ # Exclude problematic versions of cocoapods and activesupport that causes build failures.
7
+ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8
+ gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9
+ gem 'xcodeproj', '< 1.26.0'
10
+ gem 'concurrent-ruby', '< 1.3.4'
11
+
12
+ # Ruby 3.4.0 has removed some libraries from the standard library.
13
+ gem 'bigdecimal'
14
+ gem 'logger'
15
+ gem 'benchmark'
16
+ gem 'mutex_m'
17
+ gem 'nkf'