react-native-boiler-plate-vijay 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +84 -0
- package/package.json +32 -0
- package/template/.husky/pre-commit +1 -0
- package/template/Gemfile +16 -0
- package/template/README.md +272 -0
- package/template/__tests__/App.test.tsx +13 -0
- package/template/_eslintrc.js +4 -0
- package/template/_gitignore +71 -0
- package/template/_prettierrc.js +7 -0
- package/template/_watchmanconfig +1 -0
- package/template/android/app/build.gradle +119 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/proguard-rules.pro +10 -0
- package/template/android/app/src/main/AndroidManifest.xml +28 -0
- package/template/android/app/src/main/assets/custom/index.ts +12 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Black.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Bold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-ExtraBold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-ExtraLight.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Italic.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Light.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Medium.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/Poppins-Thin.ttf +0 -0
- package/template/android/app/src/main/java/com/helloworld/MainActivity.kt +29 -0
- package/template/android/app/src/main/java/com/helloworld/MainApplication.kt +27 -0
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/values/strings.xml +3 -0
- package/template/android/app/src/main/res/values/styles.xml +9 -0
- package/template/android/build.gradle +31 -0
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/template/android/gradle.properties +44 -0
- package/template/android/gradlew +251 -0
- package/template/android/gradlew.bat +99 -0
- package/template/android/settings.gradle +6 -0
- package/template/app.json +4 -0
- package/template/babel.config.js +38 -0
- package/template/index.js +9 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/HelloWorld/AppDelegate.swift +48 -0
- package/template/ios/HelloWorld/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/HelloWorld/Images.xcassets/Contents.json +6 -0
- package/template/ios/HelloWorld/Info.plist +73 -0
- package/template/ios/HelloWorld/LaunchScreen.storyboard +47 -0
- package/template/ios/HelloWorld/PrivacyInfo.xcprivacy +45 -0
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +547 -0
- package/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld.xcscheme +88 -0
- package/template/ios/HelloWorld.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/Podfile +34 -0
- package/template/jest.config.js +3 -0
- package/template/metro.config.js +24 -0
- package/template/package.json +83 -0
- package/template/react-native.config.js +3 -0
- package/template/src/api/axiosInstance.ts +75 -0
- package/template/src/api/index.ts +13 -0
- package/template/src/appRedux/index.ts +32 -0
- package/template/src/appRedux/modules/LoaderSlice.ts +23 -0
- package/template/src/appRedux/modules/ProfileSlice.ts +56 -0
- package/template/src/assets/fonts/Poppins-Black.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Bold.ttf +0 -0
- package/template/src/assets/fonts/Poppins-ExtraBold.ttf +0 -0
- package/template/src/assets/fonts/Poppins-ExtraLight.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Italic.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Light.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Medium.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Regular.ttf +0 -0
- package/template/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/template/src/assets/fonts/Poppins-Thin.ttf +0 -0
- package/template/src/assets/fonts/index.ts +12 -0
- package/template/src/assets/images/IC_Home_Active.svg +3 -0
- package/template/src/assets/images/IC_Home_UnActive.svg +4 -0
- package/template/src/assets/images/IC_Setting_Active.svg +3 -0
- package/template/src/assets/images/IC_Setting_UnActive.svg +3 -0
- package/template/src/assets/images/index.ts +11 -0
- package/template/src/assets/index.ts +1 -0
- package/template/src/common/asyncServices.ts +41 -0
- package/template/src/common/constant.ts +18 -0
- package/template/src/common/helperFunctions.ts +70 -0
- package/template/src/common/index.ts +3 -0
- package/template/src/components/NoInternetModalPopUp.tsx +71 -0
- package/template/src/components/PrimaryButton.tsx +74 -0
- package/template/src/components/PrimaryFlashMessage.tsx +122 -0
- package/template/src/components/PrimaryLoader.tsx +37 -0
- package/template/src/components/PrimaryScrollView.tsx +97 -0
- package/template/src/components/PrimaryText.tsx +25 -0
- package/template/src/components/index.ts +15 -0
- package/template/src/hooks/index.ts +0 -0
- package/template/src/i18n/en.json +30 -0
- package/template/src/i18n/es.json +30 -0
- package/template/src/i18n/i18n.ts +37 -0
- package/template/src/i18n/index.ts +4 -0
- package/template/src/index.tsx +25 -0
- package/template/src/navigation/AppStack.tsx +22 -0
- package/template/src/navigation/AuthStack.tsx +12 -0
- package/template/src/navigation/MainNavigation.tsx +35 -0
- package/template/src/navigation/RootNavigationRef.ts +46 -0
- package/template/src/navigation/TabNavigator.tsx +65 -0
- package/template/src/navigation/index.ts +5 -0
- package/template/src/screens/Home/index.tsx +51 -0
- package/template/src/screens/Login/index.tsx +48 -0
- package/template/src/screens/ModalScreen/index.tsx +56 -0
- package/template/src/screens/Profile/index.tsx +68 -0
- package/template/src/screens/index.ts +5 -0
- package/template/src/services/index.ts +0 -0
- package/template/src/static/index.ts +0 -0
- package/template/src/theme/colors.ts +7 -0
- package/template/src/theme/dimensions.ts +35 -0
- package/template/src/theme/index.ts +3 -0
- package/template/src/theme/styles.ts +7 -0
- package/template/src/types/declarations.d.ts +6 -0
- package/template/src/types/index.ts +64 -0
- package/template/tsconfig.json +27 -0
- package/template.config.js +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Vijay P
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @vijayp-07/react-native-boiler-plate
|
|
2
|
+
|
|
3
|
+
A professional, production-ready React Native template with TypeScript, Redux Toolkit, React Navigation, Axios, i18n, SVG support, and a scalable enterprise-grade folder architecture.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @react-native-community/cli@latest init MyApp --template @vijayp-07/react-native-boiler-plate
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's Included
|
|
12
|
+
|
|
13
|
+
| Category | Library |
|
|
14
|
+
|---|---|
|
|
15
|
+
| Language | TypeScript |
|
|
16
|
+
| Navigation | React Navigation v7 (Stack + Bottom Tabs) |
|
|
17
|
+
| State Management | Redux Toolkit + React Redux |
|
|
18
|
+
| HTTP Client | Axios (with interceptors) |
|
|
19
|
+
| Storage | AsyncStorage |
|
|
20
|
+
| Internationalisation | i18next + react-i18next |
|
|
21
|
+
| SVG Support | react-native-svg + react-native-svg-transformer |
|
|
22
|
+
| Network Detection | @react-native-community/netinfo |
|
|
23
|
+
| Device Info | react-native-device-info |
|
|
24
|
+
| Notifications | react-native-flash-message |
|
|
25
|
+
| Linting | ESLint + @react-native/eslint-config |
|
|
26
|
+
| Formatting | Prettier |
|
|
27
|
+
| Git Hooks | Husky + lint-staged |
|
|
28
|
+
| Testing | Jest + react-test-renderer |
|
|
29
|
+
|
|
30
|
+
## Folder Structure
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
src/
|
|
34
|
+
├── api/ # Axios instance and API modules
|
|
35
|
+
├── appRedux/ # Redux store, slices
|
|
36
|
+
├── assets/ # Fonts, images, SVGs
|
|
37
|
+
├── common/ # Constants, helpers, async utilities
|
|
38
|
+
├── components/ # Reusable UI components
|
|
39
|
+
├── hooks/ # Custom React hooks
|
|
40
|
+
├── i18n/ # Translation files and i18n setup
|
|
41
|
+
├── navigation/ # Stack, Tab, Root navigators
|
|
42
|
+
├── screens/ # Feature screens
|
|
43
|
+
├── services/ # Business logic services
|
|
44
|
+
├── static/ # Static data
|
|
45
|
+
├── theme/ # Colors, dimensions, global styles
|
|
46
|
+
└── types/ # TypeScript type declarations
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Path Aliases
|
|
50
|
+
|
|
51
|
+
All aliases are configured in both `babel.config.js` and `tsconfig.json`:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { PrimaryButton } from '@components';
|
|
55
|
+
import { colors } from '@theme';
|
|
56
|
+
import { axiosInstance } from '@api';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Scripts
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
yarn android # Run on Android
|
|
63
|
+
yarn ios # Run on iOS
|
|
64
|
+
yarn start # Start Metro bundler
|
|
65
|
+
yarn lint # Run ESLint
|
|
66
|
+
yarn lint:fix # Auto-fix lint issues
|
|
67
|
+
yarn format # Format with Prettier
|
|
68
|
+
yarn test # Run Jest tests
|
|
69
|
+
yarn test:coverage # Run tests with coverage
|
|
70
|
+
yarn clean # Clean React Native cache
|
|
71
|
+
yarn clean:android # Clean Android build
|
|
72
|
+
yarn clean:ios # Clean iOS build
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Requirements
|
|
76
|
+
|
|
77
|
+
- Node >= 22.11.0
|
|
78
|
+
- React Native 0.84.1
|
|
79
|
+
- Xcode 15+ (iOS)
|
|
80
|
+
- Android Studio + JDK 17 (Android)
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-boiler-plate-vijay",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A professional, production-ready React Native boilerplate template with TypeScript, Redux Toolkit, React Navigation, Axios, i18n, SVG support, and scalable architecture.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"template",
|
|
8
|
+
"boilerplate",
|
|
9
|
+
"typescript",
|
|
10
|
+
"redux",
|
|
11
|
+
"navigation",
|
|
12
|
+
"starter"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/vijayp-07/react-native-boiler-plate#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/vijayp-07/react-native-boiler-plate/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/vijayp-07/react-native-boiler-plate.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "Vijay P",
|
|
24
|
+
"main": "template.config.js",
|
|
25
|
+
"files": [
|
|
26
|
+
"template/",
|
|
27
|
+
"template.config.js"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">= 22.11.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
package/template/Gemfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
|
+
ruby ">= 2.6.10"
|
|
5
|
+
|
|
6
|
+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
|
|
7
|
+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
|
8
|
+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
|
9
|
+
gem 'xcodeproj', '< 1.26.0'
|
|
10
|
+
gem 'concurrent-ruby', '< 1.3.4'
|
|
11
|
+
|
|
12
|
+
# Ruby 3.4.0 has removed some libraries from the standard library.
|
|
13
|
+
gem 'bigdecimal'
|
|
14
|
+
gem 'logger'
|
|
15
|
+
gem 'benchmark'
|
|
16
|
+
gem 'mutex_m'
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# React Native Boilerplate
|
|
2
|
+
|
|
3
|
+
A production-ready React Native boilerplate with navigation, Redux, i18n, axios, and more — pre-configured so you can focus on building features.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @react-native-community/cli@latest init MyApp --template react-native-boiler-plate
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Navigation:** React Navigation with separate `AuthStack`, `AppStack`, `TabNavigator`, and a typed `RootNavigationRef` for navigating outside components
|
|
14
|
+
- **Redux:** Redux Toolkit setup with `LoaderSlice` and `ProfileSlice`, typed `useAppSelector` / `useAppDispatch` hooks
|
|
15
|
+
- **Axios:** Pre-configured `axiosInstance` with request/response interceptors for auth token injection and error handling (401, 500, network errors)
|
|
16
|
+
- **Internationalization (i18n):** i18next + react-i18next with English and Spanish locale support
|
|
17
|
+
- **TypeScript:** Full type coverage including navigation param lists and screen props
|
|
18
|
+
- **Babel Aliases:** Clean imports via path aliases (e.g. `@screens`, `@components`, `@appRedux`)
|
|
19
|
+
- **Custom Components:** `PrimaryLoader`, `PrimaryText`, `PrimaryButton`, `PrimaryFlashMessage`, `PrimaryScrollView`, `NoInternetModalPopUp`
|
|
20
|
+
- **Asset Management:** Fonts (Poppins) and SVG images with centralized exports
|
|
21
|
+
- **Async Storage:** Utility wrappers for AsyncStorage via `@common`
|
|
22
|
+
- **Network Detection:** `NoInternetModalPopUp` using `@react-native-community/netinfo`
|
|
23
|
+
|
|
24
|
+
## Requirements
|
|
25
|
+
|
|
26
|
+
- Node >= 22.11.0
|
|
27
|
+
- React Native 0.84.1
|
|
28
|
+
- React 19.2.3
|
|
29
|
+
|
|
30
|
+
## Project Structure
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
📁src
|
|
34
|
+
│
|
|
35
|
+
├── 📁api
|
|
36
|
+
│ ├── axiosInstance.ts # Axios instance with request/response interceptors
|
|
37
|
+
│ └── index.ts
|
|
38
|
+
│
|
|
39
|
+
├── 📁appRedux
|
|
40
|
+
│ ├── 📁modules
|
|
41
|
+
│ │ ├── LoaderSlice.ts # Global loader state
|
|
42
|
+
│ │ └── ProfileSlice.ts # User auth/profile state
|
|
43
|
+
│ └── index.ts # Store setup, typed hooks, slice exports
|
|
44
|
+
│
|
|
45
|
+
├── 📁assets
|
|
46
|
+
│ ├── 📁fonts
|
|
47
|
+
│ │ ├── Poppins-*.ttf
|
|
48
|
+
│ │ └── index.ts
|
|
49
|
+
│ ├── 📁images
|
|
50
|
+
│ │ ├── IC_Home_Active.svg
|
|
51
|
+
│ │ ├── IC_Home_UnActive.svg
|
|
52
|
+
│ │ ├── IC_Setting_Active.svg
|
|
53
|
+
│ │ ├── IC_Setting_UnActive.svg
|
|
54
|
+
│ │ └── index.ts
|
|
55
|
+
│ └── index.ts
|
|
56
|
+
│
|
|
57
|
+
├── 📁common
|
|
58
|
+
│ ├── asyncServices.ts # AsyncStorage get/set/clear helpers
|
|
59
|
+
│ ├── constant.ts # App-wide constants (BASE_URL, ASYNC_KEY, etc.)
|
|
60
|
+
│ ├── helperFunctions.ts # Utility functions (showDangerMessage, prettyPrint, etc.)
|
|
61
|
+
│ └── index.ts
|
|
62
|
+
│
|
|
63
|
+
├── 📁components
|
|
64
|
+
│ ├── NoInternetModalPopUp.tsx
|
|
65
|
+
│ ├── PrimaryButton.tsx
|
|
66
|
+
│ ├── PrimaryFlashMessage.tsx # Animated toast with fade in/out, per-type styling
|
|
67
|
+
│ ├── PrimaryLoader.tsx
|
|
68
|
+
│ ├── PrimaryScrollView.tsx # Keyboard-aware ScrollView, auto-scrolls to focused input
|
|
69
|
+
│ ├── PrimaryText.tsx
|
|
70
|
+
│ └── index.ts
|
|
71
|
+
│
|
|
72
|
+
├── 📁hooks
|
|
73
|
+
│ └── index.ts
|
|
74
|
+
│
|
|
75
|
+
├── 📁i18n
|
|
76
|
+
│ ├── en.json # English translations
|
|
77
|
+
│ ├── es.json # Spanish translations
|
|
78
|
+
│ ├── i18n.ts # i18next configuration
|
|
79
|
+
│ └── index.ts
|
|
80
|
+
│
|
|
81
|
+
├── 📁navigation
|
|
82
|
+
│ ├── AuthStack.tsx # Unauthenticated screens (LogIn)
|
|
83
|
+
│ ├── AppStack.tsx # Authenticated screens (TabNavigation, ModalScreen)
|
|
84
|
+
│ ├── MainNavigation.tsx # Root NavigationContainer, switches Auth/App stack
|
|
85
|
+
│ ├── RootNavigationRef.ts # Typed navigationRef + navigate/goBack/resetRoot helpers
|
|
86
|
+
│ ├── TabNavigator.tsx # Bottom tab navigator (Home, Profile)
|
|
87
|
+
│ └── index.ts
|
|
88
|
+
│
|
|
89
|
+
├── 📁screens
|
|
90
|
+
│ ├── 📁Home
|
|
91
|
+
│ │ └── index.tsx
|
|
92
|
+
│ ├── 📁Login
|
|
93
|
+
│ │ └── index.tsx
|
|
94
|
+
│ ├── 📁ModalScreen
|
|
95
|
+
│ │ └── index.tsx
|
|
96
|
+
│ ├── 📁Profile
|
|
97
|
+
│ │ └── index.tsx
|
|
98
|
+
│ └── index.ts
|
|
99
|
+
│
|
|
100
|
+
├── 📁services
|
|
101
|
+
│ └── index.ts
|
|
102
|
+
│
|
|
103
|
+
├── 📁static
|
|
104
|
+
│ └── index.ts
|
|
105
|
+
│
|
|
106
|
+
├── 📁theme
|
|
107
|
+
│ ├── colors.ts
|
|
108
|
+
│ ├── dimensions.ts # perfectSize helper
|
|
109
|
+
│ ├── styles.ts
|
|
110
|
+
│ └── index.ts
|
|
111
|
+
│
|
|
112
|
+
├── 📁types
|
|
113
|
+
│ ├── declarations.d.ts # SVG and module declarations
|
|
114
|
+
│ └── index.ts # Navigation param lists and screen prop types
|
|
115
|
+
│
|
|
116
|
+
└── index.tsx # App entry point
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Custom Components
|
|
120
|
+
|
|
121
|
+
### PrimaryFlashMessage
|
|
122
|
+
|
|
123
|
+
Animated toast notification with per-type styling (success, danger, warning, info). Fade in/out animation is driven by `animationDuration`. Rendered via a custom `FlashMessageComponent` for full layout control.
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import {showSuccessMessage, showDangerMessage} from '@common';
|
|
127
|
+
|
|
128
|
+
// Success
|
|
129
|
+
showSuccessMessage('Saved!');
|
|
130
|
+
|
|
131
|
+
// Error
|
|
132
|
+
showDangerMessage('Something went wrong');
|
|
133
|
+
|
|
134
|
+
// With description
|
|
135
|
+
showDangerMessage('Check your input', {description: 'Email is invalid'});
|
|
136
|
+
|
|
137
|
+
// With a local FlashMessage ref
|
|
138
|
+
showSuccessMessage('Profile updated!', {}, flashRef);
|
|
139
|
+
showDangerMessage('Upload failed', {description: 'Try again'}, flashRef);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### PrimaryScrollView
|
|
143
|
+
|
|
144
|
+
A keyboard-aware `ScrollView` that automatically scrolls the focused `TextInput` into view when the keyboard opens. The scroll offset is calculated dynamically based on the actual height of the focused input.
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
import {PrimaryScrollView} from '@components';
|
|
148
|
+
|
|
149
|
+
<PrimaryScrollView>
|
|
150
|
+
<TextInput placeholder="Email" />
|
|
151
|
+
<TextInput placeholder="Password" />
|
|
152
|
+
</PrimaryScrollView>;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
To adjust the gap above the focused input, change the padding value inside `PrimaryScrollView.tsx`:
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
// Adjust the padding value (height - perfectSize(12)) to control the gap above the focused input.
|
|
159
|
+
y: Math.max(0, y - height - perfectSize(12));
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Navigation Structure
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
MainNavigation (NavigationContainer)
|
|
166
|
+
│
|
|
167
|
+
├── AuthStack → LogIn
|
|
168
|
+
│
|
|
169
|
+
└── AppStack
|
|
170
|
+
├── TabNavigator
|
|
171
|
+
│ ├── Home
|
|
172
|
+
│ └── Profile
|
|
173
|
+
└── ModalScreen (transparentModal)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Screen Prop Types
|
|
177
|
+
|
|
178
|
+
| Type | Use for |
|
|
179
|
+
| ----------------------------- | ---------------------------------------------------- |
|
|
180
|
+
| `AuthStackScreenProps<T>` | Screens inside `AuthStack` (e.g. `LogIn`) |
|
|
181
|
+
| `AppStackScreenProps<T>` | Screens inside `AppStack` (e.g. `ModalScreen`) |
|
|
182
|
+
| `TabNavigationScreenProps<T>` | Tab screens that only use tab navigation |
|
|
183
|
+
| `CompositeTabScreenProps<T>` | Tab screens that also navigate to `AppStack` screens |
|
|
184
|
+
|
|
185
|
+
### Navigating Outside Components
|
|
186
|
+
|
|
187
|
+
Use the helpers from `@navigation` anywhere (services, redux, axios interceptors):
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
import {navigate, goBack, resetRoot} from '@navigation';
|
|
191
|
+
|
|
192
|
+
navigate('LogIn');
|
|
193
|
+
navigate('ModalScreen');
|
|
194
|
+
resetRoot({index: 0, routes: [{name: 'LogIn'}]});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Babel Aliases
|
|
198
|
+
|
|
199
|
+
| Alias | Path |
|
|
200
|
+
| ------------- | --------------------- |
|
|
201
|
+
| `@api` | `./src/api` |
|
|
202
|
+
| `@appRedux` | `./src/appRedux` |
|
|
203
|
+
| `@assets` | `./src/assets` |
|
|
204
|
+
| `@common` | `./src/common` |
|
|
205
|
+
| `@components` | `./src/components` |
|
|
206
|
+
| `@fonts` | `./src/assets/fonts` |
|
|
207
|
+
| `@hooks` | `./src/hooks` |
|
|
208
|
+
| `@i18n` | `./src/i18n` |
|
|
209
|
+
| `@images` | `./src/assets/images` |
|
|
210
|
+
| `@navigation` | `./src/navigation` |
|
|
211
|
+
| `@screens` | `./src/screens` |
|
|
212
|
+
| `@services` | `./src/services` |
|
|
213
|
+
| `@static` | `./src/static` |
|
|
214
|
+
| `@theme` | `./src/theme` |
|
|
215
|
+
| `@types` | `./src/types` |
|
|
216
|
+
|
|
217
|
+
## Adding a New Alias
|
|
218
|
+
|
|
219
|
+
1. Create a folder inside `src/` with an `index.ts` that exports everything from it.
|
|
220
|
+
|
|
221
|
+
2. Add the alias to `babel.config.js`:
|
|
222
|
+
|
|
223
|
+
```js
|
|
224
|
+
alias: {
|
|
225
|
+
'@newAlias': './src/newFolder',
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
3. Add the path to `tsconfig.json`:
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
"paths": {
|
|
233
|
+
"@newAlias": ["./src/newFolder"]
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Getting Started
|
|
238
|
+
|
|
239
|
+
Install dependencies:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
npm install
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
iOS — install pods (first time or after native dependency changes):
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
bundle install
|
|
249
|
+
bundle exec pod install
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Run on Android:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
npm run android
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Run on iOS:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
npm run ios
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Start Metro:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
npm start
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
Powered by [React Native](https://reactnative.dev)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @format
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactTestRenderer from 'react-test-renderer';
|
|
7
|
+
import App from '../App';
|
|
8
|
+
|
|
9
|
+
test('renders correctly', async () => {
|
|
10
|
+
await ReactTestRenderer.act(() => {
|
|
11
|
+
ReactTestRenderer.create(<App />);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# OSX
|
|
2
|
+
.DS_Store
|
|
3
|
+
|
|
4
|
+
# Xcode
|
|
5
|
+
build/
|
|
6
|
+
*.pbxuser
|
|
7
|
+
!default.pbxuser
|
|
8
|
+
*.mode1v3
|
|
9
|
+
!default.mode1v3
|
|
10
|
+
*.mode2v3
|
|
11
|
+
!default.mode2v3
|
|
12
|
+
*.perspectivev3
|
|
13
|
+
!default.perspectivev3
|
|
14
|
+
xcuserdata
|
|
15
|
+
*.xccheckout
|
|
16
|
+
*.moved-aside
|
|
17
|
+
DerivedData
|
|
18
|
+
*.hmap
|
|
19
|
+
*.ipa
|
|
20
|
+
*.xcuserstate
|
|
21
|
+
**/.xcode.env.local
|
|
22
|
+
|
|
23
|
+
# Android/IntelliJ
|
|
24
|
+
build/
|
|
25
|
+
.idea
|
|
26
|
+
.gradle
|
|
27
|
+
local.properties
|
|
28
|
+
*.iml
|
|
29
|
+
*.hprof
|
|
30
|
+
.cxx/
|
|
31
|
+
*.keystore
|
|
32
|
+
!debug.keystore
|
|
33
|
+
.kotlin/
|
|
34
|
+
|
|
35
|
+
# node.js
|
|
36
|
+
node_modules/
|
|
37
|
+
npm-debug.log
|
|
38
|
+
yarn-error.log
|
|
39
|
+
|
|
40
|
+
# Fastlane
|
|
41
|
+
**/fastlane/report.xml
|
|
42
|
+
**/fastlane/Preview.html
|
|
43
|
+
**/fastlane/screenshots
|
|
44
|
+
**/fastlane/test_output
|
|
45
|
+
|
|
46
|
+
# Bundle artifact
|
|
47
|
+
*.jsbundle
|
|
48
|
+
|
|
49
|
+
# Ruby / CocoaPods
|
|
50
|
+
**/Pods/
|
|
51
|
+
/vendor/bundle/
|
|
52
|
+
|
|
53
|
+
# Metro
|
|
54
|
+
.metro-health-check*
|
|
55
|
+
|
|
56
|
+
# Testing
|
|
57
|
+
/coverage
|
|
58
|
+
|
|
59
|
+
# Env files
|
|
60
|
+
.env
|
|
61
|
+
.env.local
|
|
62
|
+
.env.*.local
|
|
63
|
+
!.env.example
|
|
64
|
+
|
|
65
|
+
# Yarn
|
|
66
|
+
.yarn/*
|
|
67
|
+
!.yarn/patches
|
|
68
|
+
!.yarn/plugins
|
|
69
|
+
!.yarn/releases
|
|
70
|
+
!.yarn/sdks
|
|
71
|
+
!.yarn/versions
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
apply plugin: "com.android.application"
|
|
2
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
3
|
+
apply plugin: "com.facebook.react"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This is the configuration block to customize your React Native Android app.
|
|
7
|
+
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
|
8
|
+
*/
|
|
9
|
+
react {
|
|
10
|
+
/* Folders */
|
|
11
|
+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
|
|
12
|
+
// root = file("../../")
|
|
13
|
+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
|
|
14
|
+
// reactNativeDir = file("../../node_modules/react-native")
|
|
15
|
+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
|
|
16
|
+
// codegenDir = file("../../node_modules/@react-native/codegen")
|
|
17
|
+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
|
|
18
|
+
// cliFile = file("../../node_modules/react-native/cli.js")
|
|
19
|
+
|
|
20
|
+
/* Variants */
|
|
21
|
+
// The list of variants to that are debuggable. For those we're going to
|
|
22
|
+
// skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
|
|
23
|
+
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
24
|
+
// debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
|
|
25
|
+
|
|
26
|
+
/* Bundling */
|
|
27
|
+
// A list containing the node command and its flags. Default is just 'node'.
|
|
28
|
+
// nodeExecutableAndArgs = ["node"]
|
|
29
|
+
//
|
|
30
|
+
// The command to run when bundling. By default is 'bundle'
|
|
31
|
+
// bundleCommand = "ram-bundle"
|
|
32
|
+
//
|
|
33
|
+
// The path to the CLI configuration file. Default is empty.
|
|
34
|
+
// bundleConfig = file(../rn-cli.config.js)
|
|
35
|
+
//
|
|
36
|
+
// The name of the generated asset file containing your JS bundle
|
|
37
|
+
// bundleAssetName = "MyApplication.android.bundle"
|
|
38
|
+
//
|
|
39
|
+
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
40
|
+
// entryFile = file("../js/MyApplication.android.js")
|
|
41
|
+
//
|
|
42
|
+
// A list of extra flags to pass to the 'bundle' commands.
|
|
43
|
+
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
44
|
+
// extraPackagerArgs = []
|
|
45
|
+
|
|
46
|
+
/* Hermes Commands */
|
|
47
|
+
// The hermes compiler command to run. By default it is 'hermesc'
|
|
48
|
+
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
|
49
|
+
//
|
|
50
|
+
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
51
|
+
// hermesFlags = ["-O", "-output-source-map"]
|
|
52
|
+
|
|
53
|
+
/* Autolinking */
|
|
54
|
+
autolinkLibrariesWithApp()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
59
|
+
*/
|
|
60
|
+
def enableProguardInReleaseBuilds = false
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The preferred build flavor of JavaScriptCore (JSC)
|
|
64
|
+
*
|
|
65
|
+
* For example, to use the international variant, you can use:
|
|
66
|
+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
|
|
67
|
+
*
|
|
68
|
+
* The international variant includes ICU i18n library and necessary data
|
|
69
|
+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
70
|
+
* give correct results when using with locales other than en-US. Note that
|
|
71
|
+
* this variant is about 6MiB larger per architecture than default.
|
|
72
|
+
*/
|
|
73
|
+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
|
|
74
|
+
|
|
75
|
+
android {
|
|
76
|
+
ndkVersion rootProject.ext.ndkVersion
|
|
77
|
+
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
78
|
+
compileSdk rootProject.ext.compileSdkVersion
|
|
79
|
+
|
|
80
|
+
namespace "com.helloworld"
|
|
81
|
+
defaultConfig {
|
|
82
|
+
applicationId "com.helloworld"
|
|
83
|
+
minSdkVersion rootProject.ext.minSdkVersion
|
|
84
|
+
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
85
|
+
versionCode 1
|
|
86
|
+
versionName "1.0"
|
|
87
|
+
}
|
|
88
|
+
signingConfigs {
|
|
89
|
+
debug {
|
|
90
|
+
storeFile file('debug.keystore')
|
|
91
|
+
storePassword 'android'
|
|
92
|
+
keyAlias 'androiddebugkey'
|
|
93
|
+
keyPassword 'android'
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
buildTypes {
|
|
97
|
+
debug {
|
|
98
|
+
signingConfig signingConfigs.debug
|
|
99
|
+
}
|
|
100
|
+
release {
|
|
101
|
+
// Caution! In production, you need to generate your own keystore file.
|
|
102
|
+
// see https://reactnative.dev/docs/signed-apk-android.
|
|
103
|
+
signingConfig signingConfigs.debug
|
|
104
|
+
minifyEnabled enableProguardInReleaseBuilds
|
|
105
|
+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
dependencies {
|
|
111
|
+
// The version of react-native is set by the React Native Gradle Plugin
|
|
112
|
+
implementation("com.facebook.react:react-android")
|
|
113
|
+
|
|
114
|
+
if (hermesEnabled.toBoolean()) {
|
|
115
|
+
implementation("com.facebook.react:hermes-android")
|
|
116
|
+
} else {
|
|
117
|
+
implementation jscFlavor
|
|
118
|
+
}
|
|
119
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
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:
|