@modhamanish/rn-mm-template 1.0.1
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/MMTemplate/.bundle/config +2 -0
- package/MMTemplate/.eslintrc.js +4 -0
- package/MMTemplate/.prettierrc.js +5 -0
- package/MMTemplate/.watchmanconfig +1 -0
- package/MMTemplate/App.tsx +41 -0
- package/MMTemplate/Gemfile +16 -0
- package/MMTemplate/README.md +109 -0
- package/MMTemplate/__tests__/App.test.tsx +13 -0
- package/MMTemplate/_gitignore +79 -0
- package/MMTemplate/android/app/build.gradle +119 -0
- package/MMTemplate/android/app/debug.keystore +0 -0
- package/MMTemplate/android/app/proguard-rules.pro +10 -0
- package/MMTemplate/android/app/src/main/AndroidManifest.xml +27 -0
- package/MMTemplate/android/app/src/main/java/com/mmtemplate/MainActivity.kt +22 -0
- package/MMTemplate/android/app/src/main/java/com/mmtemplate/MainApplication.kt +27 -0
- package/MMTemplate/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/MMTemplate/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/MMTemplate/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/MMTemplate/android/app/src/main/res/values/strings.xml +3 -0
- package/MMTemplate/android/app/src/main/res/values/styles.xml +9 -0
- package/MMTemplate/android/build.gradle +21 -0
- package/MMTemplate/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/MMTemplate/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/MMTemplate/android/gradle.properties +44 -0
- package/MMTemplate/android/gradlew +251 -0
- package/MMTemplate/android/gradlew.bat +99 -0
- package/MMTemplate/android/settings.gradle +6 -0
- package/MMTemplate/app.json +4 -0
- package/MMTemplate/babel.config.js +8 -0
- package/MMTemplate/index.js +9 -0
- package/MMTemplate/ios/.xcode.env +11 -0
- package/MMTemplate/ios/MMTemplate/AppDelegate.swift +48 -0
- package/MMTemplate/ios/MMTemplate/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/MMTemplate/ios/MMTemplate/Images.xcassets/Contents.json +6 -0
- package/MMTemplate/ios/MMTemplate/Info.plist +55 -0
- package/MMTemplate/ios/MMTemplate/LaunchScreen.storyboard +47 -0
- package/MMTemplate/ios/MMTemplate/PrivacyInfo.xcprivacy +37 -0
- package/MMTemplate/ios/MMTemplate.xcodeproj/project.pbxproj +480 -0
- package/MMTemplate/ios/MMTemplate.xcodeproj/xcshareddata/xcschemes/MMTemplate.xcscheme +88 -0
- package/MMTemplate/ios/Podfile +38 -0
- package/MMTemplate/jest.config.js +3 -0
- package/MMTemplate/metro.config.js +11 -0
- package/MMTemplate/package.json +55 -0
- package/MMTemplate/src/assets/images/index.ts +4 -0
- package/MMTemplate/src/assets/images/logo-dark.png +0 -0
- package/MMTemplate/src/assets/images/logo.png +0 -0
- package/MMTemplate/src/components/AnimationView.tsx +113 -0
- package/MMTemplate/src/components/CustomToast.tsx +46 -0
- package/MMTemplate/src/components/FeatureItem.tsx +59 -0
- package/MMTemplate/src/components/FullScreenContainer.tsx +60 -0
- package/MMTemplate/src/components/InfoCard.tsx +61 -0
- package/MMTemplate/src/components/LanguageSwitcher.tsx +80 -0
- package/MMTemplate/src/components/TextInput.tsx +74 -0
- package/MMTemplate/src/components/ThemeSwitcher.tsx +63 -0
- package/MMTemplate/src/context/AuthContext.tsx +76 -0
- package/MMTemplate/src/context/ThemeContext.tsx +67 -0
- package/MMTemplate/src/locales/en.json +83 -0
- package/MMTemplate/src/locales/hi.json +83 -0
- package/MMTemplate/src/mock/index.ts +5 -0
- package/MMTemplate/src/navigation/AppNavigator.tsx +45 -0
- package/MMTemplate/src/navigation/AppStack.tsx +27 -0
- package/MMTemplate/src/navigation/AuthCheck.tsx +50 -0
- package/MMTemplate/src/navigation/AuthStack.tsx +24 -0
- package/MMTemplate/src/navigation/MainTab.tsx +50 -0
- package/MMTemplate/src/navigation/routes.ts +17 -0
- package/MMTemplate/src/screens/HomeScreen.tsx +296 -0
- package/MMTemplate/src/screens/LoginScreen.tsx +199 -0
- package/MMTemplate/src/screens/ProfileScreen.tsx +171 -0
- package/MMTemplate/src/screens/SettingsScreen.tsx +96 -0
- package/MMTemplate/src/screens/WelcomeScreen.tsx +215 -0
- package/MMTemplate/src/theme/Colors.ts +25 -0
- package/MMTemplate/src/types/components.types.ts +13 -0
- package/MMTemplate/src/types/navigation.types.ts +35 -0
- package/MMTemplate/src/utils/i18n.ts +28 -0
- package/MMTemplate/src/utils/navigationUtils.ts +72 -0
- package/MMTemplate/src/utils/storageHelper.ts +51 -0
- package/MMTemplate/src/utils/utilsHelper.ts +34 -0
- package/MMTemplate/src/utils/validationSchemas.ts +58 -0
- package/MMTemplate/tsconfig.json +8 -0
- package/README.md +108 -0
- package/package.json +22 -0
- package/script.js +62 -0
- package/template.config.js +11 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# MMTemplate - React Native TypeScript Boilerplate
|
|
2
|
+
|
|
3
|
+
Welcome to **MMTemplate**! This is a robust and modern React Native template built with TypeScript, designed to jumpstart your mobile application development.
|
|
4
|
+
|
|
5
|
+
## 🚀 Usage
|
|
6
|
+
|
|
7
|
+
To initialize a new project using this template, run the following command:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @react-native-community/cli@latest init AwesomeProject --template https://github.com/modhamanish/mm-template
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Replace `AwesomeProject` with your desired project name.
|
|
14
|
+
|
|
15
|
+
## 🚀 Features
|
|
16
|
+
|
|
17
|
+
This template includes the following key libraries and configurations:
|
|
18
|
+
|
|
19
|
+
* **Core**: React Native (0.83.1), React (19.2.0)
|
|
20
|
+
* **Language**: TypeScript (v5) for static type checking
|
|
21
|
+
* **Navigation**: [React Navigation v7](https://reactnavigation.org/) (Native Stack)
|
|
22
|
+
* **Internationalization**: [react-i18next](https://react.i18next.com/) with multi-language support (English/Hindi)
|
|
23
|
+
* **Storage**: [react-native-mmkv](https://github.com/mrousavy/react-native-mmkv) for high-performance persistence
|
|
24
|
+
* **Animations**: [React Native Reanimated v4](https://docs.swmansion.com/react-native-reanimated/) & Worklets
|
|
25
|
+
* **UI/UX**:
|
|
26
|
+
* **Theme Support**: Light/Dark mode with persistence
|
|
27
|
+
* **Authentication**: Pre-configured login and profile flow
|
|
28
|
+
* [React Native Safe Area Context](https://github.com/th3rdwave/react-native-safe-area-context) for handling safe areas
|
|
29
|
+
* [React Native Keyboard Controller](https://github.com/kirillzyusko/react-native-keyboard-controller) for advanced keyboard handling
|
|
30
|
+
* [React Native Toast Message](https://github.com/calintamas/react-native-toast-message) for in-app notifications
|
|
31
|
+
* **Testing**: Jest & React Test Renderer
|
|
32
|
+
|
|
33
|
+
## 📂 Project Structure
|
|
34
|
+
|
|
35
|
+
The project is organized in the `src` directory to keep clean separation of concerns:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
src/
|
|
39
|
+
├── assets/ # Images, fonts, and other static assets
|
|
40
|
+
├── components/ # Reusable UI components
|
|
41
|
+
├── context/ # React Context definitions (Global State)
|
|
42
|
+
├── locales/ # Translation files (i18n)
|
|
43
|
+
├── mock/ # Mock data for testing and development
|
|
44
|
+
├── navigation/ # Navigation configuration (Stacks, Stacks, etc.)
|
|
45
|
+
├── screens/ # Screen components (Views)
|
|
46
|
+
├── theme/ # Theme configuration (Colors, Typography, Spacing)
|
|
47
|
+
├── types/ # Global TypeScript types and interfaces
|
|
48
|
+
└── utils/ # Helper functions and utilities
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Key Files & Directories
|
|
52
|
+
|
|
53
|
+
| Directory / File | Path | Description |
|
|
54
|
+
| :--- | :--- | :--- |
|
|
55
|
+
| **`assets/`** | `src/assets/` | Stores static assets such as images, fonts, and icons. |
|
|
56
|
+
| **`components/`** | `src/components/` | Contains reusable UI components used throughout the application (e.g., buttons, input fields). |
|
|
57
|
+
| **`context/`** | `src/context/` | Holds React Context definitions for global state management (e.g., ThemeContext, AuthContext). |
|
|
58
|
+
| **`locales/`** | `src/locales/` | Contains translation files for internationalization (e.g., `en.json`, `hi.json`). |
|
|
59
|
+
| **`mock/`** | `src/mock/` | Stores mock data used for development and testing. |
|
|
60
|
+
| **`navigation/`** | `src/navigation/` | Contains all navigation-related configuration. |
|
|
61
|
+
| └ `AppNavigator.tsx` | `src/navigation/AppNavigator.tsx` | The root navigation container. Handles switching between `AuthCheck`, `AuthStack`, and `AppStack`. |
|
|
62
|
+
| └ `AppStack.tsx` | `src/navigation/AppStack.tsx` | Main application stack (post-login). Defines screens accessible to authenticated users. |
|
|
63
|
+
| └ `AuthCheck.tsx` | `src/navigation/AuthCheck.tsx` | Entry splash screen logic. Determines authentication state and routes accordingly. |
|
|
64
|
+
| └ `AuthStack.tsx` | `src/navigation/AuthStack.tsx` | Authentication flow stack. Defines screens like Login and Registration. |
|
|
65
|
+
| **`screens/`** | `src/screens/` | Contains all the screen components (pages) of the application. |
|
|
66
|
+
| **`theme/`** | `src/theme/` | Centralized theme configuration (e.g., Colors, Typography). |
|
|
67
|
+
| **`types/`** | `src/types/` | Stores TypeScript type definitions and interfaces for the application. |
|
|
68
|
+
| **`utils/`** | `src/utils/` | Contains utility functions and helper classes. |
|
|
69
|
+
|
|
70
|
+
## 🔐 Authentication Flow
|
|
71
|
+
|
|
72
|
+
MMTemplate comes with a pre-configured authentication flow managed via React Context.
|
|
73
|
+
|
|
74
|
+
### 1. State Management
|
|
75
|
+
Authentication state is managed globally using `AuthContext` (`src/context/AuthContext.tsx`). You can access user data and authentication methods anywhere in the app:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
const { user, updateUser, handleLogout, isUserLoggedIn } = useAuth();
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Navigation Logic
|
|
82
|
+
- **`AuthCheck`**: The entry point component that checks if a user is already logged in (via `react-native-mmkv` persistence).
|
|
83
|
+
- **`AuthStack`**: contains screens for non-authenticated users (Welcome, Login).
|
|
84
|
+
- **`AppStack`**: contains the main application screens (Home, Profile, Settings).
|
|
85
|
+
|
|
86
|
+
Navigation automatically switches between these stacks based on the `user` state in `AuthContext`.
|
|
87
|
+
|
|
88
|
+
### 3. Mock Credentials
|
|
89
|
+
For testing purposes, you can use the following credentials (defined in `src/mock/index.ts`):
|
|
90
|
+
- **Email**: `user@gmail.com`
|
|
91
|
+
- **Password**: `123456`
|
|
92
|
+
|
|
93
|
+
### 4. Storage Persistence
|
|
94
|
+
User sessions are persisted locally using `react-native-mmkv`, ensuring users stay logged in even after closing the app.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 📝 Scripts
|
|
99
|
+
|
|
100
|
+
* `yarn start`: Starts the Metro Bundler.
|
|
101
|
+
* `yarn android`: Builds and runs the Android app.
|
|
102
|
+
* `yarn ios`: Builds and runs the iOS app.
|
|
103
|
+
* `yarn lint`: Lints the project files.
|
|
104
|
+
* `yarn test`: Runs Jest tests.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
Made with ❤️ using **MMTemplate**.
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@modhamanish/rn-mm-template",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A robust and modern React Native template built with TypeScript, designed to jumpstart your mobile application development.",
|
|
5
|
+
"repository": "https://github.com/modhamanish/mm-template.git",
|
|
6
|
+
"author": "Manish Modha",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"react-native",
|
|
10
|
+
"typescript",
|
|
11
|
+
"template",
|
|
12
|
+
"boilerplate",
|
|
13
|
+
"starter-kit",
|
|
14
|
+
"react-navigation-v7",
|
|
15
|
+
"reanimated-v4",
|
|
16
|
+
"i18n",
|
|
17
|
+
"mobile-development",
|
|
18
|
+
"ios",
|
|
19
|
+
"android",
|
|
20
|
+
"mmkv"
|
|
21
|
+
]
|
|
22
|
+
}
|
package/script.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const colors = {
|
|
4
|
+
reset: "\x1b[0m",
|
|
5
|
+
bold: "\x1b[1m",
|
|
6
|
+
red: "\x1b[31m",
|
|
7
|
+
green: "\x1b[32m",
|
|
8
|
+
yellow: "\x1b[33m",
|
|
9
|
+
blue: "\x1b[34m",
|
|
10
|
+
magenta: "\x1b[35m",
|
|
11
|
+
cyan: "\x1b[36m",
|
|
12
|
+
white: "\x1b[37m",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const logo = `
|
|
16
|
+
${colors.red}${colors.bold}
|
|
17
|
+
███╗ ███╗███╗ ███╗ ████████╗███████╗███╗ ███╗██████╗ ██╗ █████╗ ████████╗███████╗
|
|
18
|
+
████╗ ████║████╗ ████║ ╚══██╔══╝██╔════╝████╗ ████║██╔══██╗██║ ██╔══██╗╚══██╔══╝██╔════╝
|
|
19
|
+
██╔████╔██║██╔████╔██║ ██║ █████╗ ██╔████╔██║██████╔╝██║ ███████║ ██║ █████╗
|
|
20
|
+
██║╚██╔╝██║██║╚██╔╝██║ ██║ ██╔══╝ ██║╚██╔╝██║██╔═══╝ ██║ ██╔══██║ ██║ ██╔══╝
|
|
21
|
+
██║ ╚═╝ ██║██║ ╚═╝ ██║ ██║ ███████╗██║ ╚═╝ ██║██║ ███████╗██║ ██║ ██║ ███████╗
|
|
22
|
+
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝
|
|
23
|
+
${colors.reset}`;
|
|
24
|
+
|
|
25
|
+
console.log(logo);
|
|
26
|
+
console.log(
|
|
27
|
+
`${colors.cyan}${colors.bold}🚀 Thank you for choosing MM Template!${colors.reset}`
|
|
28
|
+
);
|
|
29
|
+
console.log(
|
|
30
|
+
`${colors.white}A production-ready React Native boilerplate designed for speed and productivity.${colors.reset}\n`
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
console.log(`${colors.yellow}${colors.bold}📦 Loaded Features:${colors.reset}`);
|
|
34
|
+
console.log(`${colors.green} ✓${colors.reset} React Native + TypeScript`);
|
|
35
|
+
console.log(
|
|
36
|
+
`${colors.green} ✓${colors.reset} Internationalization (react-i18next)`
|
|
37
|
+
);
|
|
38
|
+
console.log(
|
|
39
|
+
`${colors.green} ✓${colors.reset} High Performance Storage (MMKV)`
|
|
40
|
+
);
|
|
41
|
+
console.log(
|
|
42
|
+
`${colors.green} ✓${colors.reset} Pre-configured Auth Flow & Routing`
|
|
43
|
+
);
|
|
44
|
+
console.log(
|
|
45
|
+
`${colors.green} ✓${colors.reset} Modern UI with Animations (Reanimated)\n`
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
console.log(`${colors.magenta}${colors.bold}👉 Next Steps:${colors.reset}`);
|
|
49
|
+
console.log(`${colors.white} 1. cd <project-name>`);
|
|
50
|
+
console.log(` 2. yarn install`);
|
|
51
|
+
console.log(` 3. cd ios && pod install (for iOS developers)`);
|
|
52
|
+
console.log(
|
|
53
|
+
` 4. yarn ios ${colors.reset}or${colors.white} yarn android${colors.reset}\n`
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
console.log(`${colors.blue}${colors.bold}🔗 Useful Links:${colors.reset}`);
|
|
57
|
+
console.log(
|
|
58
|
+
`${colors.cyan} GitHub: https://github.com/modhamanish/mm-template${colors.reset}`
|
|
59
|
+
);
|
|
60
|
+
console.log(`${colors.cyan} Author: Manish Modha${colors.reset}\n`);
|
|
61
|
+
|
|
62
|
+
console.log(`${colors.red}${colors.bold}Happy Coding! 🚀✨${colors.reset}\n`);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// Placeholder used to rename and replace in files
|
|
3
|
+
// package.json, index.json, android/, ios/
|
|
4
|
+
placeholderName: "MMTemplate",
|
|
5
|
+
|
|
6
|
+
// Directory with template
|
|
7
|
+
templateDir: "./MMTemplate",
|
|
8
|
+
|
|
9
|
+
// Path to script, which will be executed after init
|
|
10
|
+
postInitScript: "./script.js"
|
|
11
|
+
};
|