├── .DS_Store ├── docs ├── .DS_Store └── assets │ ├── .DS_Store │ └── images │ ├── AppcenterSecret.png │ ├── CodePushKey.png │ ├── DeploymentKeys.png │ ├── EditScheme.png │ ├── PublicKey.png │ ├── Staging.png │ └── change_environment.png ├── node_modules └── .yarn-integrity ├── package.json ├── readme.md ├── template.config.js ├── template ├── .eslintignore ├── .eslintrc.json ├── .gitattributes ├── .github │ ├── pull_request_template.md │ └── workflows │ │ ├── android.yml │ │ ├── ios.yml │ │ └── linting.yml ├── .gitignore ├── .husky │ └── pre-commit ├── .prettierrc.js ├── .vscode │ └── settings.json ├── .watchmanconfig ├── App.tsx ├── Gemfile ├── Providers.tsx ├── __tests__ │ └── App-test.tsx ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── appcenter-config.json │ │ │ ├── java │ │ │ └── com │ │ │ │ └── myapp │ │ │ │ ├── MainActivity.kt │ │ │ │ └── MainApplication.kt │ │ │ └── res │ │ │ ├── drawable │ │ │ └── rn_edit_text_material.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── bootsplash_logo.png │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── bootsplash_logo.png │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── bootsplash_logo.png │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── bootsplash_logo.png │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── bootsplash_logo.png │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── codePushPublicKey.pem ├── index.js ├── ios │ ├── .xcode.env │ ├── MyApp.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── MyApp.xcscheme │ │ │ ├── MyAppDev.xcscheme │ │ │ ├── MyAppStage.xcscheme │ │ │ └── MyAppUAT.xcscheme │ ├── MyApp.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ ├── MyApp │ │ ├── AppCenter-Config.plist │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── BootSplash.storyboard │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ ├── BootSplashLogo.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── bootsplash_logo.png │ │ │ │ ├── bootsplash_logo@2x.png │ │ │ │ └── bootsplash_logo@3x.png │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ ├── PrivacyInfo.xcprivacy │ │ └── main.m │ ├── MyAppDev-Info.plist │ ├── MyAppStage-Info.plist │ ├── MyAppTests │ │ ├── Info.plist │ │ └── MyAppTests.m │ ├── MyAppUAT-Info.plist │ ├── Podfile │ └── Podfile.lock ├── jest.config.js ├── lint-staged.js ├── metro.config.js ├── package.json ├── react-native.config.js ├── src │ ├── api │ │ ├── endpoints.ts │ │ └── services.ts │ ├── assets │ │ ├── animations │ │ │ └── 404.json │ │ └── images │ │ │ └── reactnative.png │ ├── components │ │ ├── base │ │ │ ├── Button │ │ │ │ ├── index.style.ts │ │ │ │ └── index.tsx │ │ │ ├── Divider │ │ │ │ ├── index.styles.ts │ │ │ │ └── index.tsx │ │ │ ├── IconButton │ │ │ │ ├── index.styles.ts │ │ │ │ └── index.tsx │ │ │ ├── Image │ │ │ │ └── index.ts │ │ │ ├── Text │ │ │ │ ├── index.styles.ts │ │ │ │ └── index.tsx │ │ │ └── TextInput │ │ │ │ ├── index.styles.ts │ │ │ │ └── index.tsx │ │ ├── common │ │ │ ├── Container │ │ │ │ ├── index.styles.ts │ │ │ │ └── index.tsx │ │ │ └── LoadingFullScreen │ │ │ │ ├── index.styles.ts │ │ │ │ └── index.tsx │ │ └── svgs │ │ │ └── ChartIcon.tsx │ ├── configs │ │ ├── axios.ts │ │ ├── environments.ts │ │ ├── https.ts │ │ ├── index.ts │ │ ├── showMessage.ts │ │ ├── storage.ts │ │ └── toast.ts │ ├── hooks │ │ ├── useDispatch.ts │ │ ├── useSelector.ts │ │ └── useTheme.ts │ ├── navigation │ │ └── index.tsx │ ├── redux │ │ ├── index.ts │ │ ├── theme │ │ │ └── index.ts │ │ └── user │ │ │ └── index.ts │ ├── screens │ │ ├── Error │ │ │ ├── index.styles.ts │ │ │ └── index.tsx │ │ ├── Home │ │ │ ├── index.styles.ts │ │ │ └── index.tsx │ │ └── index.ts │ ├── translations │ │ ├── index.ts │ │ └── resources │ │ │ ├── ar.json │ │ │ ├── en.json │ │ │ ├── es.json │ │ │ └── index.ts │ └── utils │ │ ├── constants │ │ ├── index.ts │ │ ├── navigation.constants.ts │ │ ├── navigationList.constants.ts │ │ ├── theme.constants.ts │ │ └── translation.constants.ts │ │ ├── enums │ │ ├── errors.enums.ts │ │ └── reducers.enums.ts │ │ ├── helpers │ │ ├── index.ts │ │ ├── responsive.helpers.ts │ │ └── transalation.helpers.ts │ │ └── types │ │ ├── api.types.ts │ │ ├── index.ts │ │ ├── navigation.types.ts │ │ └── redux │ │ ├── theme.type.ts │ │ └── user.type.ts ├── tsconfig.json └── yarn.lock └── yarn.lock /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/.DS_Store -------------------------------------------------------------------------------- /docs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/.DS_Store -------------------------------------------------------------------------------- /docs/assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/assets/.DS_Store -------------------------------------------------------------------------------- /docs/assets/images/AppcenterSecret.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/assets/images/AppcenterSecret.png -------------------------------------------------------------------------------- /docs/assets/images/CodePushKey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/assets/images/CodePushKey.png -------------------------------------------------------------------------------- /docs/assets/images/DeploymentKeys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/assets/images/DeploymentKeys.png -------------------------------------------------------------------------------- /docs/assets/images/EditScheme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/assets/images/EditScheme.png -------------------------------------------------------------------------------- /docs/assets/images/PublicKey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/assets/images/PublicKey.png -------------------------------------------------------------------------------- /docs/assets/images/Staging.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/assets/images/Staging.png -------------------------------------------------------------------------------- /docs/assets/images/change_environment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/docs/assets/images/change_environment.png -------------------------------------------------------------------------------- /node_modules/.yarn-integrity: -------------------------------------------------------------------------------- 1 | { 2 | "systemParams": "win32-x64-108", 3 | "modulesFolders": [ 4 | "node_modules" 5 | ], 6 | "flags": [], 7 | "linkedModules": [], 8 | "topLevelPatterns": [], 9 | "lockfileEntries": {}, 10 | "files": [], 11 | "artifacts": {} 12 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNCodePush-template", 3 | "version": "0.0.1", 4 | "description": "React Native CodePush Template", 5 | "repository": "https://github.com/SMKH-PRO/ReactNative_CodePush_Template.git", 6 | "author": "Kashaan Haider ", 7 | "license": "MIT" 8 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## DESCRIPTION 3 | 4 | A React Native Template/Boilerplate containing the best practices and scalable design with cutting edge technologies like CodePush/Sentry and all other neccessary libraries pre-configured and basic helper functions and components to help you save your time and make your App super fast. 5 | 6 | 7 | ### FEATURES 8 | What It Contains? 9 | 10 | 1. CodePush Configuration (It allows your app to update over the air OTA, without publishing new apk/binary to AppStore / PlayStore) 11 | 12 | 2. Build a different environment of code push release . 13 | 14 | 3. Multiple enviornment support (Prod, Stage, UAT, Dev). 15 | 16 | 4. Sentry (sentry.io) Setup (It will send you emails when there's a critical error found on the production app) 17 | 18 | 5. Complete error handling (App won't just close/crash on critical error but will show a responsive error page with a button to re-launch the application) . 19 | 20 | 6. Completely responsive basic UI components that are required in every app (such as Buttons) 21 | 22 | 7. Typed Hooks ( 23 | useSelector, useDispatch, useTheme, more to come) . 24 | 25 | 8. Complete redux integration with persisting and proper typescript types. 26 | 27 | 9. Integration of secure storage for saving confidential information like tokens 28 | 29 | 10. Navigation configured with an easily editable array of objects where you can define which route to show on auth and which to hide. 30 | 31 | 11. Translation support for multilingual apps. 32 | 33 | 12. Configured with best eslint and typescript settings for react-native. 34 | 35 | 13. Redux managed useTheme Hook, easily use or change App's whole theme, such as programmatically changing to nightmode. 36 | 37 | 14. Last but not least, a clean folder structure and best practices are followed throughout the code. 38 | 39 | 40 | 41 | --- 42 | 43 | ## INITIALIZE RN WITH THIS TEMPLATE 44 | 45 | Command:
46 | 47 | ``` 48 | npx react-native init AppName --template https://github.com/SMKH-PRO/ReactNative_CodePush_Template.git 49 | ``` 50 | 51 | --- 52 | 53 | # STEPS TO FOLLOW 54 | 55 | 56 | ## 1. Install dependencies 57 | 58 | **Note:** Dependencies will most probably be automatically installed when you initialize the project so you can skip this step. 59 | 60 | Commands:
61 | 62 | 1. `yarn` or `npm i`
63 | and also install Pods:
64 | 1. `cd ios` 65 | 1. `pod install` 66 | 67 | --- 68 | ## 2. Prepare Husky 69 | 70 | This project is pre-configured with husky, but you've to follow a few steps to enable it for you! 71 | before going through the following steps, please make sure that the project is initialized inside a git repository. 72 | 73 | 1. Open `package.json` file 74 | 2. In the `scripts` object add new property `prepare` with value `husky install`. 75 |
Your Scripts object will look something like this: 76 | 77 | ``` 78 | "scripts": { 79 | // other script ... 80 | "prepare":"husky install" 81 | } 82 | ``` 83 | 84 | 3. Run the newly added script with command `yarn prepare` or `npm run prepare` 85 | 86 | that's it, husky is now succesfully installed with a pre-commit that will check linting everytime you commit. 87 | 88 | --- 89 | ## 3. Setup Sentry 90 | 91 | Commands: 92 | ``` 93 | npx @sentry/wizard -i reactNative -p ios android 94 | ``` 95 | 96 | modify the SENTRY URL from .env file (if .env does not exist, make one with "SENTRY" variable). 97 | 98 | Your .env file will look like this: 99 | 100 | ``` 101 | SENTRY=https://a13f12a6c6274fd9a22a2759135e5ce5@o1305163.ingest.sentry.io/6629304 102 | 103 | ``` 104 | --- 105 | 106 | # 4. CodePush Setup 107 | 108 | CodePush is pre-configured but you need to setup your keys, to do that follow the steps below: 109 | 110 | **Install CLI**
111 | `npm install -g appcenter-cli` 112 | 113 | **Generate Private Key files for code signing:**
114 | We will need these files later for code signing in Android & iOS 115 | Commands:

116 | **For Private Key:**
117 | ``` 118 | openssl genrsa -out codePushPrivateKey.pem 119 | ``` 120 | 121 | **For Public Key:**
122 | ``` 123 | openssl rsa -pubout -in codePushPrivateKey.pem -out codePushPublicKey.pem 124 | ``` 125 | 126 | --- 127 | ### CodePush iOS Setup 128 | 129 | **Integrate the SDK in iOS** 130 | 131 | Open `ios/AppName/AppCenter-Config.plist` file in XCODE or VS and replace `{Your app secret here}` with your actual app secret key. 132 | 133 | The `AppCenter-Config.plist` file looks like this when you open with VS CODE: 134 | 135 | ``` 136 | 137 | 138 | 139 | 140 | AppSecret 141 | {Your app secret here} 142 | 143 | 144 | 145 | ``` 146 | 147 |
148 | 149 | And will look like following on XCODE:
150 | 151 | ![XCODE AppCenter-Config.plist screenshot](./docs/assets/images/AppcenterSecret.png "Picture guide XCode Screenshot showing AppCenter-Config.plist file ") 152 | Double click on the `{Your app secret here}` and replace the value with actual app secret. 153 | 154 | **Reminder:** You can get the app secret from codepush app's overview page. 155 | 156 | --- 157 | 158 | ### MutliDeployment Configuration iOS 159 | 160 | Custom build setting has already been configured in iOS but you need to add your deployment keys. 161 | 162 | To set this up, follow these steps: 163 | 164 | 1. Open up your Xcode project and select your project in the Project navigator window 165 | 166 | 2. Ensure the project node is selected, as opposed to one of your targets 167 | 168 | 3. Select the Build Settings tab 169 | 170 | 4. In `User-Defined` section, You'll see a setting named "CODEPUSH_KEY" open this setting and write your `staging`and `Release` deployment keys. 171 | 172 | ![XCODE Build Setting screenshot](./docs/assets/images/CodePushKey.png "Picture guide for step #4 ") 173 | 174 | Replace `DEPLOYMENT_KEY_FOR_PRODUCTION` with your `Production` key, and `DEPLOYMENT_KEY_FOR_STAGING` with your `Staging` key 175 | 176 | And that's it! Now when you run or build your app, your staging builds will automatically be configured to sync with your Staging deployment, and your release builds will be configured to sync with your Production deployment. 177 | 178 | --- 179 | ### How to create staging release on iOS?
180 | 181 | To create a staging build you can just edit scheme to `Staging`.
182 | 183 | **Picture Guide** 184 | 185 | Edit Scheme: 186 | ![XCODE EditScheme screenshot](./docs/assets/images/EditScheme.png "Picture guide for staging release on iOS") 187 | 188 | Scheme Selection: 189 | ![XCODE Staging Scheme screenshot](./docs/assets/images/Staging.png "Picture guide for staging release on iOS") 190 | 191 | That's it, Now after selecting `Staging` for `Archive build`, you'll get the staging App when you build archive release. 192 | 193 | --- 194 | ### Code Signing For iOS 195 | 196 | In order to configure Public Key for bundle verification you need to edit record in Info.plist with name CodePushPublicKey and string value of public key content.
197 | Replace the current public key with your own.
198 | 199 | Example: 200 | 201 | ``` 202 | 203 | 204 | 205 | 206 | CodePushPublicKey 207 | -----BEGIN PUBLIC KEY----- 208 | MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANkWYydPuyOumR/sn2agNBVDnzyRpM16NAUpYPGxNgjSEp0etkDNgzzdzyvyl+OsAGBYF3jCxYOXozum+uV5hQECAwEAAQ== 209 | -----END PUBLIC KEY----- 210 | 211 | 212 | 213 | 214 | 215 | ``` 216 | 217 | **Picture Guide For Editing Public Key:** 218 | ![XCODE info.plist screenshot](./docs/assets/images/PublicKey.png "Picture guide for editing public key iOS") 219 | 220 | --- 221 | ### CodePush Android Setup 222 | 223 | **Integrate the SDK in Android**
224 | 225 | Open file with the filename `appcenter-config.json` in `android/app/src/main/assets/` with the following content: 226 | 227 | ``` 228 | { 229 | "app_secret": "{Your app secret here}" 230 | } 231 | ``` 232 | 233 | Replace `{Your app secret here}` with your actual app secret. 234 | 235 | --- 236 | 237 | ### MutliDeployment Configuration Android 238 | 239 | 1. Open the project's app level `build.gradle` file (for example `android/app/build.gradle` in standard React Native projects) 240 | 241 | 2. Find the android `{ productFlavors {} }` section and edit `resValue` entries for both your `Staging` and `Production` build variants also replace AppName strings with your actual App Display Name. 242 | 243 | If you're in the correct gradle file, It will look like this: 244 | 245 | ![XCODE android build.gradle screenshot](./docs/assets/images/change_environment.png "Picture guide for editing public key iOS") 246 | 247 | 248 | From this file replace `` with your own Deployment key for `Staging`.
249 | 250 | and Replace `` with your deployment key for `Production`.
251 | 252 | and Replace `appName` with your actual App Display Name.
253 | 254 | That's it, No need to change anything else in this file. 255 | 256 | --- 257 | 258 | ### How to create staging release on Android?
259 | 260 | Note: the following commands assume that you're not already in the `Android` folder, if you're already inside project's android folder just ignore the `cd android &&` part of the commands. 261 | 262 | To build an staging apk, the command for that will be 263 | ``` 264 | cd android && ./gradlew assembleStagingRelease 265 | ``` 266 | 267 | and you'll find the output on `android/app/build/outputs/apk/staging` 268 |
269 | 270 | **For Production Build** 271 | ``` 272 | cd android && ./gradlew assembleProductionRelease 273 | ``` 274 | and you'll find the output on `android/app/build/outputs/apk/production`

275 | **OR BUILD BOTH** 276 | 277 | ``` 278 | // It will create the Apk for both, production and staging. 279 | 280 | cd android && ./gradlew assembleRelease 281 | 282 | ``` 283 | and you'll find the output on `android/app/build/outputs/apk/staging` and `android/app/build/outputs/apk/production` both. 284 | 285 | **Same goes for Bundle Release** 286 | 287 | ``` 288 | // For Production 289 | cd android && ./gradlew bundleProductionRelease 290 | 291 | // For Staging 292 | cd android && ./gradlew bundleStagingRelease 293 | 294 | // Will generate bundle for Production & Staging, Both. 295 | cd android && ./gradlew assembleRelease 296 | 297 | ``` 298 | 299 | 300 | --- 301 | ### Code Signing For Android 302 | 303 | Edit `CodePushPublicKey` string item in `/path_to_your_app/android/app/src/main/res/values/strings.xml` file, It may looks like this: 304 | 305 | ``` 306 | 307 | my_app 308 | -----BEGIN PUBLIC KEY----- 309 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtPSR9lkGzZ4FR0lxF+ZA 310 | P6jJ8+Xi5L601BPN4QESoRVSrJM08roOCVrs4qoYqYJy3Of2cQWvNBEh8ti3FhHu 311 | tiuLFpNdfzM4DjAw0Ti5hOTfTixqVBXTJPYpSjDh7K6tUvp9MV0l5q/Ps3se1vud 312 | M1/X6g54lIX/QoEXTdMgR+SKXvlUIC13T7GkDHT6Z4RlwxkWkOmf2tGguRcEBL6j 313 | ww7w/3g0kWILz7nNPtXyDhIB9WLH7MKSJWdVCZm+cAqabUfpCFo7sHiyHLnUxcVY 314 | OTw3sz9ceaci7z2r8SZdsfjyjiDJrq69eWtvKVUpredy9HtyALtNuLjDITahdh8A 315 | zwIDAQAB 316 | -----END PUBLIC KEY----- 317 | 318 | ``` 319 | 320 | Replace the previous `PUBLIC KEY` with your own. 321 |
322 | 323 | --- 324 | 325 | ### How to get CodePush deployment keys?
326 | 327 | As a reminder, you can retrieve deployment keys by running command `appcenter codepush deployment list -a / -k` from your terminal
328 | 329 | **OR**
330 | 331 | Go to `CodePush` dashboard open the app and navigate to `distribute > codepush` now, on this screen click on `Create standard deployments` button, after clicking this button you'll see a setting icon at top right corner, click on it and you'll get deployment keys for both staging and production deployment/environments. 332 | 333 | ![XCODE Staging Scheme screenshot](./docs/assets/images/DeploymentKeys.png "Picture guide for staging release on iOS") 334 | 335 | --- 336 | ### Change Package.json Scripts. 337 | 338 | The package.json file has script to create codepush releases.
339 | it may look like this: 340 | 341 | ``` 342 | "scripts": { 343 | "codepush-android-stage": "appcenter codepush release-react -a owner/appName -d Staging -k codePushPrivateKey.pem --sourcemap-output --output-dir ./build", 344 | "codepush-android-prod": "appcenter codepush release-react -a owner/Appname -d Production -k codePushPrivateKey.pem --sourcemap-output --output-dir ./build", 345 | "codepush-ios-stage": "appcenter codepush release-react -a owner/appName -d Staging -k codePushPrivateKey.pem --sourcemap-output --output-dir ./build", 346 | "codepush-ios-prod" 347 | ... 348 | } 349 | ``` 350 | From all these 4 scripts, you need to replace `owner/appName` with your actual `Owner Name` and `App Name`. 351 | 352 | Done. 353 | 354 | --- 355 |
356 | 357 | ### MOTIVATON: 358 | I used to initialize all my react-native projects with this configuration so I thought why not make it a template maybe it may help others save time too!. 359 | 360 |
361 | 362 | --- 363 | 364 | 365 |

--- END OF DOCS ---

366 | -------------------------------------------------------------------------------- /template.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // Placeholder used to rename and replace in files 3 | // package.json, index.json, android/, ios/ 4 | placeholderName: "MyApp", 5 | 6 | // Directory with template 7 | templateDir: "./template", 8 | 9 | }; -------------------------------------------------------------------------------- /template/.eslintignore: -------------------------------------------------------------------------------- 1 | *.js 2 | __tests__ -------------------------------------------------------------------------------- /template/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true, 5 | "node": true 6 | }, 7 | "extends": [ 8 | "@react-native", 9 | "plugin:react/all", 10 | "airbnb", 11 | "airbnb-typescript", 12 | "airbnb/hooks", 13 | "prettier", 14 | "plugin:@typescript-eslint/recommended", 15 | "plugin:@typescript-eslint/recommended-requiring-type-checking", 16 | "plugin:react/jsx-runtime", 17 | "plugin:promise/recommended", 18 | "plugin:react-native/all" 19 | ], 20 | "parserOptions": { 21 | "project": "./tsconfig.json", 22 | "ecmaFeatures": { 23 | "jsx": true 24 | }, 25 | "ecmaVersion": "latest", 26 | "sourceType": "module" 27 | }, 28 | "parser": "@typescript-eslint/parser", 29 | "plugins": [ 30 | "import", 31 | "react", 32 | "@typescript-eslint", 33 | "promise", 34 | "prettier", 35 | "@react-native-community", 36 | "react", 37 | "react-native" 38 | ], 39 | "rules": { 40 | "@typescript-eslint/default-param-last": "warn", 41 | "@typescript-eslint/no-floating-promises": "warn", 42 | "@typescript-eslint/no-unsafe-argument": "warn", 43 | "@typescript-eslint/no-unsafe-assignment": "warn", 44 | "react/jsx-props-no-spreading": "warn", 45 | "promise/prefer-await-to-then": "warn", 46 | "no-promise-executor-return": "warn", 47 | "react-hooks/exhaustive-deps": "warn", 48 | "import/prefer-default-export": "off", 49 | "react/sort-default-props": "off", 50 | "react/jsx-uses-react": 1, 51 | "@typescript-eslint/no-unused-vars": "error", 52 | "react/jsx-no-bind": "error", 53 | "react/function-component-definition": [ 54 | 2, 55 | { 56 | "namedComponents": "arrow-function", 57 | "unnamedComponents": "arrow-function" 58 | } 59 | ], 60 | "react/jsx-filename-extension": [1, { "extensions": [".tsx"] }], 61 | // "prettier/prettier": [ 62 | // "error", 63 | // { 64 | // "endOfLine": "auto" 65 | // } 66 | // ], 67 | "@typescript-eslint/no-misused-promises": [ 68 | "error", 69 | { 70 | "checksVoidReturn": false 71 | } 72 | ], 73 | "react-native/no-color-literals": "off", 74 | "react-native/no-raw-text": "off", 75 | "no-param-reassign": ["error", { "props": false }] 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /template/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /template/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | 4 | 5 | 6 | 7 | ## Screenshots (if appropriate): 8 | 9 | ## Type of change 10 | 11 | Please delete options that are not relevant. 12 | 13 | - [ ] Bug fix (non-breaking change which fixes an issue) 14 | - [ ] New feature (non-breaking change which adds functionality) 15 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 16 | 17 | # Checklist: 18 | 19 | - [ ] My code follows the style guidelines of this project 20 | - [ ] I have performed a self-review of my code 21 | - [ ] I have commented my code, particularly in hard-to-understand areas 22 | - [ ] My changes generate no new warnings 23 | - [ ] I have added tests that prove my fix is effective or that my feature works 24 | - [ ] New and existing unit tests pass locally with my changes 25 | -------------------------------------------------------------------------------- /template/.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | on: 4 | # Trigger the workflow on push or pull request, 5 | # but only for the main branch 6 | pull_request: 7 | branches: 8 | - main 9 | - develop 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v3 18 | - name: set up JDK 11 19 | uses: actions/setup-java@v3 20 | with: 21 | java-version: '11' 22 | distribution: 'temurin' 23 | cache: gradle 24 | 25 | - name: Set up Node.js 26 | uses: actions/setup-node@v1 27 | with: 28 | node-version: 18 29 | 30 | # ESLint and Prettier must be in `package.json` 31 | - name: Install dependencies 32 | run: | 33 | if [ -e yarn.lock ]; then 34 | yarn install --frozen-lockfile 35 | elif [ -e package-lock.json ]; then 36 | npm ci 37 | else 38 | npm i 39 | fi 40 | - name: Grant execute permission for gradlew 41 | run: cd android && chmod +x gradlew 42 | - name: Build with Gradle 43 | run: cd android && ./gradlew assembleStageRelease 44 | -------------------------------------------------------------------------------- /template/.github/workflows/ios.yml: -------------------------------------------------------------------------------- 1 | name: App build 2 | on: 3 | push: 4 | branches: 5 | - main 6 | - develop 7 | 8 | jobs: 9 | build_with_signing: 10 | runs-on: macos-latest 11 | 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v4 15 | - name: Install the Apple certificate and provisioning profile 16 | env: 17 | BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} 18 | P12_PASSWORD: ${{ secrets.P12_PASSWORD }} 19 | BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} 20 | KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} 21 | run: | 22 | # create variables 23 | CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 24 | PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision 25 | KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db 26 | 27 | # import certificate and provisioning profile from secrets 28 | echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH 29 | echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH 30 | 31 | # create temporary keychain 32 | security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH 33 | security set-keychain-settings -lut 21600 $KEYCHAIN_PATH 34 | security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH 35 | 36 | # import certificate to keychain 37 | security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH 38 | security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH 39 | security list-keychain -d user -s $KEYCHAIN_PATH 40 | 41 | # apply provisioning profile 42 | mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles 43 | cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles 44 | - name: Build app 45 | ... 46 | -------------------------------------------------------------------------------- /template/.github/workflows/linting.yml: -------------------------------------------------------------------------------- 1 | name: Lint & Prettify 2 | 3 | on: 4 | # Trigger the workflow on push or pull request, 5 | # but only for the main branch 6 | push: 7 | branches: 8 | - main 9 | pull_request: 10 | branches: 11 | - main 12 | - develop 13 | 14 | 15 | jobs: 16 | run-linters: 17 | name: Run linters 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - name: Check out Git repository 22 | uses: actions/checkout@v2 23 | 24 | - name: Set up Node.js 25 | uses: actions/setup-node@v1 26 | with: 27 | node-version: 14 28 | 29 | # ESLint and Prettier must be in `package.json` 30 | - name: Install dependencies 31 | run: | 32 | if [ -e yarn.lock ]; then 33 | yarn install --frozen-lockfile 34 | elif [ -e package-lock.json ]; then 35 | npm ci 36 | else 37 | npm i 38 | fi 39 | 40 | - name: Check linting 41 | run: yarn lint 42 | - name: Check prettier 43 | run: yarn prettier:check 44 | - name: TS Checking 45 | run: yarn compile-ts 46 | -------------------------------------------------------------------------------- /template/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | **/.xcode.env.local 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | *.hprof 33 | .cxx/ 34 | 35 | # node.js 36 | # 37 | node_modules/** 38 | npm-debug.log 39 | yarn-error.log 40 | 41 | # BUCK 42 | buck-out/ 43 | \.buckd/ 44 | *.keystore 45 | !debug.keystore 46 | 47 | # fastlane 48 | # 49 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 50 | # screenshots whenever they are needed. 51 | # For more information about the recommended setup visit: 52 | # https://docs.fastlane.tools/best-practices/source-control/ 53 | 54 | **/fastlane/report.xml 55 | **/fastlane/Preview.html 56 | **/fastlane/screenshots 57 | **/fastlane/test_output 58 | 59 | # Bundle artifact 60 | *.jsbundle 61 | 62 | # Ruby / CocoaPods 63 | **/Pods/ 64 | /vendor/bundle/ 65 | .env 66 | .env.** 67 | codePushPrivateKey.pem 68 | # Temporary files created by Metro to check the health of the file watcher 69 | .metro-health-check* 70 | # testing 71 | /coverage 72 | node_modules\.yarn-integrity 73 | 74 | # Yarn 75 | .yarn/* 76 | !.yarn/patches 77 | !.yarn/plugins 78 | !.yarn/releases 79 | !.yarn/sdks 80 | !.yarn/versions -------------------------------------------------------------------------------- /template/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | yarn lint-staged 5 | yarn prettier:check 6 | 7 | -------------------------------------------------------------------------------- /template/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | arrowParens: 'avoid', 3 | bracketSameLine: true, 4 | bracketSpacing: true, 5 | singleQuote: true, 6 | trailingComma: 'all', 7 | }; 8 | -------------------------------------------------------------------------------- /template/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | ".env.development": "env", 4 | ".env.production": "env", 5 | ".env.staging": "env", 6 | ".env.uat": "env" 7 | }, 8 | "java.configuration.updateBuildConfiguration": "interactive" 9 | } 10 | -------------------------------------------------------------------------------- /template/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /template/App.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * 5 | * Generated with the TypeScript template 6 | * https://github.com/react-native-community/react-native-template-typescript 7 | * 8 | * @format 9 | */ 10 | import React from 'react'; 11 | import { ErrorBoundary } from 'react-error-boundary'; 12 | import { 13 | setJSExceptionHandler, 14 | JSExceptionHandler, 15 | setNativeExceptionHandler, 16 | NativeExceptionHandler, 17 | } from 'react-native-exception-handler'; 18 | import FlashMessage from 'react-native-flash-message'; 19 | import * as Sentry from '@sentry/react-native'; 20 | import codePush from 'react-native-code-push'; 21 | 22 | import Providers from './Providers'; 23 | import Navigation from './src/navigation/index'; 24 | import { ErrorScreen } from './src/screens'; 25 | 26 | import { devLog, prodFunction } from './src/utils/helpers'; 27 | import { IS_DEV } from './src/utils/constants'; 28 | import './src/translations'; 29 | 30 | const routingInstrumentation = new Sentry.ReactNavigationInstrumentation(); 31 | 32 | if (!IS_DEV) { 33 | codePush 34 | .getUpdateMetadata() 35 | // eslint-disable-next-line promise/prefer-await-to-then 36 | .then(update => { 37 | // eslint-disable-next-line promise/always-return 38 | if (update) { 39 | Sentry.init({ 40 | dsn: 'https://a13f12a6c6274fd9a22a2759135e5ce5@o1305163.ingest.sentry.io/6629304', 41 | tracesSampleRate: 0.2, 42 | integrations: [ 43 | new Sentry.ReactNativeTracing({ 44 | // Pass instrumentation to be used as `routingInstrumentation` 45 | routingInstrumentation, 46 | // ... 47 | }), 48 | ], 49 | environment: IS_DEV ? 'development' : "", 50 | release: `${update.appVersion}+codepush:${update.label}`, 51 | dist: update.label, 52 | }); 53 | } 54 | }) 55 | // eslint-disable-next-line promise/prefer-await-to-then 56 | .catch(devLog.error); 57 | } 58 | 59 | const errorHandler: JSExceptionHandler = (e, isFatal) => { 60 | devLog.log('ERROR HANDLER 123'); 61 | devLog.error(e); 62 | prodFunction(() => 63 | Sentry.captureException(e, { 64 | level: isFatal ? 'error' : 'log', 65 | extra: { isFatal, isNative: false }, 66 | }), 67 | ); 68 | }; 69 | const nativeErrorHandler: NativeExceptionHandler = errorString => { 70 | prodFunction(() => 71 | Sentry.captureException(errorString, { 72 | level: 'error', 73 | extra: { isFatal: true, isNative: true }, 74 | }), 75 | ); 76 | }; 77 | 78 | setNativeExceptionHandler(nativeErrorHandler, false, true); 79 | setJSExceptionHandler(errorHandler); 80 | 81 | const App = () => ( 82 | 83 | 84 | <> 85 | 88 | 89 | 90 | 91 | 92 | ); 93 | 94 | export default codePush(IS_DEV ? App : Sentry.wrap(App)); 95 | -------------------------------------------------------------------------------- /template/Gemfile: -------------------------------------------------------------------------------- 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 | # Cocoapods 1.15 introduced a bug which break the build. We will remove the upper 7 | # bound in the template on Cocoapods with next React Native release. 8 | gem 'cocoapods', '>= 1.13', '< 1.15' 9 | gem 'activesupport', '>= 6.1.7.5', '< 7.1.0' 10 | -------------------------------------------------------------------------------- /template/Providers.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { PersistGate } from 'redux-persist/integration/react'; 3 | import { Provider } from 'react-redux'; 4 | import { store, persistor } from './src/redux'; 5 | 6 | type Props = { 7 | children: JSX.Element; 8 | }; 9 | const Providers = ({ children }: Props) => ( 10 | 11 | 12 | {children} 13 | 14 | 15 | ); 16 | 17 | export default Providers; 18 | -------------------------------------------------------------------------------- /template/__tests__/App-test.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | // Note: test renderer must be required after react-native. 8 | import renderer from 'react-test-renderer'; 9 | import App from '../App'; 10 | 11 | it('renders correctly', () => { 12 | renderer.create(); 13 | }); 14 | -------------------------------------------------------------------------------- /template/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: "org.jetbrains.kotlin.android" 3 | apply plugin: "com.facebook.react" 4 | 5 | react { 6 | /* Folders */ 7 | // The root of your project, i.e. where "package.json" lives. Default is '..' 8 | // root = file("../") 9 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native 10 | // reactNativeDir = file("../node_modules/react-native") 11 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen 12 | // codegenDir = file("../node_modules/@react-native/codegen") 13 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js 14 | // cliFile = file("../node_modules/react-native/cli.js") 15 | 16 | /* Variants */ 17 | // The list of variants to that are debuggable. For those we're going to 18 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'. 19 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. 20 | // debuggableVariants = ["liteDebug", "prodDebug"] 21 | 22 | /* Bundling */ 23 | // A list containing the node command and its flags. Default is just 'node'. 24 | // nodeExecutableAndArgs = ["node"] 25 | // 26 | // The command to run when bundling. By default is 'bundle' 27 | // bundleCommand = "ram-bundle" 28 | // 29 | // The path to the CLI configuration file. Default is empty. 30 | // bundleConfig = file(../rn-cli.config.js) 31 | // 32 | // The name of the generated asset file containing your JS bundle 33 | // bundleAssetName = "MyApplication.android.bundle" 34 | // 35 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' 36 | // entryFile = file("../js/MyApplication.android.js") 37 | // 38 | // A list of extra flags to pass to the 'bundle' commands. 39 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle 40 | // extraPackagerArgs = [] 41 | 42 | /* Hermes Commands */ 43 | // The hermes compiler command to run. By default it is 'hermesc' 44 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" 45 | // 46 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" 47 | // hermesFlags = ["-O", "-output-source-map"] 48 | } 49 | 50 | apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" 51 | 52 | 53 | def enableProguardInReleaseBuilds = false 54 | 55 | /** 56 | * The preferred build flavor of JavaScriptCore. 57 | * 58 | * For example, to use the international variant, you can use: 59 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 60 | * 61 | * The international variant includes ICU i18n library and necessary data 62 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 63 | * give correct results when using with locales other than en-US. Note that 64 | * this variant is about 6MiB larger per architecture than default. 65 | */ 66 | def jscFlavor = 'org.webkit:android-jsc:+' 67 | 68 | android { 69 | ndkVersion rootProject.ext.ndkVersion 70 | 71 | buildToolsVersion rootProject.ext.buildToolsVersion 72 | compileSdk rootProject.ext.compileSdkVersion 73 | 74 | namespace "com.myapp" 75 | 76 | defaultConfig { 77 | applicationId "com.myapp" 78 | minSdkVersion rootProject.ext.minSdkVersion 79 | targetSdkVersion rootProject.ext.targetSdkVersion 80 | versionCode 1 81 | versionName "1.0" 82 | } 83 | signingConfigs { 84 | debug { 85 | storeFile file('debug.keystore') 86 | storePassword 'android' 87 | keyAlias 'androiddebugkey' 88 | keyPassword 'android' 89 | } 90 | } 91 | buildTypes { 92 | debug { 93 | signingConfig signingConfigs.debug 94 | } 95 | release { 96 | // Caution! In production, you need to generate your own keystore file. 97 | // see https://reactnative.dev/docs/signed-apk-android. 98 | signingConfig signingConfigs.debug 99 | minifyEnabled enableProguardInReleaseBuilds 100 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 101 | } 102 | } 103 | 104 | flavorDimensions "environment" 105 | 106 | productFlavors { 107 | dev { 108 | resValue "string", "CodePushDeploymentKey", "" 109 | resValue "string", "app_name", "Debug appName" 110 | } 111 | 112 | stage { 113 | resValue "string", "CodePushDeploymentKey", "" 114 | resValue "string", "app_name", "Stage appName" 115 | 116 | } 117 | uat { 118 | resValue "string", "CodePushDeploymentKey", "" 119 | resValue "string", "app_name", "Test appName" 120 | 121 | } 122 | prod { 123 | resValue "string", "CodePushDeploymentKey", "" 124 | resValue "string", "app_name", "appName" 125 | } 126 | 127 | 128 | } 129 | 130 | } 131 | 132 | dependencies { // The version of react-native is set by the React Native Gradle Plugin 133 | implementation("com.facebook.react:react-android") 134 | implementation "androidx.core:core-splashscreen:1.0.0" // Add this line 135 | 136 | if (hermesEnabled.toBoolean()) { 137 | implementation("com.facebook.react:hermes-android") 138 | } else { 139 | implementation jscFlavor 140 | } 141 | } 142 | 143 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 144 | 145 | project.ext.vectoricons = [ 146 | iconFontNames: [ 'MaterialCommunityIcons.ttf' ] // Name of the font files you want to copy 147 | ] 148 | 149 | apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" 150 | project.ext.envConfigFiles = [ 151 | proddebug: ".env.production", 152 | prodrelease: ".env.production", 153 | devrelease: ".env.development", 154 | devdebug: ".env.development", 155 | stagerelease: ".env.staging", 156 | stagedebug: ".env.staging", 157 | uatrelease: ".env.uat", 158 | uatdebug: ".env.uat" 159 | ] 160 | apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" -------------------------------------------------------------------------------- /template/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/debug.keystore -------------------------------------------------------------------------------- /template/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | -keep class com.facebook.hermes.unicode.** { *; } 13 | -keep class com.facebook.jni.** { *; } 14 | -keep public class com.horcrux.svg.** {*;} 15 | -keep class com.myapp.BuildConfig { *; } 16 | -keepresources string/build_config_package 17 | -------------------------------------------------------------------------------- /template/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /template/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /template/android/app/src/main/assets/appcenter-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_secret": "{Your app secret here}" 3 | } 4 | -------------------------------------------------------------------------------- /template/android/app/src/main/java/com/myapp/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.myapp 2 | 3 | import android.os.Bundle; 4 | import com.facebook.react.ReactActivity 5 | import com.facebook.react.ReactActivityDelegate 6 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled 7 | import com.facebook.react.defaults.DefaultReactActivityDelegate 8 | import com.zoontek.rnbootsplash.RNBootSplash; 9 | 10 | class MainActivity : ReactActivity() { 11 | 12 | 13 | /** 14 | * Returns the name of the main component registered from JavaScript. This is used to schedule 15 | * rendering of the component. 16 | */ 17 | override fun getMainComponentName(): String = "myApp" 18 | 19 | override fun onCreate(savedInstanceState: Bundle?) { 20 | RNBootSplash.init(this, R.style.BootTheme) // initialize the splash screen 21 | super.onCreate(null) 22 | } 23 | /** 24 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] 25 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] 26 | */ 27 | override fun createReactActivityDelegate(): ReactActivityDelegate = 28 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) 29 | } 30 | -------------------------------------------------------------------------------- /template/android/app/src/main/java/com/myapp/MainApplication.kt: -------------------------------------------------------------------------------- 1 | package com.myapp 2 | 3 | import android.app.Application 4 | import com.facebook.react.PackageList 5 | import com.facebook.react.ReactApplication 6 | import com.facebook.react.ReactHost 7 | import com.facebook.react.ReactNativeHost 8 | import com.facebook.react.ReactPackage 9 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load 10 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost 11 | import com.facebook.react.defaults.DefaultReactNativeHost 12 | import com.facebook.soloader.SoLoader 13 | import com.microsoft.codepush.react.CodePush 14 | 15 | 16 | class MainApplication : Application(), ReactApplication { 17 | 18 | override val reactNativeHost: ReactNativeHost = 19 | object : DefaultReactNativeHost(this) { 20 | // 2. Override the getJSBundleFile method in order to let 21 | // the CodePush runtime determine where to get the JS 22 | // bundle location from on each app start 23 | override fun getJSBundleFile(): String { 24 | return CodePush.getJSBundleFile() 25 | } 26 | 27 | override fun getPackages(): List = 28 | PackageList(this).packages.apply { 29 | // Packages that cannot be autolinked yet can be added manually here, for example: 30 | // add(MyReactNativePackage()) 31 | } 32 | 33 | override fun getJSMainModuleName(): String = "index" 34 | 35 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG 36 | 37 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED 38 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED 39 | } 40 | 41 | override val reactHost: ReactHost 42 | get() = getDefaultReactHost(applicationContext, reactNativeHost) 43 | 44 | override fun onCreate() { 45 | super.onCreate() 46 | SoLoader.init(this, false) 47 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 48 | // If you opted-in for the New Architecture, we load the native entry point for this app. 49 | load() 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /template/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-hdpi/bootsplash_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-hdpi/bootsplash_logo.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-mdpi/bootsplash_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-mdpi/bootsplash_logo.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xhdpi/bootsplash_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xhdpi/bootsplash_logo.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xxhdpi/bootsplash_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xxhdpi/bootsplash_logo.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xxxhdpi/bootsplash_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xxxhdpi/bootsplash_logo.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | #FFFFFF 3 | 4 | -------------------------------------------------------------------------------- /template/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DO_NOT_ASK_JAVASCRIPT 3 | ALWAYS_SEND 4 | -----BEGIN PUBLIC KEY----- 5 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4imZli5C8gmICDjsXJ8 6 | 2KRLrqy5FC1QyKddVw9lu1vbgVv4eprkLlrZUq9U+qrtZknoPZ50dBrieR4bIZ2f 7 | kusRRAlHwwVZXiPRodTWsvBUF5tpo9ogGprCmNGwsZF61d8Z7T96eF5LfgNNO2eW 8 | F2IweRDwc0+QtjsAVN6UaemyNL4YX0KOee2sbwbi5nQ9jFTeANWicKtk7YL87VA6 9 | dG1r+Q86Ph8kOS+mD3bq4ptlNEWREs4r2e6lYcZn5kwc2odULxN98Ys+FOIwA57q 10 | yNCgI90/wLqdYSmhwteeYWZBviUU6lickgSiv38Ctai+Px96JoDaTOvVNgYfTkTV 11 | 7QIDAQAB 12 | -----END PUBLIC KEY----- 13 | -------------------------------------------------------------------------------- /template/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /template/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | buildToolsVersion = "34.0.0" 4 | minSdkVersion = 23 5 | compileSdkVersion = 34 6 | targetSdkVersion = 34 7 | ndkVersion = "26.1.10909125" 8 | kotlinVersion = "1.9.22" 9 | } 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle") 16 | classpath("com.facebook.react:react-native-gradle-plugin") 17 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") 18 | } 19 | } 20 | 21 | apply plugin: "com.facebook.react.rootproject" 22 | -------------------------------------------------------------------------------- /template/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Use this property to specify which architecture you want to build. 28 | # You can also override it from the CLI using 29 | # ./gradlew -PreactNativeArchitectures=x86_64 30 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 31 | 32 | # Use this property to enable support to the new architecture. 33 | # This will allow you to use TurboModules and the Fabric render in 34 | # your application. You should enable this flag either if you want 35 | # to write custom TurboModules/Fabric components OR use libraries that 36 | # are providing them. 37 | newArchEnabled=false 38 | 39 | # Use this property to enable or disable the Hermes JS engine. 40 | # If set to false, you will be using JSC instead. 41 | hermesEnabled=true 42 | -------------------------------------------------------------------------------- /template/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /template/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /template/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /template/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /template/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'MyApp' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | includeBuild('../node_modules/@react-native/gradle-plugin') 5 | include ':app', ':react-native-code-push' 6 | project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MyApp", 3 | "displayName": "MyApp" 4 | } 5 | -------------------------------------------------------------------------------- /template/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:@react-native/babel-preset'], 3 | env: { 4 | production: { 5 | plugins: ['transform-remove-console'], 6 | }, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /template/codePushPublicKey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4imZli5C8gmICDjsXJ8 3 | 2KRLrqy5FC1QyKddVw9lu1vbgVv4eprkLlrZUq9U+qrtZknoPZ50dBrieR4bIZ2f 4 | kusRRAlHwwVZXiPRodTWsvBUF5tpo9ogGprCmNGwsZF61d8Z7T96eF5LfgNNO2eW 5 | F2IweRDwc0+QtjsAVN6UaemyNL4YX0KOee2sbwbi5nQ9jFTeANWicKtk7YL87VA6 6 | dG1r+Q86Ph8kOS+mD3bq4ptlNEWREs4r2e6lYcZn5kwc2odULxN98Ys+FOIwA57q 7 | yNCgI90/wLqdYSmhwteeYWZBviUU6lickgSiv38Ctai+Px96JoDaTOvVNgYfTkTV 8 | 7QIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /template/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import { AppRegistry } from 'react-native'; 6 | import App from './App'; 7 | import { name as appName } from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /template/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /template/ios/MyApp.xcodeproj/xcshareddata/xcschemes/MyApp.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 11 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 51 | 57 | 58 | 59 | 60 | 61 | 71 | 73 | 79 | 80 | 81 | 82 | 88 | 90 | 96 | 97 | 98 | 99 | 101 | 102 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /template/ios/MyApp.xcodeproj/xcshareddata/xcschemes/MyAppDev.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 11 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 60 | 62 | 68 | 69 | 70 | 71 | 77 | 79 | 85 | 86 | 87 | 88 | 90 | 91 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /template/ios/MyApp.xcodeproj/xcshareddata/xcschemes/MyAppStage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 11 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 60 | 62 | 68 | 69 | 70 | 71 | 77 | 79 | 85 | 86 | 87 | 88 | 90 | 91 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /template/ios/MyApp.xcodeproj/xcshareddata/xcschemes/MyAppUAT.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 11 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 60 | 62 | 68 | 69 | 70 | 71 | 77 | 79 | 85 | 86 | 87 | 88 | 90 | 91 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /template/ios/MyApp.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /template/ios/MyApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/ios/MyApp.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /template/ios/MyApp/AppCenter-Config.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AppSecret 6 | {Your app secret here} 7 | 8 | -------------------------------------------------------------------------------- /template/ios/MyApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : RCTAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /template/ios/MyApp/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | #import 3 | #import 4 | 5 | #import 6 | #import 7 | #import 8 | #import "RNBootSplash.h" // <- add the header import 9 | 10 | @implementation AppDelegate 11 | 12 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 13 | { 14 | 15 | [AppCenterReactNative register]; 16 | [AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true]; 17 | [AppCenterReactNativeCrashes registerWithAutomaticProcessing]; 18 | 19 | self.moduleName = @"MyApp"; 20 | // You can add your custom initial props in the dictionary below. 21 | // They will be passed down to the ViewController used by React Native. 22 | self.initialProps = @{}; 23 | 24 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 25 | } 26 | 27 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 28 | { 29 | #if DEBUG 30 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 31 | #else 32 | return [CodePush bundleURL]; 33 | #endif 34 | } 35 | 36 | // ⬇️ Add this before file @end (when bridgeless is enabled) 37 | - (void)customizeRootView:(RCTRootView *)rootView { 38 | [RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView]; // ⬅️ initialize the splash screen 39 | } 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /template/ios/MyApp/BootSplash.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /template/ios/MyApp/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "iphone", 5 | "scale": "2x", 6 | "size": "20x20" 7 | }, 8 | { 9 | "idiom": "iphone", 10 | "scale": "3x", 11 | "size": "20x20" 12 | }, 13 | { 14 | "idiom": "iphone", 15 | "scale": "2x", 16 | "size": "29x29" 17 | }, 18 | { 19 | "idiom": "iphone", 20 | "scale": "3x", 21 | "size": "29x29" 22 | }, 23 | { 24 | "idiom": "iphone", 25 | "scale": "2x", 26 | "size": "40x40" 27 | }, 28 | { 29 | "idiom": "iphone", 30 | "scale": "3x", 31 | "size": "40x40" 32 | }, 33 | { 34 | "idiom": "iphone", 35 | "scale": "2x", 36 | "size": "60x60" 37 | }, 38 | { 39 | "idiom": "iphone", 40 | "scale": "3x", 41 | "size": "60x60" 42 | }, 43 | { 44 | "idiom": "ios-marketing", 45 | "scale": "1x", 46 | "size": "1024x1024" 47 | } 48 | ], 49 | "info": { 50 | "author": "xcode", 51 | "version": 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /template/ios/MyApp/Images.xcassets/BootSplashLogo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "bootsplash_logo.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "filename": "bootsplash_logo@2x.png", 11 | "scale": "2x" 12 | }, 13 | { 14 | "idiom": "universal", 15 | "filename": "bootsplash_logo@3x.png", 16 | "scale": "3x" 17 | } 18 | ], 19 | "info": { 20 | "version": 1, 21 | "author": "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /template/ios/MyApp/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/ios/MyApp/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo.png -------------------------------------------------------------------------------- /template/ios/MyApp/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/ios/MyApp/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@2x.png -------------------------------------------------------------------------------- /template/ios/MyApp/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/ios/MyApp/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@3x.png -------------------------------------------------------------------------------- /template/ios/MyApp/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "version": 1, 4 | "author": "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /template/ios/MyApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodePushPublicKey 6 | -----BEGIN PUBLIC KEY----- 7 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4imZli5C8gmICDjsXJ8 8 | 2KRLrqy5FC1QyKddVw9lu1vbgVv4eprkLlrZUq9U+qrtZknoPZ50dBrieR4bIZ2f 9 | kusRRAlHwwVZXiPRodTWsvBUF5tpo9ogGprCmNGwsZF61d8Z7T96eF5LfgNNO2eW 10 | F2IweRDwc0+QtjsAVN6UaemyNL4YX0KOee2sbwbi5nQ9jFTeANWicKtk7YL87VA6 11 | dG1r+Q86Ph8kOS+mD3bq4ptlNEWREs4r2e6lYcZn5kwc2odULxN98Ys+FOIwA57q 12 | yNCgI90/wLqdYSmhwteeYWZBviUU6lickgSiv38Ctai+Px96JoDaTOvVNgYfTkTV 13 | 7QIDAQAB 14 | -----END PUBLIC KEY----- 15 | CodePushDeploymentKey 16 | $(CODEPUSH_KEY) 17 | UIAppFonts 18 | 19 | MaterialCommunityIcons.ttf 20 | 21 | CFBundleDevelopmentRegion 22 | en 23 | CFBundleDisplayName 24 | MyApp 25 | CFBundleExecutable 26 | $(EXECUTABLE_NAME) 27 | CFBundleIdentifier 28 | $(PRODUCT_BUNDLE_IDENTIFIER) 29 | CFBundleInfoDictionaryVersion 30 | 6.0 31 | CFBundleName 32 | $(PRODUCT_NAME) 33 | CFBundlePackageType 34 | APPL 35 | CFBundleShortVersionString 36 | $(MARKETING_VERSION) 37 | CFBundleSignature 38 | ???? 39 | CFBundleVersion 40 | $(CURRENT_PROJECT_VERSION) 41 | LSRequiresIPhoneOS 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSAllowsArbitraryLoads 47 | 48 | NSAllowsLocalNetworking 49 | 50 | 51 | NSLocationWhenInUseUsageDescription 52 | 53 | UILaunchStoryboardName 54 | LaunchScreen 55 | UIRequiredDeviceCapabilities 56 | 57 | arm64 58 | 59 | UISupportedInterfaceOrientations 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | UIViewControllerBasedStatusBarAppearance 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /template/ios/MyApp/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /template/ios/MyApp/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | 8 | NSPrivacyAccessedAPIType 9 | NSPrivacyAccessedAPICategoryFileTimestamp 10 | NSPrivacyAccessedAPITypeReasons 11 | 12 | C617.1 13 | 3B52.1 14 | 15 | 16 | 17 | NSPrivacyAccessedAPIType 18 | NSPrivacyAccessedAPICategoryUserDefaults 19 | NSPrivacyAccessedAPITypeReasons 20 | 21 | CA92.1 22 | 23 | 24 | 25 | NSPrivacyAccessedAPIType 26 | NSPrivacyAccessedAPICategorySystemBootTime 27 | NSPrivacyAccessedAPITypeReasons 28 | 29 | 35F9.1 30 | 31 | 32 | 33 | NSPrivacyCollectedDataTypes 34 | 35 | NSPrivacyTracking 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /template/ios/MyApp/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /template/ios/MyAppDev-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodePushPublicKey 6 | -----BEGIN PUBLIC KEY----- 7 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4imZli5C8gmICDjsXJ8 8 | 2KRLrqy5FC1QyKddVw9lu1vbgVv4eprkLlrZUq9U+qrtZknoPZ50dBrieR4bIZ2f 9 | kusRRAlHwwVZXiPRodTWsvBUF5tpo9ogGprCmNGwsZF61d8Z7T96eF5LfgNNO2eW 10 | F2IweRDwc0+QtjsAVN6UaemyNL4YX0KOee2sbwbi5nQ9jFTeANWicKtk7YL87VA6 11 | dG1r+Q86Ph8kOS+mD3bq4ptlNEWREs4r2e6lYcZn5kwc2odULxN98Ys+FOIwA57q 12 | yNCgI90/wLqdYSmhwteeYWZBviUU6lickgSiv38Ctai+Px96JoDaTOvVNgYfTkTV 13 | 7QIDAQAB 14 | -----END PUBLIC KEY----- 15 | CodePushDeploymentKey 16 | $(CODEPUSH_KEY) 17 | UIAppFonts 18 | 19 | MaterialCommunityIcons.ttf 20 | 21 | CFBundleDevelopmentRegion 22 | en 23 | CFBundleDisplayName 24 | MyApp 25 | CFBundleExecutable 26 | $(EXECUTABLE_NAME) 27 | CFBundleIdentifier 28 | $(PRODUCT_BUNDLE_IDENTIFIER) 29 | CFBundleInfoDictionaryVersion 30 | 6.0 31 | CFBundleName 32 | $(PRODUCT_NAME) 33 | CFBundlePackageType 34 | APPL 35 | CFBundleShortVersionString 36 | $(MARKETING_VERSION) 37 | CFBundleSignature 38 | ???? 39 | CFBundleVersion 40 | $(CURRENT_PROJECT_VERSION) 41 | LSRequiresIPhoneOS 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSAllowsArbitraryLoads 47 | 48 | NSAllowsLocalNetworking 49 | 50 | 51 | NSLocationWhenInUseUsageDescription 52 | 53 | UILaunchStoryboardName 54 | LaunchScreen 55 | UIRequiredDeviceCapabilities 56 | 57 | arm64 58 | 59 | UISupportedInterfaceOrientations 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | UIViewControllerBasedStatusBarAppearance 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /template/ios/MyAppStage-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodePushPublicKey 6 | -----BEGIN PUBLIC KEY----- 7 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4imZli5C8gmICDjsXJ8 8 | 2KRLrqy5FC1QyKddVw9lu1vbgVv4eprkLlrZUq9U+qrtZknoPZ50dBrieR4bIZ2f 9 | kusRRAlHwwVZXiPRodTWsvBUF5tpo9ogGprCmNGwsZF61d8Z7T96eF5LfgNNO2eW 10 | F2IweRDwc0+QtjsAVN6UaemyNL4YX0KOee2sbwbi5nQ9jFTeANWicKtk7YL87VA6 11 | dG1r+Q86Ph8kOS+mD3bq4ptlNEWREs4r2e6lYcZn5kwc2odULxN98Ys+FOIwA57q 12 | yNCgI90/wLqdYSmhwteeYWZBviUU6lickgSiv38Ctai+Px96JoDaTOvVNgYfTkTV 13 | 7QIDAQAB 14 | -----END PUBLIC KEY----- 15 | CodePushDeploymentKey 16 | $(CODEPUSH_KEY) 17 | UIAppFonts 18 | 19 | MaterialCommunityIcons.ttf 20 | 21 | CFBundleDevelopmentRegion 22 | en 23 | CFBundleDisplayName 24 | MyApp 25 | CFBundleExecutable 26 | $(EXECUTABLE_NAME) 27 | CFBundleIdentifier 28 | $(PRODUCT_BUNDLE_IDENTIFIER) 29 | CFBundleInfoDictionaryVersion 30 | 6.0 31 | CFBundleName 32 | $(PRODUCT_NAME) 33 | CFBundlePackageType 34 | APPL 35 | CFBundleShortVersionString 36 | $(MARKETING_VERSION) 37 | CFBundleSignature 38 | ???? 39 | CFBundleVersion 40 | $(CURRENT_PROJECT_VERSION) 41 | LSRequiresIPhoneOS 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSAllowsArbitraryLoads 47 | 48 | NSAllowsLocalNetworking 49 | 50 | 51 | NSLocationWhenInUseUsageDescription 52 | 53 | UILaunchStoryboardName 54 | LaunchScreen 55 | UIRequiredDeviceCapabilities 56 | 57 | arm64 58 | 59 | UISupportedInterfaceOrientations 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | UIViewControllerBasedStatusBarAppearance 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /template/ios/MyAppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /template/ios/MyAppTests/MyAppTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface MyAppTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation MyAppTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction( 38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 39 | if (level >= RCTLogLevelError) { 40 | redboxError = message; 41 | } 42 | }); 43 | #endif 44 | 45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 48 | 49 | foundElement = [self findSubviewInView:vc.view 50 | matching:^BOOL(UIView *view) { 51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 52 | return YES; 53 | } 54 | return NO; 55 | }]; 56 | } 57 | 58 | #ifdef DEBUG 59 | RCTSetLogFunction(RCTDefaultLogFunction); 60 | #endif 61 | 62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /template/ios/MyAppUAT-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodePushPublicKey 6 | -----BEGIN PUBLIC KEY----- 7 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4imZli5C8gmICDjsXJ8 8 | 2KRLrqy5FC1QyKddVw9lu1vbgVv4eprkLlrZUq9U+qrtZknoPZ50dBrieR4bIZ2f 9 | kusRRAlHwwVZXiPRodTWsvBUF5tpo9ogGprCmNGwsZF61d8Z7T96eF5LfgNNO2eW 10 | F2IweRDwc0+QtjsAVN6UaemyNL4YX0KOee2sbwbi5nQ9jFTeANWicKtk7YL87VA6 11 | dG1r+Q86Ph8kOS+mD3bq4ptlNEWREs4r2e6lYcZn5kwc2odULxN98Ys+FOIwA57q 12 | yNCgI90/wLqdYSmhwteeYWZBviUU6lickgSiv38Ctai+Px96JoDaTOvVNgYfTkTV 13 | 7QIDAQAB 14 | -----END PUBLIC KEY----- 15 | CodePushDeploymentKey 16 | $(CODEPUSH_KEY) 17 | UIAppFonts 18 | 19 | MaterialCommunityIcons.ttf 20 | 21 | CFBundleDevelopmentRegion 22 | en 23 | CFBundleDisplayName 24 | MyApp 25 | CFBundleExecutable 26 | $(EXECUTABLE_NAME) 27 | CFBundleIdentifier 28 | $(PRODUCT_BUNDLE_IDENTIFIER) 29 | CFBundleInfoDictionaryVersion 30 | 6.0 31 | CFBundleName 32 | $(PRODUCT_NAME) 33 | CFBundlePackageType 34 | APPL 35 | CFBundleShortVersionString 36 | $(MARKETING_VERSION) 37 | CFBundleSignature 38 | ???? 39 | CFBundleVersion 40 | $(CURRENT_PROJECT_VERSION) 41 | LSRequiresIPhoneOS 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSAllowsArbitraryLoads 47 | 48 | NSAllowsLocalNetworking 49 | 50 | 51 | NSLocationWhenInUseUsageDescription 52 | 53 | UILaunchStoryboardName 54 | LaunchScreen 55 | UIRequiredDeviceCapabilities 56 | 57 | arm64 58 | 59 | UISupportedInterfaceOrientations 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | UIViewControllerBasedStatusBarAppearance 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /template/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Resolve react_native_pods.rb with node to allow for hoisting 2 | require Pod::Executable.execute_command('node', ['-p', 3 | 'require.resolve( 4 | "react-native/scripts/react_native_pods.rb", 5 | {paths: [process.argv[1]]}, 6 | )', __dir__]).strip 7 | 8 | platform :ios, min_ios_version_supported 9 | prepare_react_native_project! 10 | 11 | linkage = ENV['USE_FRAMEWORKS'] 12 | if linkage != nil 13 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green 14 | use_frameworks! :linkage => linkage.to_sym 15 | end 16 | 17 | abstract_target 'MyAppCommonPods' do 18 | 19 | config = use_native_modules! 20 | 21 | 22 | use_react_native!( 23 | :path => config[:reactNativePath], 24 | # An absolute path to your application root. 25 | :app_path => "#{Pod::Config.instance.installation_root}/.." 26 | ) 27 | 28 | target 'MyAppDev' do 29 | end 30 | 31 | target 'MyAppStage' do 32 | end 33 | target 'MyAppUAT' do 34 | end 35 | 36 | target 'MyApp' do 37 | end 38 | 39 | target 'MyAppTests' do 40 | inherit! :complete 41 | # Pods for testing 42 | end 43 | 44 | post_install do |installer| 45 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 46 | react_native_post_install( 47 | installer, 48 | config[:reactNativePath], 49 | :mac_catalyst_enabled => false, 50 | # :ccache_enabled => true 51 | ) 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /template/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'react-native', 3 | }; 4 | -------------------------------------------------------------------------------- /template/lint-staged.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '*.{ts,tsx}': ['eslint --max-warnings=5'], 3 | '*.{js,jsx,ts,tsx,json}': ['prettier --write'], 4 | }; 5 | -------------------------------------------------------------------------------- /template/metro.config.js: -------------------------------------------------------------------------------- 1 | const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); 2 | 3 | /** 4 | * Metro configuration 5 | * https://reactnative.dev/docs/metro 6 | * 7 | * @type {import('metro-config').MetroConfig} 8 | */ 9 | const config = {}; 10 | 11 | module.exports = mergeConfig(getDefaultConfig(__dirname), config); 12 | -------------------------------------------------------------------------------- /template/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "myapp", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android --mode=devDebug", 7 | "android:release": "react-native run-android --mode=release", 8 | "ios": "react-native run-ios", 9 | "start": "react-native start --reset-cache", 10 | "test": "jest", 11 | "lint": "eslint . --ext .jsx,.ts,.tsx", 12 | "lint-staged": "lint-staged --config lint-staged.js", 13 | "pre-commit": "npm run lint", 14 | "lint:fix": "npm run lint -- --fix", 15 | "link-fonts": "npx react-native-asset", 16 | "clean-ios": "rm -rf \"~/Library/Developer/Xcode/DerivedData/*\" && cd ios && rm -rf ./Pods && rm Podfile.lock", 17 | "pods": "cd ios && pod install && cd ../", 18 | "clean-android": "cd android && ./gradlew clean && cd ../", 19 | "codepush-android-stage": "appcenter codepush release-react -a owner/appName -d Staging -k codePushPrivateKey.pem --sourcemap-output --output-dir ./build", 20 | "codepush-android-prod": "appcenter codepush release-react -a owner/Appname -d Production -k codePushPrivateKey.pem --sourcemap-output --output-dir ./build", 21 | "codepush-ios-stage": "appcenter codepush release-react -a owner/appName -d Staging -k codePushPrivateKey.pem --sourcemap-output --output-dir ./build", 22 | "codepush-ios-prod": "appcenter codepush release-react -a owner/Appname -d Production -k codePushPrivateKey.pem --sourcemap-output --output-dir ./build", 23 | "build": "cd android && ./gradlew assembleRelease && cd ../", 24 | "build-staging": "cd android && ./gradlew assembleReleaseStaging && cd ../ ", 25 | "prettier": "prettier --write \"**/*.{js,ts,.tsx,json,md,html}\"", 26 | "prettier:check": "prettier --check \"**/*.{js,ts,.tsx,json,md,html}\"" 27 | }, 28 | "dependencies": { 29 | "@react-native-async-storage/async-storage": "^1.23.1", 30 | "@react-navigation/native": "^6.1.17", 31 | "@react-navigation/native-stack": "^6.9.26", 32 | "@reduxjs/toolkit": "^2.2.5", 33 | "@sentry/react-native": "^5.22.2", 34 | "@types/react": "18.3.3", 35 | "appcenter": "^5.0.1", 36 | "appcenter-analytics": "^5.0.1", 37 | "appcenter-crashes": "^5.0.1", 38 | "axios": "^1.7.2", 39 | "i18next": "^23.11.5", 40 | "lottie-react-native": "^6.7.2", 41 | "promise.allsettled": "^1.0.7", 42 | "react": "18.3.1", 43 | "react-error-boundary": "^4.0.13", 44 | "react-i18next": "^14.1.2", 45 | "react-native": "0.74.1", 46 | "react-native-bootsplash": "^5.5.3", 47 | "react-native-code-push": "^8.2.2", 48 | "react-native-config": "^1.5.1", 49 | "react-native-exception-handler": "^2.10.10", 50 | "react-native-fast-image": "^8.6.3", 51 | "react-native-flash-message": "^0.4.2", 52 | "react-native-image-progress": "^1.2.0", 53 | "react-native-safe-area-context": "^4.10.1", 54 | "react-native-screens": "^3.31.1", 55 | "react-native-simple-toast": "^3.3.1", 56 | "react-native-svg": "^15.3.0", 57 | "react-native-vector-icons": "^10.1.0", 58 | "react-redux": "^9.1.2", 59 | "redux-persist": "^6.0.0", 60 | "rn-secure-storage": "^3.0.1", 61 | "yup": "^1.4.0" 62 | }, 63 | "devDependencies": { 64 | "@babel/core": "^7.24.6", 65 | "@babel/runtime": "^7.24.6", 66 | "@commitlint/cli": "^19.3.0", 67 | "@commitlint/config-conventional": "^19.2.2", 68 | "@react-native-community/eslint-plugin": "^1.3.0", 69 | "@react-native/babel-preset": "0.74.83", 70 | "@react-native/eslint-config": "0.74.83", 71 | "@react-native/metro-config": "0.74.83", 72 | "@react-native/typescript-config": "^0.74.83", 73 | "@sentry/typescript": "^5.20.1", 74 | "@types/jest": "^29.5.12", 75 | "@types/node": "^20.12.12", 76 | "@types/promise.allsettled": "^1.0.6", 77 | "@types/react-native": "^0.73.0", 78 | "@types/react-native-base64": "^0.2.2", 79 | "@types/react-native-vector-icons": "^6.4.18", 80 | "@types/react-test-renderer": "^18.3.0", 81 | "@typescript-eslint/eslint-plugin": "^7.10.0", 82 | "@typescript-eslint/parser": "^7.10.0", 83 | "babel-jest": "^29.7.0", 84 | "babel-plugin-transform-remove-console": "^6.9.4", 85 | "eslint": "^9.3.0", 86 | "eslint-config-airbnb": "19.0.4", 87 | "eslint-config-airbnb-typescript": "^18.0.0", 88 | "eslint-config-prettier": "^9.1.0", 89 | "eslint-plugin-flowtype": "^8.0.3", 90 | "eslint-plugin-import": "^2.29.1", 91 | "eslint-plugin-jest": "^28.5.0", 92 | "eslint-plugin-jsx-a11y": "^6.8.0", 93 | "eslint-plugin-prettier": "^5.1.3", 94 | "eslint-plugin-promise": "^6.1.1", 95 | "eslint-plugin-react": "^7.34.1", 96 | "eslint-plugin-react-hooks": "^4.6.2", 97 | "eslint-plugin-react-native": "^4.1.0", 98 | "husky": "^9.0.11", 99 | "jest": "^29.7.0", 100 | "lint-staged": "^15.2.5", 101 | "metro-config": "^0.80.9", 102 | "prettier": "^3.2.5", 103 | "react-test-renderer": "18.3.1", 104 | "typescript": "^5.4.5" 105 | }, 106 | "jest": { 107 | "preset": "react-native", 108 | "moduleFileExtensions": [ 109 | "ts", 110 | "tsx", 111 | "js", 112 | "jsx", 113 | "json", 114 | "node" 115 | ] 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /template/react-native.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // assets: ['./assets/fonts'], 3 | ...(process?.env?.NO_FLIPPER 4 | ? { 'react-native-flipper': { platforms: { ios: null } } } 5 | : {}), 6 | }; 7 | -------------------------------------------------------------------------------- /template/src/api/endpoints.ts: -------------------------------------------------------------------------------- 1 | /** ALL THE ENDPOINTS WILL BE WRITTEN HERE AND EXPORTED 2 | * we dont need to write base because we've alredy configured it in axios. 3 | * */ 4 | const versionPrefix = `v1`; 5 | export const EXAMPLE_API = `${versionPrefix}/login`; 6 | -------------------------------------------------------------------------------- /template/src/api/services.ts: -------------------------------------------------------------------------------- 1 | /** ALL THE API CALLING WILL BE DONE FROM THIS FILE, DO NOT CALL API FROM ANY OTHER FILE 2 | * though you can import these function and then use them in other files/components. 3 | * remove this comment after all team is aware of this note. 4 | * */ 5 | import { EXAMPLE_API } from './endpoints'; 6 | import https from '../configs/https'; 7 | import type { ExampleAPIResponse } from '../utils/types/api.types'; 8 | 9 | const exampleRequest = ( 10 | body: { token: string }, /// Remove this example code soon. 11 | ) => https.post(EXAMPLE_API, body); 12 | 13 | export { exampleRequest }; 14 | -------------------------------------------------------------------------------- /template/src/assets/images/reactnative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SMKH-PRO/ReactNative_CodePush_Template/d1119371aeddfdc5a9f524f8d03aa8efa2715743/template/src/assets/images/reactnative.png -------------------------------------------------------------------------------- /template/src/components/base/Button/index.style.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | import { wp } from '../../../utils/helpers/responsive.helpers'; 3 | 4 | const styles = StyleSheet.create({ 5 | button: { 6 | alignItems: 'center', 7 | borderRadius: wp('2%', 10), 8 | flexDirection: 'row', 9 | justifyContent: 'center', 10 | marginVertical: 10, 11 | minHeight: 35, 12 | }, 13 | label: { 14 | color: 'white', 15 | // fontSize: 16, 16 | fontWeight: 'bold', 17 | textAlign: 'center', 18 | }, 19 | loading: { 20 | marginLeft: -35, 21 | marginRight: 15, 22 | }, 23 | 24 | shadow: { 25 | elevation: wp('0.8%'), 26 | shadowColor: 'rgba(0,0,0,0.7)', 27 | shadowOffset: { 28 | width: 0, 29 | height: 2, 30 | }, 31 | shadowOpacity: 0.2, 32 | 33 | shadowRadius: 5, 34 | }, 35 | }); 36 | 37 | export default styles; 38 | -------------------------------------------------------------------------------- /template/src/components/base/Button/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useMemo } from 'react'; 2 | import { 3 | View, 4 | Pressable, 5 | TextStyle, 6 | PressableProps, 7 | ViewStyle, 8 | ActivityIndicator, 9 | StyleProp, 10 | StyleSheet, 11 | } from 'react-native'; 12 | import { IS_APPLE, VERY_SMALL_DEVICE } from '../../../utils/constants'; 13 | import { devLog } from '../../../utils/helpers'; 14 | import styles from './index.style'; 15 | import useTheme from '../../../hooks/useTheme'; 16 | import Text from '../Text/index'; 17 | import { wp } from '../../../utils/helpers/responsive.helpers'; 18 | 19 | export interface ButtonProps extends PressableProps { 20 | title: string; 21 | titleStyle?: TextStyle; 22 | activeOpacity?: number; 23 | style?: StyleProp; 24 | styleOnPress?: ViewStyle; 25 | styleOnLeave?: ViewStyle; 26 | loading?: boolean; 27 | onPress?: PressableProps['onPress']; 28 | shadow?: boolean; 29 | right?: JSX.Element; 30 | variant?: 'text' | 'contained' | 'outlined'; 31 | textColor?: string; 32 | androidRipple?: PressableProps['android_ripple']; 33 | checkInternet?: boolean; 34 | } 35 | 36 | const paddingWhenNotLoading = VERY_SMALL_DEVICE ? wp('2.5%', 10) : wp('4%', 18); 37 | const paddingWhenLoading = VERY_SMALL_DEVICE ? wp('2.3%', 9) : wp('3.8%', 17); 38 | 39 | const Button = (props: ButtonProps) => { 40 | const { 41 | style, 42 | styleOnPress, 43 | styleOnLeave, 44 | titleStyle, 45 | activeOpacity, 46 | title, 47 | loading, 48 | textColor, 49 | onPress, 50 | right, 51 | shadow, 52 | disabled, 53 | variant, 54 | androidRipple, 55 | checkInternet, 56 | ...otherProps 57 | } = props; 58 | const theme = useTheme(); 59 | const primaryColor = theme?.colors?.primary; 60 | const givenOpacity = loading ? 1 : activeOpacity; 61 | const androidActiveOpacity = variant === 'text' ? givenOpacity : 0.9; 62 | const onPressOpacity = IS_APPLE ? givenOpacity : androidActiveOpacity; 63 | 64 | const press: PressableProps['onPress'] = e => { 65 | if (typeof onPress === 'function' && !loading) onPress(e); 66 | }; 67 | 68 | const containedBg = 69 | loading || disabled ? theme?.colors?.disabledBgColor : primaryColor; 70 | const textBg = 'transparent'; 71 | 72 | const bgColor = variant === 'text' ? textBg : containedBg; 73 | 74 | const textTxtColor = 75 | loading || disabled 76 | ? theme?.colors?.disabledBgColor 77 | : textColor || theme?.colors?.primary; 78 | 79 | const outlinedTxtColor = 80 | loading || disabled 81 | ? theme?.colors?.disabledBgColor 82 | : textColor || theme?.colors?.primary; 83 | 84 | const containedTxtColor = textColor || theme?.colors?.backgroundLite; 85 | 86 | const textColorOutlinedOrContained = 87 | variant === 'outlined' ? outlinedTxtColor : containedTxtColor; 88 | 89 | const txtColor = 90 | variant === 'text' ? textTxtColor : textColorOutlinedOrContained; 91 | const styleProp = useMemo(() => StyleSheet.flatten(style), [style]); 92 | return ( 93 | ({ 100 | backgroundColor: bgColor, 101 | opacity: pressed ? onPressOpacity : 1, 102 | ...styles.button, 103 | ...(!loading 104 | ? { padding: paddingWhenNotLoading } 105 | : { padding: paddingWhenLoading }), 106 | ...(pressed ? styleOnPress : styleOnLeave), 107 | ...(shadow ? styles.shadow : {}), 108 | ...(variant === 'outlined' 109 | ? { 110 | borderWidth: 1, 111 | borderColor: txtColor, 112 | backgroundColor: theme?.colors?.backgroundLite, 113 | } 114 | : {}), 115 | ...styleProp, 116 | })}> 117 | {loading ? ( 118 | 119 | 120 | 121 | ) : null} 122 | 123 | {title} 124 | 125 | {!!right && right} 126 | 127 | ); 128 | }; 129 | Button.defaultProps = { 130 | right: null, 131 | titleStyle: {}, 132 | styleOnPress: {}, 133 | style: {}, 134 | activeOpacity: 0.7, 135 | loading: false, 136 | styleOnLeave: {}, 137 | onPress: () => devLog.warn("Missing prop 'onPress' in Button Component."), 138 | shadow: false, 139 | variant: 'contianed', 140 | textColor: null, 141 | androidRipple: null, 142 | checkInternet: false, 143 | }; 144 | export default Button; 145 | -------------------------------------------------------------------------------- /template/src/components/base/Divider/index.styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | const styles = StyleSheet.create({ 4 | divider: { 5 | flex: 1, 6 | height: 0, 7 | marginVertical: 15, 8 | }, 9 | }); 10 | 11 | export default styles; 12 | -------------------------------------------------------------------------------- /template/src/components/base/Divider/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useMemo } from 'react'; 2 | import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'; 3 | import styles from './index.styles'; 4 | 5 | interface DividerProps { 6 | style?: StyleProp; 7 | } 8 | const Divider = ({ style }: DividerProps) => { 9 | const styleProp = useMemo(() => StyleSheet.flatten(style), [style]); 10 | return ( 11 | 22 | ); 23 | }; 24 | Divider.defaultProps = { 25 | style: {}, 26 | }; 27 | 28 | export default Divider; 29 | -------------------------------------------------------------------------------- /template/src/components/base/IconButton/index.styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | const styles = StyleSheet.create({ 4 | button: { 5 | alignItems: 'center', 6 | alignSelf: 'flex-start', 7 | borderRadius: 4, 8 | flexDirection: 'row', 9 | justifyContent: 'center', 10 | margin: 5, 11 | padding: 7, 12 | }, 13 | label: { 14 | color: 'white', 15 | fontWeight: 'bold', 16 | textAlign: 'center', 17 | }, 18 | round: { 19 | borderRadius: 100, 20 | }, 21 | shadowStyle: { 22 | elevation: 7, 23 | shadowColor: '#000', 24 | shadowOffset: { 25 | width: 0, 26 | height: 3, 27 | }, 28 | shadowOpacity: 0.29, 29 | 30 | shadowRadius: 4.65, 31 | }, 32 | }); 33 | 34 | export default styles; 35 | -------------------------------------------------------------------------------- /template/src/components/base/IconButton/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode, useMemo } from 'react'; 2 | import { 3 | Pressable, 4 | PressableProps, 5 | ViewStyle, 6 | ActivityIndicator, 7 | StyleProp, 8 | StyleSheet, 9 | } from 'react-native'; 10 | import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; 11 | import { devLog } from '../../../utils/helpers'; 12 | import styles from './index.styles'; 13 | import useTheme from '../../../hooks/useTheme'; 14 | 15 | export interface IconButtonProps extends PressableProps { 16 | name?: string; 17 | activeOpacity?: number; 18 | style?: StyleProp; 19 | styleOnPress?: StyleProp; 20 | styleOnLeave?: StyleProp; 21 | loading?: boolean; 22 | onPress?: PressableProps['onPress']; 23 | round?: boolean; 24 | icon?: ReactNode; 25 | size?: number; 26 | color?: string; 27 | loadingColor?: string; 28 | noShadow?: boolean; 29 | noBg?: boolean; 30 | } 31 | const IconButton = (props: IconButtonProps) => { 32 | const { 33 | name, 34 | size, 35 | icon, 36 | color, 37 | loadingColor, 38 | style, 39 | styleOnPress, 40 | styleOnLeave, 41 | activeOpacity, 42 | loading, 43 | noShadow, 44 | onPress, 45 | disabled, 46 | round, 47 | noBg, 48 | ...otherProps 49 | } = props; 50 | const theme = useTheme(); 51 | const givenOpacity = loading ? 1 : activeOpacity; 52 | 53 | const dontPressOnLoading: PressableProps['onPress'] = e => { 54 | if (typeof onPress === 'function' && !loading) onPress(e); 55 | }; 56 | 57 | const FinalIcon = name ? ( 58 | 59 | ) : ( 60 | icon 61 | ); 62 | 63 | const bgColor = 64 | loading || disabled 65 | ? theme?.colors?.disabledBgColor 66 | : theme?.colors?.backgroundLite; 67 | 68 | const backgroundColor = noBg ? 'transparent' : bgColor; 69 | 70 | const styleProp = useMemo(() => StyleSheet.flatten(style), [style]); 71 | const styleOnPressProp = useMemo( 72 | () => StyleSheet.flatten(styleOnPress), 73 | [styleOnPress], 74 | ); 75 | const styleOnLeaveProp = useMemo( 76 | () => StyleSheet.flatten(styleOnLeave), 77 | [styleOnLeave], 78 | ); 79 | return ( 80 | ({ 87 | backgroundColor, 88 | opacity: pressed ? givenOpacity : 1, 89 | ...styles.button, 90 | ...(noShadow ? {} : styles.shadowStyle), 91 | ...(round ? styles.round : {}), 92 | ...styleProp, 93 | ...(pressed ? styleOnPressProp : styleOnLeaveProp), 94 | })}> 95 | {loading ? : FinalIcon} 96 | 97 | ); 98 | }; 99 | 100 | IconButton.defaultProps = { 101 | icon: null, 102 | loadingColor: 'gray', 103 | color: 'gray', 104 | styleOnPress: {}, 105 | style: {}, 106 | activeOpacity: 0.7, 107 | loading: false, 108 | noShadow: true, 109 | styleOnLeave: {}, 110 | name: null, 111 | size: 20, 112 | noBg: true, 113 | round: false, 114 | onPress: () => devLog.warn("Missing prop 'onPress' in Button Component."), 115 | }; 116 | 117 | export default IconButton; 118 | -------------------------------------------------------------------------------- /template/src/components/base/Image/index.ts: -------------------------------------------------------------------------------- 1 | import { createImageProgress } from 'react-native-image-progress'; 2 | import FastImage, { FastImageProps } from 'react-native-fast-image'; 3 | 4 | const Image = createImageProgress(FastImage); 5 | 6 | export type ImageProps = FastImageProps; 7 | export default Image; 8 | -------------------------------------------------------------------------------- /template/src/components/base/Text/index.styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | const styles = StyleSheet.create({ 4 | default: { overflow: 'hidden' }, 5 | }); 6 | 7 | export default styles; 8 | -------------------------------------------------------------------------------- /template/src/components/base/Text/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useMemo } from 'react'; 2 | import { StyleSheet, Text as RealText, TextProps } from 'react-native'; 3 | import styles from './index.styles'; 4 | import { MAX_FONT_SIZE_MULTIPLIER } from '../../../utils/constants'; 5 | 6 | const Text = ({ style, children, ...props }: TextProps) => { 7 | const styleProp = useMemo(() => StyleSheet.flatten(style), [style]); 8 | return ( 9 | 14 | {children} 15 | 16 | ); 17 | }; 18 | 19 | export default Text; 20 | -------------------------------------------------------------------------------- /template/src/components/base/TextInput/index.styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | import { VERY_SMALL_DEVICE } from '../../../utils/constants'; 3 | import { wp } from '../../../utils/helpers/responsive.helpers'; 4 | 5 | const minHeight = wp('14%', 70, 60); 6 | const styles = StyleSheet.create({ 7 | border: { 8 | borderWidth: 0.4, 9 | }, 10 | containerStyle: { 11 | alignItems: 'center', 12 | borderColor: 'silver', 13 | borderRadius: !VERY_SMALL_DEVICE ? wp('2%', 10) : wp('1%', 5), 14 | borderWidth: 0.5, 15 | flexDirection: 'row', 16 | justifyContent: 'space-between', 17 | margin: 0.5, 18 | minHeight, 19 | overflow: 'hidden', 20 | }, 21 | error: { 22 | fontSize: 11, 23 | marginLeft: 3, 24 | marginTop: -5, 25 | }, 26 | inputContainer: { alignItems: 'center', flexDirection: 'row' }, 27 | inputStyle: { 28 | color: 'black', 29 | flex: 1, 30 | marginTop: 2, 31 | minHeight, 32 | paddingBottom: 8, 33 | 34 | paddingTop: 20, 35 | }, 36 | labelStyle: { 37 | paddingBottom: 0, 38 | paddingRight: 5, 39 | position: 'absolute', 40 | }, 41 | leftContainerShow: { 42 | alignItems: 'center', 43 | justifyContent: 'center', 44 | padding: 5, 45 | }, 46 | leftContainerStyle: { 47 | alignItems: 'center', 48 | justifyContent: 'center', 49 | padding: 8, 50 | paddingRight: 5, 51 | }, 52 | shadow: { 53 | elevation: 3, 54 | shadowColor: 'rgba(0,0,0,0.7)', 55 | shadowOffset: { 56 | width: 0, 57 | height: 2, 58 | }, 59 | shadowOpacity: 0.1, 60 | 61 | shadowRadius: 5, 62 | }, 63 | textCont: { flex: 1, justifyContent: 'center' }, 64 | }); 65 | 66 | export default styles; 67 | -------------------------------------------------------------------------------- /template/src/components/base/TextInput/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect, useMemo } from 'react'; 2 | import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; 3 | 4 | import { 5 | View, 6 | TextInput as Input, 7 | Animated, 8 | TextInputProps as InputProps, 9 | TextStyle, 10 | ViewStyle, 11 | TouchableOpacity, 12 | StyleProp, 13 | StyleSheet, 14 | } from 'react-native'; 15 | import styles from './index.styles'; 16 | import { devLog } from '../../../utils/helpers'; 17 | import useTheme from '../../../hooks/useTheme'; 18 | import Text from '../Text'; 19 | import { IS_APPLE, MAX_FONT_SIZE_MULTIPLIER } from '../../../utils/constants'; 20 | 21 | const topSpaceBeforeFocus = styles.inputStyle.minHeight / 3.1; 22 | const beforeFocusFontSize = 23 | styles.inputStyle.minHeight / Number(IS_APPLE ? 3.15 : 3.5); 24 | 25 | const afterFocusFontSize = 26 | styles.inputStyle.minHeight / Number(IS_APPLE ? 4.5 : 5); 27 | export interface TextInputProps extends InputProps { 28 | label?: string; 29 | value?: string; 30 | style?: StyleProp; 31 | containerStyle?: StyleProp; 32 | labelStyle?: StyleProp; 33 | inputStyle?: InputProps['style']; 34 | fontSizeBeforeFocus?: number; 35 | fontSizeAfterFocus?: number; 36 | topBeforeFocus?: number; 37 | topAfterFocus?: number; 38 | animationDuration?: number; 39 | colorBeforeFocus?: string; 40 | colorAfterFocus?: string; 41 | multiline?: boolean; 42 | secureTextEntry?: boolean; 43 | leftContainerStyle?: StyleProp; 44 | right?: JSX.Element; 45 | error?: string | boolean; 46 | left?: JSX.Element; 47 | height?: number; 48 | prefix?: string; 49 | prefixStyle?: StyleProp; 50 | onChange?: InputProps['onChange']; 51 | onChangeText?: InputProps['onChangeText']; 52 | testId?: string; 53 | outline?: boolean; 54 | shadow?: boolean; 55 | } 56 | const TextInput = (props: TextInputProps) => { 57 | const { 58 | label, 59 | onChange, 60 | onChangeText, 61 | value, 62 | left, 63 | right, 64 | style, 65 | containerStyle, 66 | leftContainerStyle, 67 | labelStyle, 68 | animationDuration, 69 | colorBeforeFocus, 70 | colorAfterFocus, 71 | topBeforeFocus, 72 | topAfterFocus, 73 | fontSizeBeforeFocus, 74 | fontSizeAfterFocus, 75 | inputStyle, 76 | height, 77 | error, 78 | multiline, 79 | secureTextEntry, 80 | testId, 81 | outline, 82 | shadow, 83 | prefix, 84 | prefixStyle, 85 | ...otherProps 86 | } = props; 87 | 88 | const [isFocused, setIsFocused] = useState(false); 89 | const [showPass, setShowPass] = useState(secureTextEntry); 90 | // eslint-disable-next-line react/hook-use-state 91 | const [Animation] = useState(new Animated.Value(value?.length ? 1 : 0)); 92 | const theme = useTheme(); 93 | const onFocus = () => { 94 | setIsFocused(true); 95 | }; 96 | const onBlur = () => { 97 | setIsFocused(false); 98 | }; 99 | 100 | const top = Animation.interpolate({ 101 | inputRange: [0, 1], 102 | outputRange: [topBeforeFocus || topSpaceBeforeFocus, topAfterFocus || 7], 103 | }); 104 | const fontSize = Animation.interpolate({ 105 | inputRange: [0, 1], 106 | outputRange: [ 107 | fontSizeBeforeFocus || beforeFocusFontSize, 108 | fontSizeAfterFocus || afterFocusFontSize, 109 | ], 110 | }); 111 | const color = Animation.interpolate({ 112 | inputRange: [0, 1], 113 | outputRange: [ 114 | error ? theme?.colors?.danger : colorBeforeFocus || '#aaa', 115 | error ? theme?.colors?.danger : colorAfterFocus || theme?.colors?.primary, 116 | ], 117 | }); 118 | 119 | useEffect(() => { 120 | Animated.timing(Animation, { 121 | toValue: isFocused || value?.length ? 1 : 0, 122 | duration: animationDuration || 150, 123 | useNativeDriver: false, 124 | }).start(); 125 | }, [isFocused, value, Animation, animationDuration]); 126 | const showPassword = () => setShowPass(!showPass); 127 | const hasLeft = Boolean(left); 128 | const hasRight = Boolean(right); 129 | 130 | const styleProp = useMemo(() => StyleSheet.flatten(style), [style]); 131 | const leftContainerStyleProp = useMemo( 132 | () => StyleSheet.flatten(leftContainerStyle), 133 | [leftContainerStyle], 134 | ); 135 | const labelStyleProp = useMemo( 136 | () => StyleSheet.flatten(labelStyle), 137 | [labelStyle], 138 | ); 139 | 140 | const inputStyleProp = useMemo( 141 | () => StyleSheet.flatten(inputStyle), 142 | [inputStyle], 143 | ); 144 | 145 | return ( 146 | <> 147 | 164 | {hasLeft ? ( 165 | 166 | {left} 167 | 168 | ) : null} 169 | 170 | {label ? ( 171 | 188 | {label} 189 | 190 | ) : null} 191 | 192 | {(isFocused || value?.length) && prefix ? ( 193 | {prefix} 194 | ) : null} 195 | typeof onChange === 'function' && onChange(e)} 207 | onChangeText={txt => 208 | typeof onChangeText === 'function' && onChangeText(txt) 209 | } 210 | value={value} 211 | onBlur={onBlur} 212 | onFocus={onFocus} 213 | multiline={multiline} 214 | autoCapitalize="none" 215 | secureTextEntry={showPass} 216 | // eslint-disable-next-line react/jsx-props-no-spreading 217 | {...otherProps} 218 | testID={testId || 'textInput'} 219 | maxFontSizeMultiplier={ 220 | props?.maxFontSizeMultiplier ?? MAX_FONT_SIZE_MULTIPLIER 221 | } 222 | /> 223 | 224 | 225 | {!secureTextEntry ? ( 226 | hasRight && ( 227 | 228 | {right} 229 | 230 | ) 231 | ) : ( 232 | 233 | 234 | 239 | 240 | 241 | )} 242 | 243 | {error && typeof error === 'string' ? ( 244 | 245 | {error} 246 | 247 | ) : null} 248 | 249 | ); 250 | }; 251 | 252 | TextInput.defaultProps = { 253 | label: 'Label', 254 | onChange: undefined, 255 | onChangeText: () => 256 | devLog.warn(`Missing Prop 'onChange' in TextInput Component.`), 257 | value: '', 258 | secureTextEntry: false, 259 | style: null, 260 | containerStyle: null, 261 | labelStyle: null, 262 | inputStyle: null, 263 | fontSizeBeforeFocus: beforeFocusFontSize, 264 | fontSizeAfterFocus: afterFocusFontSize, 265 | topBeforeFocus: topSpaceBeforeFocus, 266 | topAfterFocus: 4, 267 | animationDuration: 150, 268 | colorBeforeFocus: '#aaa', 269 | colorAfterFocus: null, 270 | error: null, 271 | multiline: false, 272 | leftContainerStyle: null, 273 | right: null, 274 | left: null, 275 | testId: null, 276 | height: null, 277 | outline: null, 278 | shadow: null, 279 | prefix: null, 280 | prefixStyle: null, 281 | }; 282 | 283 | export default TextInput; 284 | -------------------------------------------------------------------------------- /template/src/components/common/Container/index.styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | const styles = StyleSheet.create({ 4 | container: { 5 | flex: 1, 6 | }, 7 | }); 8 | 9 | export default styles; 10 | -------------------------------------------------------------------------------- /template/src/components/common/Container/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useMemo } from 'react'; 2 | import { View, ViewProps, StyleSheet } from 'react-native'; 3 | import { useSafeAreaInsets } from 'react-native-safe-area-context'; 4 | import useTheme from '../../../hooks/useTheme'; 5 | import styles from './index.styles'; 6 | 7 | const Container = ({ children, style, ...props }: ViewProps) => { 8 | const safeArea = useSafeAreaInsets(); 9 | const theme = useTheme(); 10 | 11 | const styleProp = useMemo(() => StyleSheet.flatten(style) || {}, [style]); 12 | return ( 13 | 25 | {children} 26 | 27 | ); 28 | }; 29 | 30 | export default Container; 31 | -------------------------------------------------------------------------------- /template/src/components/common/LoadingFullScreen/index.styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | import { WINDOW_HEIGHT, WINDOW_WIDTH } from '../../../utils/constants'; 3 | 4 | const styles = StyleSheet.create({ 5 | container: { 6 | alignItems: 'center', 7 | height: WINDOW_HEIGHT, 8 | justifyContent: 'center', 9 | width: WINDOW_WIDTH, 10 | }, 11 | }); 12 | 13 | export default styles; 14 | -------------------------------------------------------------------------------- /template/src/components/common/LoadingFullScreen/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { ActivityIndicator, View } from 'react-native'; 3 | import styles from './index.styles'; 4 | import useTheme from '../../../hooks/useTheme'; 5 | 6 | const LoadingFullScreen = () => { 7 | const theme = useTheme(); 8 | return ( 9 | 10 | 11 | 12 | ); 13 | }; 14 | 15 | export default LoadingFullScreen; 16 | -------------------------------------------------------------------------------- /template/src/components/svgs/ChartIcon.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Svg, Path } from 'react-native-svg'; 3 | import { ViewStyle } from 'react-native'; 4 | import useTheme from '../../hooks/useTheme'; 5 | 6 | type ChartIconProps = { 7 | color?: string; 8 | style?: ViewStyle; 9 | }; 10 | const ChartIcon = ({ color, style }: ChartIconProps) => { 11 | const theme = useTheme(); 12 | return ( 13 | 14 | 19 | 23 | 27 | 32 | 33 | ); 34 | }; 35 | 36 | ChartIcon.defaultProps = { 37 | color: null, 38 | style: null, 39 | }; 40 | 41 | export default ChartIcon; 42 | -------------------------------------------------------------------------------- /template/src/configs/axios.ts: -------------------------------------------------------------------------------- 1 | import axios, { AxiosRequestConfig, InternalAxiosRequestConfig } from 'axios'; 2 | import { IS_DEV } from '../utils/constants'; 3 | import { devLog } from '../utils/helpers'; 4 | import { secureStorage } from './storage'; 5 | 6 | const API_SERVER = process?.env?.API_SERVER || ''; 7 | 8 | if (IS_DEV) devLog.log('\n\nAPI_SERVER', API_SERVER); 9 | 10 | const reqConfig = { 11 | baseURL: API_SERVER, 12 | headers: { 13 | 'Content-Type': 'application/json', 14 | }, 15 | }; 16 | 17 | const AXIOS = axios.create(reqConfig); 18 | 19 | export const setAuthToken = (token?: string) => { 20 | AXIOS.interceptors.request.use(async (config: AxiosRequestConfig) => { 21 | const userToken = token || (await secureStorage.getItem('token')); 22 | 23 | const myConfig = { 24 | ...config, 25 | headers: { 26 | ...(config?.headers || {}), 27 | ...(userToken 28 | ? { Authorization: `Bearer ${userToken || ''}` } 29 | : { Authorization: false }), 30 | }, 31 | } as InternalAxiosRequestConfig; 32 | 33 | return myConfig; 34 | }); 35 | }; 36 | 37 | setAuthToken(); 38 | export default AXIOS; 39 | -------------------------------------------------------------------------------- /template/src/configs/environments.ts: -------------------------------------------------------------------------------- 1 | import ENVIRONMENTS from 'react-native-config'; 2 | 3 | export default ENVIRONMENTS; 4 | -------------------------------------------------------------------------------- /template/src/configs/https.ts: -------------------------------------------------------------------------------- 1 | import AXIOS from './axios'; 2 | 3 | export default AXIOS; 4 | -------------------------------------------------------------------------------- /template/src/configs/index.ts: -------------------------------------------------------------------------------- 1 | const baseURL = 'https://example.com'; 2 | 3 | export { baseURL }; 4 | -------------------------------------------------------------------------------- /template/src/configs/showMessage.ts: -------------------------------------------------------------------------------- 1 | import { showMessage } from 'react-native-flash-message'; 2 | 3 | export default showMessage; 4 | -------------------------------------------------------------------------------- /template/src/configs/storage.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | /* eslint-disable @typescript-eslint/no-unsafe-assignment */ 3 | /* eslint-disable promise/prefer-await-to-then */ 4 | import asyncStorageLib from '@react-native-async-storage/async-storage'; 5 | import EncryptedStorage, { ACCESSIBLE } from 'rn-secure-storage'; 6 | 7 | type GetDataType = { [key: string]: any }; 8 | 9 | const setItem = async (key: string, value: string) => 10 | asyncStorageLib.setItem(key, value); 11 | 12 | const getItem = (key: string) => asyncStorageLib.getItem(key); 13 | 14 | const setData = (key: string, data: object) => 15 | new Promise((resolve, reject) => { 16 | try { 17 | const value = JSON.stringify(data); 18 | asyncStorageLib.setItem(key, value).then(resolve).catch(reject); 19 | } catch (e) { 20 | reject(e); 21 | } 22 | }); 23 | 24 | const getData = (key: string): GetDataType => 25 | new Promise((resolve, reject) => { 26 | asyncStorageLib 27 | .getItem(key) 28 | .then(value => { 29 | try { 30 | const data: GetDataType = value ? JSON.parse(value) : null; 31 | 32 | return resolve(data); 33 | } catch (e) { 34 | return reject(e); 35 | } 36 | }) 37 | .catch(reject); 38 | }); 39 | 40 | const setSecureItem = async (key: string, value: string) => 41 | EncryptedStorage.setItem(key, value, { 42 | accessible: ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY, 43 | }); 44 | 45 | const getSecureItem = (key: string) => EncryptedStorage.getItem(key); 46 | 47 | const setSecureData = (key: string, data: object) => 48 | new Promise((resolve, reject) => { 49 | try { 50 | const value = JSON.stringify(data); 51 | EncryptedStorage.setItem(key, value, { 52 | accessible: ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY, 53 | }) 54 | .then(resolve) 55 | .catch(reject); 56 | } catch (e) { 57 | reject(e); 58 | } 59 | }); 60 | 61 | const getSecureData = (key: string): GetDataType => 62 | new Promise((resolve, reject) => { 63 | EncryptedStorage.getItem(key) 64 | .then(value => { 65 | try { 66 | const data: GetDataType = value ? JSON.parse(value) : null; 67 | 68 | return resolve(data); 69 | } catch (e) { 70 | return reject(e); 71 | } 72 | }) 73 | .catch(reject); 74 | }); 75 | 76 | const clearSecureStorage = () => EncryptedStorage.clear(); 77 | 78 | export const storage = { 79 | setItem, 80 | getItem, 81 | setData, 82 | getData, 83 | }; 84 | 85 | export const secureStorage = { 86 | setItem: setSecureItem, 87 | getItem: getSecureItem, 88 | setData: setSecureData, 89 | getData: getSecureData, 90 | clear: clearSecureStorage, 91 | }; 92 | -------------------------------------------------------------------------------- /template/src/configs/toast.ts: -------------------------------------------------------------------------------- 1 | import Toast from 'react-native-simple-toast'; 2 | 3 | const ToastShort = (msg: string) => Toast.show(msg, Toast.SHORT); 4 | const ToastLong = (msg: string) => Toast.show(msg, Toast.LONG); 5 | 6 | export { ToastShort, ToastLong }; 7 | 8 | export default Toast; 9 | -------------------------------------------------------------------------------- /template/src/hooks/useDispatch.ts: -------------------------------------------------------------------------------- 1 | import { useDispatch as useDispatchReal } from 'react-redux'; 2 | import type { AppDispatch } from '../redux'; 3 | 4 | const useDispatch: () => AppDispatch = useDispatchReal; 5 | export default useDispatch; 6 | -------------------------------------------------------------------------------- /template/src/hooks/useSelector.ts: -------------------------------------------------------------------------------- 1 | import { 2 | TypedUseSelectorHook, 3 | useSelector as useSelectorReal, 4 | } from 'react-redux'; 5 | import type { RootState } from '../redux'; 6 | 7 | const useSelector: TypedUseSelectorHook = useSelectorReal; 8 | 9 | export default useSelector; 10 | -------------------------------------------------------------------------------- /template/src/hooks/useTheme.ts: -------------------------------------------------------------------------------- 1 | import { useSelector } from 'react-redux'; 2 | import { ThemeState } from '../utils/types/redux/theme.type'; 3 | 4 | const useTheme = () => { 5 | const theme: ThemeState = useSelector( 6 | (state: { theme: ThemeState }) => state.theme, 7 | ); 8 | 9 | return theme; 10 | }; 11 | 12 | export default useTheme; 13 | -------------------------------------------------------------------------------- /template/src/navigation/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { 3 | NavigationContainer, 4 | Theme, 5 | useNavigationContainerRef, 6 | } from '@react-navigation/native'; 7 | import { createNativeStackNavigator } from '@react-navigation/native-stack'; 8 | 9 | import { useColorScheme } from 'react-native'; 10 | import { ReactNavigationInstrumentation } from '@sentry/react-native'; 11 | import navigationList, { 12 | deepLinking, 13 | } from '../utils/constants/navigationList.constants'; 14 | import type { RootStackParamList } from '../utils/types/navigation.types'; 15 | import { hideSplash, shouldRenderNav } from '../utils/helpers'; 16 | import { defaultTheme } from '../utils/constants/theme.constants'; 17 | 18 | import LoadingFullScreen from '../components/common/LoadingFullScreen/index'; 19 | import useDispatch from '../hooks/useDispatch'; 20 | import useSelector from '../hooks/useSelector'; 21 | import { setTheme } from '../redux/theme'; 22 | 23 | const Stack = createNativeStackNavigator(); 24 | type NavigationProps = { 25 | routingInstrumentation?: ReactNavigationInstrumentation | null; 26 | }; 27 | 28 | const Navigation = ({ routingInstrumentation }: NavigationProps) => { 29 | const navigation = useNavigationContainerRef(); 30 | const theme = useSelector(state => state?.theme); 31 | const user = useSelector(state => state?.user?.data); 32 | 33 | const dispatch = useDispatch(); 34 | const scheme = useColorScheme(); 35 | 36 | const isDarkMode = scheme === 'dark'; 37 | const myTheme: Theme = { 38 | dark: isDarkMode, 39 | colors: theme?.colors?.primary ? theme?.colors : defaultTheme.colors, 40 | }; 41 | 42 | useEffect(() => { 43 | dispatch( 44 | setTheme({ 45 | ...defaultTheme, 46 | dark: theme.dark == null ? isDarkMode : theme.dark, 47 | }), 48 | ); 49 | // eslint-disable-next-line react-hooks/exhaustive-deps 50 | }, [scheme]); 51 | 52 | const loadInitialData = () => { 53 | // await loadDataHere() 54 | // setAuthToken(); 55 | // eslint-disable-next-line @typescript-eslint/no-floating-promises 56 | hideSplash(); 57 | }; 58 | 59 | useEffect(() => { 60 | // Update Data when user state changes, please remove this dependency if data is not based on auth state. 61 | loadInitialData(); 62 | }, [user]); 63 | 64 | return ( 65 | } 68 | onReady={() => { 69 | // Register the navigation container with the instrumentation 70 | if (routingInstrumentation) 71 | routingInstrumentation.registerNavigationContainer(navigation); 72 | }} 73 | ref={navigation} 74 | theme={myTheme}> 75 | 76 | {navigationList 77 | ?.filter(nav => shouldRenderNav({ nav, user })) 78 | .map(nav => ( 79 | 85 | ))} 86 | 87 | 88 | ); 89 | }; 90 | 91 | Navigation.defaultProps = { 92 | routingInstrumentation: null, 93 | }; 94 | export default Navigation; 95 | -------------------------------------------------------------------------------- /template/src/redux/index.ts: -------------------------------------------------------------------------------- 1 | import AsyncStorage from '@react-native-async-storage/async-storage'; 2 | import { configureStore, combineReducers } from '@reduxjs/toolkit'; 3 | import { 4 | persistReducer, 5 | persistStore, 6 | FLUSH, 7 | REHYDRATE, 8 | PAUSE, 9 | PERSIST, 10 | PURGE, 11 | REGISTER, 12 | } from 'redux-persist'; 13 | import theme from './theme'; 14 | import user from './user'; 15 | 16 | const reducers = combineReducers({ 17 | user, 18 | theme, 19 | }); 20 | 21 | const persistConfig = { 22 | key: 'root', 23 | storage: AsyncStorage, 24 | }; 25 | 26 | const persistedReducer = persistReducer(persistConfig, reducers); 27 | 28 | const store = configureStore({ 29 | reducer: persistedReducer, 30 | middleware: getDefaultMiddleware => { 31 | const middlewares = getDefaultMiddleware({ 32 | thunk: { 33 | extraArgument: { 34 | thunk: true, 35 | }, 36 | }, 37 | serializableCheck: { 38 | ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], 39 | }, 40 | }); 41 | 42 | return middlewares; 43 | }, 44 | }); 45 | 46 | const persistor = persistStore(store); 47 | 48 | export type RootState = ReturnType; 49 | export type AppDispatch = typeof store.dispatch; 50 | 51 | export { store, persistor }; 52 | -------------------------------------------------------------------------------- /template/src/redux/theme/index.ts: -------------------------------------------------------------------------------- 1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'; 2 | import { defaultTheme } from '../../utils/constants/theme.constants'; 3 | import { ThemeState } from '../../utils/types/redux/theme.type'; 4 | 5 | const initialState = { 6 | ...defaultTheme, 7 | }; 8 | const theme = createSlice({ 9 | name: 'theme', 10 | initialState, 11 | reducers: { 12 | switchDarkMode: ( 13 | state: typeof initialState, 14 | { payload }: PayloadAction, 15 | ) => { 16 | state.dark = payload; 17 | }, 18 | setTheme: ( 19 | state: typeof initialState, 20 | { payload }: PayloadAction, 21 | ) => payload, 22 | }, 23 | }); 24 | 25 | export const { switchDarkMode, setTheme } = theme.actions; 26 | 27 | export default theme.reducer; 28 | -------------------------------------------------------------------------------- /template/src/redux/user/index.ts: -------------------------------------------------------------------------------- 1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'; 2 | import { UserState } from '../../utils/types/redux/user.type'; 3 | 4 | const initialState: UserState = { 5 | data: undefined, 6 | }; 7 | const user = createSlice({ 8 | name: 'user', 9 | initialState, 10 | reducers: { 11 | setUser: ( 12 | state: typeof initialState, 13 | { payload }: PayloadAction, 14 | ) => { 15 | state.data = payload; 16 | }, 17 | }, 18 | }); 19 | 20 | export const { setUser } = user.actions; 21 | 22 | export default user.reducer; 23 | -------------------------------------------------------------------------------- /template/src/screens/Error/index.styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | const styles = StyleSheet.create({ 4 | container: { 5 | alignItems: 'center', 6 | flex: 1, 7 | justifyContent: 'center', 8 | }, 9 | errText: { 10 | color: 'red', 11 | fontSize: 10, 12 | }, 13 | resetBtnCont: { 14 | marginTop: 20, 15 | }, 16 | }); 17 | 18 | export default styles; 19 | -------------------------------------------------------------------------------- /template/src/screens/Error/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react'; 2 | import { View, Text, Button, Dimensions } from 'react-native'; 3 | import Lottie from 'lottie-react-native'; 4 | import { FallbackProps } from 'react-error-boundary'; 5 | import styles from './index.styles'; 6 | import { hideSplash } from '../../utils/helpers'; 7 | 8 | /** 9 | * Please try using native/built-in components and try avoiding in-app components or thirdparty UI components on this screen. 10 | * 11 | */ 12 | type ComponentT = React.ComponentType; 13 | 14 | const ErrorScreen: ComponentT = (props: FallbackProps) => { 15 | // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment 16 | const { error, resetErrorBoundary } = props; 17 | // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call 18 | const errorMsg = error?.message?.toString?.(); 19 | const hideSplashScreen = async () => { 20 | await hideSplash(); 21 | }; 22 | useEffect(() => { 23 | // eslint-disable-next-line @typescript-eslint/no-floating-promises 24 | hideSplashScreen(); 25 | }, []); 26 | 27 | return ( 28 | 29 | 36 | {!!error && Error: {errorMsg}} 37 | 38 |