@varunindiit/create-rn-starter 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/LICENSE +21 -0
- package/README.md +93 -0
- package/bin/index.js +270 -0
- package/lib/prompt.js +63 -0
- package/lib/rename.js +239 -0
- package/lib/scaffold.js +110 -0
- package/lib/utils.js +122 -0
- package/package.json +38 -0
- package/template/.eslintrc.js +4 -0
- package/template/.prettierrc.js +5 -0
- package/template/.watchmanconfig +1 -0
- package/template/App.tsx +100 -0
- package/template/Gemfile +17 -0
- package/template/README.md +97 -0
- package/template/__tests__/App.test.tsx +13 -0
- package/template/_gitignore +75 -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 +45 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-Black.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-BlackItalic.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-Bold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-BoldItalic.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-ExtraBold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-ExtraBoldItalic.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-ExtraLight.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-ExtraLightItalic.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-Italic.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-Light.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-LightItalic.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-Medium.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-MediumItalic.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-SemiBold.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/MonaSans-SemiBoldItalic.ttf +0 -0
- package/template/android/app/src/main/java/com/awesomeproject/MainActivity.kt +22 -0
- package/template/android/app/src/main/java/com/awesomeproject/MainApplication.kt +27 -0
- package/template/android/app/src/main/res/drawable/launch_screen.png +0 -0
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/template/android/app/src/main/res/layout/launch_screen.xml +12 -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/colors.xml +3 -0
- package/template/android/app/src/main/res/values/strings.xml +3 -0
- package/template/android/app/src/main/res/values/styles.xml +11 -0
- package/template/android/build.gradle +21 -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 +248 -0
- package/template/android/gradlew.bat +98 -0
- package/template/android/link-assets-manifest.json +69 -0
- package/template/android/settings.gradle +6 -0
- package/template/app.json +4 -0
- package/template/babel.config.js +4 -0
- package/template/declarations.d.ts +6 -0
- package/template/env.example +20 -0
- package/template/index.js +10 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/.xcode.env.local +1 -0
- package/template/ios/AwesomeProject/AppDelegate.swift +60 -0
- package/template/ios/AwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/AwesomeProject/Images.xcassets/Contents.json +6 -0
- package/template/ios/AwesomeProject/Images.xcassets/Splash.imageset/Contents.json +23 -0
- package/template/ios/AwesomeProject/Images.xcassets/Splash.imageset/Splash@1x.png +0 -0
- package/template/ios/AwesomeProject/Images.xcassets/Splash.imageset/Splash@2x.png +0 -0
- package/template/ios/AwesomeProject/Images.xcassets/Splash.imageset/Splash@3x.png +0 -0
- package/template/ios/AwesomeProject/Info.plist +89 -0
- package/template/ios/AwesomeProject/LaunchScreen.storyboard +40 -0
- package/template/ios/AwesomeProject/PrivacyInfo.xcprivacy +38 -0
- package/template/ios/AwesomeProject.xcodeproj/project.pbxproj +576 -0
- package/template/ios/AwesomeProject.xcodeproj/xcshareddata/xcschemes/AwesomeProject.xcscheme +88 -0
- package/template/ios/AwesomeProject.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/Podfile +68 -0
- package/template/ios/link-assets-manifest.json +69 -0
- package/template/jest.config.js +3 -0
- package/template/metro.config.js +24 -0
- package/template/package.json +68 -0
- package/template/react-native.config.js +7 -0
- package/template/src/assets/fonts/MonaSans-Black.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-BlackItalic.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-Bold.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-BoldItalic.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-ExtraBold.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-ExtraBoldItalic.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-ExtraLight.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-ExtraLightItalic.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-Italic.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-Light.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-LightItalic.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-Medium.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-MediumItalic.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-Regular.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-SemiBold.ttf +0 -0
- package/template/src/assets/fonts/MonaSans-SemiBoldItalic.ttf +0 -0
- package/template/src/assets/image/BackGroundAuth.png +0 -0
- package/template/src/assets/image/BackgroundVerification.png +0 -0
- package/template/src/assets/image/logo.png +0 -0
- package/template/src/assets/svg/add-circle.svg +5 -0
- package/template/src/assets/svg/airConditioning.svg +12 -0
- package/template/src/assets/svg/apple.svg +3 -0
- package/template/src/assets/svg/arrowDown.svg +3 -0
- package/template/src/assets/svg/back.svg +10 -0
- package/template/src/assets/svg/bag.svg +11 -0
- package/template/src/assets/svg/calender.svg +5 -0
- package/template/src/assets/svg/car.svg +10 -0
- package/template/src/assets/svg/carConfirm.svg +60 -0
- package/template/src/assets/svg/chatActive.svg +3 -0
- package/template/src/assets/svg/chatUnActive.svg +3 -0
- package/template/src/assets/svg/document-text.svg +6 -0
- package/template/src/assets/svg/gender.svg +11 -0
- package/template/src/assets/svg/google.svg +6 -0
- package/template/src/assets/svg/headphone.svg +3 -0
- package/template/src/assets/svg/homeActive.svg +3 -0
- package/template/src/assets/svg/homeUnActive.svg +3 -0
- package/template/src/assets/svg/logo.svg +18 -0
- package/template/src/assets/svg/logout.svg +5 -0
- package/template/src/assets/svg/maxBack.svg +4 -0
- package/template/src/assets/svg/message-text.svg +7 -0
- package/template/src/assets/svg/music.svg +5 -0
- package/template/src/assets/svg/noSmoking.svg +10 -0
- package/template/src/assets/svg/notification.svg +5 -0
- package/template/src/assets/svg/passenger.svg +4 -0
- package/template/src/assets/svg/phone.svg +3 -0
- package/template/src/assets/svg/rightArrow.svg +3 -0
- package/template/src/assets/svg/security-user.svg +5 -0
- package/template/src/assets/svg/star.svg +3 -0
- package/template/src/assets/svg/tick-circle.svg +4 -0
- package/template/src/assets/svg/trafficLight.svg +41 -0
- package/template/src/assets/svg/tripActive.svg +10 -0
- package/template/src/assets/svg/tripUnActive.svg +10 -0
- package/template/src/assets/svg/usbChargers.svg +3 -0
- package/template/src/assets/svg/user.svg +4 -0
- package/template/src/assets/svg/userActive.svg +3 -0
- package/template/src/assets/svg/userPlaceholder.svg +3 -0
- package/template/src/assets/svg/userUnActive.svg +3 -0
- package/template/src/components/AuthLayout/AuthLayout.tsx +170 -0
- package/template/src/components/AuthLayout/index.ts +1 -0
- package/template/src/components/BottomSheet/BottomSheet.tsx +73 -0
- package/template/src/components/BottomSheet/BottomSheetAlert.tsx +100 -0
- package/template/src/components/BottomSheet/CenterAlert.tsx +153 -0
- package/template/src/components/BottomSheet/index.ts +2 -0
- package/template/src/components/BottomTabBar/index.tsx +145 -0
- package/template/src/components/Button/RNButton.tsx +152 -0
- package/template/src/components/Button/index.ts +2 -0
- package/template/src/components/Common/Avatar.tsx +80 -0
- package/template/src/components/Common/Card.tsx +49 -0
- package/template/src/components/Common/CardBrandLogo.tsx +66 -0
- package/template/src/components/Common/Checkbox.tsx +65 -0
- package/template/src/components/Common/Chip.tsx +79 -0
- package/template/src/components/Common/CommonStyles.tsx +594 -0
- package/template/src/components/Common/Divider.tsx +33 -0
- package/template/src/components/Common/DriverTripCard.tsx +308 -0
- package/template/src/components/Common/Dropdown.tsx +161 -0
- package/template/src/components/Common/EmptyState.tsx +52 -0
- package/template/src/components/Common/FAB.tsx +68 -0
- package/template/src/components/Common/HeaderLocation.tsx +108 -0
- package/template/src/components/Common/Loader.tsx +23 -0
- package/template/src/components/Common/RatingStars.tsx +103 -0
- package/template/src/components/Common/RouteDots.tsx +98 -0
- package/template/src/components/Common/SegmentedControl.tsx +126 -0
- package/template/src/components/Common/SosButton.tsx +80 -0
- package/template/src/components/Common/SosSheet.tsx +344 -0
- package/template/src/components/Common/StarRating.tsx +58 -0
- package/template/src/components/Common/StatusBadge.tsx +56 -0
- package/template/src/components/Common/Toggle.tsx +66 -0
- package/template/src/components/Common/TripCard.tsx +247 -0
- package/template/src/components/Common/UploadBox.tsx +106 -0
- package/template/src/components/Container/MainContainer.tsx +76 -0
- package/template/src/components/Container/index.ts +1 -0
- package/template/src/components/Header/index.tsx +143 -0
- package/template/src/components/Icon/SvgIcons.tsx +1991 -0
- package/template/src/components/ImagePickerSheet/ImagePickerSheet.tsx +233 -0
- package/template/src/components/ImagePickerSheet/index.ts +2 -0
- package/template/src/components/Input/CountryDropdown.tsx +71 -0
- package/template/src/components/Input/OtpInput.tsx +117 -0
- package/template/src/components/Input/RNInput.tsx +138 -0
- package/template/src/components/Input/index.ts +4 -0
- package/template/src/components/Picker/DatePickerSheet.tsx +393 -0
- package/template/src/components/Picker/PassengerPickerSheet.tsx +237 -0
- package/template/src/components/Text/RNText.tsx +62 -0
- package/template/src/components/Text/index.ts +1 -0
- package/template/src/components/index.ts +44 -0
- package/template/src/hooks/useCurrentLocation.ts +72 -0
- package/template/src/localization/i18n.ts +29 -0
- package/template/src/localization/i18next.d.ts +11 -0
- package/template/src/localization/index.ts +4 -0
- package/template/src/localization/languageStorage.ts +27 -0
- package/template/src/localization/languages.ts +62 -0
- package/template/src/localization/resources/en.ts +703 -0
- package/template/src/localization/resources/fr.ts +703 -0
- package/template/src/localization/useLanguage.ts +42 -0
- package/template/src/navigation/AuthNavigation.tsx +23 -0
- package/template/src/navigation/BottomTabs.tsx +24 -0
- package/template/src/navigation/RootNavigation.tsx +27 -0
- package/template/src/navigation/RouteKey.ts +22 -0
- package/template/src/navigation/StackNavigation.tsx +52 -0
- package/template/src/navigation/paramLists.ts +25 -0
- package/template/src/redux/slice/app.ts +66 -0
- package/template/src/redux/slice/auth.ts +40 -0
- package/template/src/redux/slice/userProfile.ts +124 -0
- package/template/src/redux/store.ts +17 -0
- package/template/src/screen/auth/Login.tsx +69 -0
- package/template/src/screen/onboarding/LanguageSelection.tsx +231 -0
- package/template/src/screen/root/home/index.tsx +36 -0
- package/template/src/screen/root/profile/index.tsx +69 -0
- package/template/src/screen/shared/Chat.tsx +308 -0
- package/template/src/screen/shared/EditProfile.tsx +407 -0
- package/template/src/screen/shared/HelpSupport.tsx +678 -0
- package/template/src/screen/shared/LocationSearch.tsx +362 -0
- package/template/src/screen/shared/Messages.tsx +115 -0
- package/template/src/screen/shared/Notifications.tsx +86 -0
- package/template/src/screen/shared/PrivacyPolicy.tsx +297 -0
- package/template/src/screen/shared/Profile.tsx +118 -0
- package/template/src/screen/shared/Ratings.tsx +170 -0
- package/template/src/screen/shared/TermsConditions.tsx +315 -0
- package/template/src/screen/shared/profile/DriverProfile.tsx +262 -0
- package/template/src/screen/shared/profile/PassengerProfile.tsx +123 -0
- package/template/src/screen/shared/profile/ProfileParts.tsx +219 -0
- package/template/src/services/Config.ts +37 -0
- package/template/src/services/api.ts +37 -0
- package/template/src/services/index.ts +4 -0
- package/template/src/services/places.ts +320 -0
- package/template/src/services/storage.ts +33 -0
- package/template/src/theme/fonts.ts +30 -0
- package/template/src/theme/index.ts +3 -0
- package/template/src/theme/spacing.ts +66 -0
- package/template/src/theme/theme.ts +58 -0
- package/template/src/types/env.d.ts +8 -0
- package/template/src/types/index.ts +3 -0
- package/template/src/utils/card.ts +101 -0
- package/template/src/utils/constants.ts +39 -0
- package/template/src/utils/functions.ts +24 -0
- package/template/tsconfig.json +8 -0
package/lib/scaffold.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { spawnSync } = require("child_process");
|
|
6
|
+
|
|
7
|
+
/** Recursively copy a directory tree (preserving symlinks). */
|
|
8
|
+
function copyDir(src, dest) {
|
|
9
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
10
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
11
|
+
const from = path.join(src, entry.name);
|
|
12
|
+
const to = path.join(dest, entry.name);
|
|
13
|
+
if (entry.isDirectory()) {
|
|
14
|
+
copyDir(from, to);
|
|
15
|
+
} else if (entry.isSymbolicLink()) {
|
|
16
|
+
fs.symlinkSync(fs.readlinkSync(from), to);
|
|
17
|
+
} else {
|
|
18
|
+
fs.copyFileSync(from, to);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Rename the bundled `_gitignore` back to `.gitignore` in the new project. */
|
|
24
|
+
function restoreDotfiles(root) {
|
|
25
|
+
const from = path.join(root, "_gitignore");
|
|
26
|
+
const to = path.join(root, ".gitignore");
|
|
27
|
+
if (fs.existsSync(from)) fs.renameSync(from, to);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Restore the env template (`env.example` → `.env.example`) and seed a working
|
|
32
|
+
* `.env` from it. Stored without a leading dot in the package so npm doesn't
|
|
33
|
+
* strip it on publish (same trick as `_gitignore`).
|
|
34
|
+
*/
|
|
35
|
+
function prepareEnv(root) {
|
|
36
|
+
const bundled = path.join(root, "env.example");
|
|
37
|
+
const example = path.join(root, ".env.example");
|
|
38
|
+
if (fs.existsSync(bundled)) fs.renameSync(bundled, example);
|
|
39
|
+
const env = path.join(root, ".env");
|
|
40
|
+
if (fs.existsSync(example) && !fs.existsSync(env)) {
|
|
41
|
+
fs.copyFileSync(example, env);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Pick a package manager from the user agent that invoked us, default npm. */
|
|
46
|
+
function detectPackageManager() {
|
|
47
|
+
const ua = process.env.npm_config_user_agent || "";
|
|
48
|
+
if (ua.startsWith("yarn")) return "yarn";
|
|
49
|
+
if (ua.startsWith("pnpm")) return "pnpm";
|
|
50
|
+
if (ua.startsWith("bun")) return "bun";
|
|
51
|
+
return "npm";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function run(cmd, args, cwd) {
|
|
55
|
+
const res = spawnSync(cmd, args, { cwd, stdio: "inherit", shell: false });
|
|
56
|
+
return res.status === 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function installDeps(root, pm) {
|
|
60
|
+
return run(pm, ["install"], root);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Best-effort CocoaPods install for iOS. Only meaningful on macOS and only when
|
|
65
|
+
* an `ios/` directory exists. Prefers the project's bundler (Gemfile) so the
|
|
66
|
+
* CocoaPods version is pinned, falling back to a global `pod`.
|
|
67
|
+
*
|
|
68
|
+
* @returns {"ok"|"skipped"|"failed"}
|
|
69
|
+
*/
|
|
70
|
+
function installPods(root) {
|
|
71
|
+
if (process.platform !== "darwin") return "skipped";
|
|
72
|
+
const iosDir = path.join(root, "ios");
|
|
73
|
+
if (!fs.existsSync(iosDir)) return "skipped";
|
|
74
|
+
|
|
75
|
+
const has = (cmd) =>
|
|
76
|
+
spawnSync("sh", ["-c", `command -v ${cmd}`], { stdio: "ignore" }).status ===
|
|
77
|
+
0;
|
|
78
|
+
|
|
79
|
+
if (fs.existsSync(path.join(root, "Gemfile")) && has("bundle")) {
|
|
80
|
+
spawnSync("bundle", ["install"], { cwd: root, stdio: "inherit" });
|
|
81
|
+
if (run("bundle", ["exec", "pod", "install"], iosDir)) return "ok";
|
|
82
|
+
}
|
|
83
|
+
if (has("pod")) {
|
|
84
|
+
return run("pod", ["install"], iosDir) ? "ok" : "failed";
|
|
85
|
+
}
|
|
86
|
+
return "skipped";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function gitInit(root) {
|
|
90
|
+
if (fs.existsSync(path.join(root, ".git"))) return true;
|
|
91
|
+
const init = spawnSync("git", ["init", "-q"], { cwd: root, stdio: "ignore" });
|
|
92
|
+
if (init.status !== 0) return false;
|
|
93
|
+
spawnSync("git", ["add", "-A"], { cwd: root, stdio: "ignore" });
|
|
94
|
+
spawnSync(
|
|
95
|
+
"git",
|
|
96
|
+
["commit", "-q", "-m", "chore: bootstrap from create-rn-starter"],
|
|
97
|
+
{ cwd: root, stdio: "ignore" }
|
|
98
|
+
);
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = {
|
|
103
|
+
copyDir,
|
|
104
|
+
restoreDotfiles,
|
|
105
|
+
prepareEnv,
|
|
106
|
+
detectPackageManager,
|
|
107
|
+
installDeps,
|
|
108
|
+
installPods,
|
|
109
|
+
gitInit,
|
|
110
|
+
};
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
// ── tiny ANSI helpers ───────────────────────────────────────────────────────
|
|
6
|
+
const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
7
|
+
const wrap = (code) => (s) => (useColor ? `\x1b[${code}m${s}\x1b[0m` : String(s));
|
|
8
|
+
const c = {
|
|
9
|
+
bold: wrap(1),
|
|
10
|
+
dim: wrap(2),
|
|
11
|
+
red: wrap(31),
|
|
12
|
+
green: wrap(32),
|
|
13
|
+
yellow: wrap(33),
|
|
14
|
+
blue: wrap(34),
|
|
15
|
+
magenta: wrap(35),
|
|
16
|
+
cyan: wrap(36),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const log = (...a) => console.log(...a);
|
|
20
|
+
const step = (msg) => log(`${c.cyan("›")} ${msg}`);
|
|
21
|
+
const ok = (msg) => log(`${c.green("✔")} ${msg}`);
|
|
22
|
+
const warn = (msg) => log(`${c.yellow("!")} ${msg}`);
|
|
23
|
+
const err = (msg) => log(`${c.red("✖")} ${msg}`);
|
|
24
|
+
|
|
25
|
+
// ── name normalisation ───────────────────────────────────────────────────────
|
|
26
|
+
// A React Native CLI project carries the same app name in several casings, each
|
|
27
|
+
// needed by a different part of the toolchain:
|
|
28
|
+
//
|
|
29
|
+
// pascalName "MyCoolApp" iOS folder/scheme/target, getMainComponentName,
|
|
30
|
+
// AppRegistry key (app.json `name`)
|
|
31
|
+
// slug "my-cool-app" package.json `name`
|
|
32
|
+
// lowerName "mycoolapp" misc. lowercase identifiers
|
|
33
|
+
// displayName "My Cool App" home-screen label (strings.xml / Info.plist)
|
|
34
|
+
// bundleId "com.acme.myapp" Android applicationId + iOS bundle identifier
|
|
35
|
+
//
|
|
36
|
+
// We derive each from the single name the user types.
|
|
37
|
+
|
|
38
|
+
/** PascalCase, alphanumeric — the canonical native app/module name. */
|
|
39
|
+
function toPascalName(input) {
|
|
40
|
+
const parts = String(input)
|
|
41
|
+
.trim()
|
|
42
|
+
.replace(/[^a-zA-Z0-9]+/g, " ")
|
|
43
|
+
.trim()
|
|
44
|
+
.split(/\s+/)
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1));
|
|
47
|
+
let name = parts.join("");
|
|
48
|
+
// A native module name cannot start with a digit.
|
|
49
|
+
if (/^[0-9]/.test(name)) name = "App" + name;
|
|
50
|
+
return name || "MyApp";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Lower-kebab slug suitable for package.json `name`. */
|
|
54
|
+
function toSlug(input) {
|
|
55
|
+
return String(input)
|
|
56
|
+
.trim()
|
|
57
|
+
.toLowerCase()
|
|
58
|
+
.replace(/[^a-z0-9]+/g, "-") // non-alnum → hyphen
|
|
59
|
+
.replace(/^-+|-+$/g, "") // trim hyphens
|
|
60
|
+
.replace(/-{2,}/g, "-"); // collapse repeats
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Lowercase alphanumeric, no separators. */
|
|
64
|
+
function toLowerName(input) {
|
|
65
|
+
const s = String(input)
|
|
66
|
+
.trim()
|
|
67
|
+
.toLowerCase()
|
|
68
|
+
.replace(/[^a-z0-9]/g, "");
|
|
69
|
+
return s || "app";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Human display name — preserves the user's spacing/casing. */
|
|
73
|
+
function toDisplayName(input) {
|
|
74
|
+
const s = String(input).trim();
|
|
75
|
+
return s || "My App";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Default reverse-DNS bundle identifier from a name. */
|
|
79
|
+
function defaultBundleId(input) {
|
|
80
|
+
const tail = toLowerName(input);
|
|
81
|
+
return `com.example.${tail}`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The path segments an Android package maps to, e.g.
|
|
86
|
+
* "com.acme.myapp" → ["com", "acme", "myapp"].
|
|
87
|
+
*/
|
|
88
|
+
function bundleIdToPath(bundleId) {
|
|
89
|
+
return bundleId.split(".");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Validate a reverse-DNS identifier (com.foo.bar). */
|
|
93
|
+
function isValidBundleId(id) {
|
|
94
|
+
return /^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(id);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Validate a project/slug name. */
|
|
98
|
+
function isValidSlug(slug) {
|
|
99
|
+
return /^[a-z0-9][a-z0-9-]*$/.test(slug) && slug.length <= 214;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function resolveTarget(cwd, slug) {
|
|
103
|
+
return path.resolve(cwd, slug);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = {
|
|
107
|
+
c,
|
|
108
|
+
log,
|
|
109
|
+
step,
|
|
110
|
+
ok,
|
|
111
|
+
warn,
|
|
112
|
+
err,
|
|
113
|
+
toPascalName,
|
|
114
|
+
toSlug,
|
|
115
|
+
toLowerName,
|
|
116
|
+
toDisplayName,
|
|
117
|
+
defaultBundleId,
|
|
118
|
+
bundleIdToPath,
|
|
119
|
+
isValidBundleId,
|
|
120
|
+
isValidSlug,
|
|
121
|
+
resolveTarget,
|
|
122
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@varunindiit/create-rn-starter",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "Production-ready React Native CLI starter: React Navigation auth flow, bottom tabs, Redux Toolkit, theming, i18n, SVG support, MMKV storage, API/service layer and reusable components. Scaffolds a fully renamed Android + iOS project in seconds.",
|
|
8
|
+
"type": "commonjs",
|
|
9
|
+
"bin": {
|
|
10
|
+
"create-rn-starter": "bin/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin",
|
|
14
|
+
"lib",
|
|
15
|
+
"template"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"lint": "node --check bin/index.js && node --check lib/utils.js && node --check lib/prompt.js && node --check lib/rename.js && node --check lib/scaffold.js && node --check scripts/smoke.js",
|
|
19
|
+
"test": "node scripts/smoke.js"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18.0.0"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"react-native",
|
|
26
|
+
"react-native-cli",
|
|
27
|
+
"starter",
|
|
28
|
+
"template",
|
|
29
|
+
"boilerplate",
|
|
30
|
+
"redux",
|
|
31
|
+
"react-navigation",
|
|
32
|
+
"typescript",
|
|
33
|
+
"scaffold",
|
|
34
|
+
"cli"
|
|
35
|
+
],
|
|
36
|
+
"author": "",
|
|
37
|
+
"license": "MIT"
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/template/App.tsx
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
StatusBar,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Text,
|
|
7
|
+
TextInput,
|
|
8
|
+
View,
|
|
9
|
+
} from "react-native";
|
|
10
|
+
import { hideSplash } from "react-native-splash-view";
|
|
11
|
+
import { moderateScale } from "react-native-size-matters";
|
|
12
|
+
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
13
|
+
import { Provider } from "react-redux";
|
|
14
|
+
import { KeyboardProvider } from "react-native-keyboard-controller";
|
|
15
|
+
import { DefaultTheme, NavigationContainer } from "@react-navigation/native";
|
|
16
|
+
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
17
|
+
import FlashMessage from "react-native-flash-message";
|
|
18
|
+
|
|
19
|
+
import store from "./src/redux/store";
|
|
20
|
+
import { THEME } from "./src/theme";
|
|
21
|
+
import StackNavigation from "./src/navigation/StackNavigation";
|
|
22
|
+
import "./src/localization/i18n";
|
|
23
|
+
|
|
24
|
+
const setupFontScaling = () => {
|
|
25
|
+
if ((Text as any).defaultProps) {
|
|
26
|
+
(Text as any).defaultProps.allowFontScaling = false;
|
|
27
|
+
} else {
|
|
28
|
+
(Text as any).defaultProps = { allowFontScaling: false };
|
|
29
|
+
}
|
|
30
|
+
if ((TextInput as any).defaultProps) {
|
|
31
|
+
(TextInput as any).defaultProps.allowFontScaling = false;
|
|
32
|
+
} else {
|
|
33
|
+
(TextInput as any).defaultProps = { allowFontScaling: false };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
setupFontScaling();
|
|
38
|
+
|
|
39
|
+
const FlashMessageView = ({ message }: any) => (
|
|
40
|
+
<View style={styles.flashMessage}>
|
|
41
|
+
<Text style={styles.flashMessageText}>
|
|
42
|
+
{message.description || message.message || "Default message"}
|
|
43
|
+
</Text>
|
|
44
|
+
</View>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const App = () => {
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
hideSplash();
|
|
50
|
+
}, []);
|
|
51
|
+
return (
|
|
52
|
+
<GestureHandlerRootView style={styles.container}>
|
|
53
|
+
<SafeAreaProvider>
|
|
54
|
+
<Provider store={store}>
|
|
55
|
+
<KeyboardProvider>
|
|
56
|
+
<NavigationContainer>
|
|
57
|
+
<FlashMessage
|
|
58
|
+
position="top"
|
|
59
|
+
duration={1500}
|
|
60
|
+
statusBarHeight={
|
|
61
|
+
Platform.OS === "ios" ? moderateScale(50) : moderateScale(40)
|
|
62
|
+
}
|
|
63
|
+
MessageComponent={(props: any) => (
|
|
64
|
+
<FlashMessageView {...props} />
|
|
65
|
+
)}
|
|
66
|
+
/>
|
|
67
|
+
<StatusBar
|
|
68
|
+
backgroundColor="transparent"
|
|
69
|
+
barStyle="light-content"
|
|
70
|
+
translucent
|
|
71
|
+
/>
|
|
72
|
+
<StackNavigation />
|
|
73
|
+
</NavigationContainer>
|
|
74
|
+
</KeyboardProvider>
|
|
75
|
+
</Provider>
|
|
76
|
+
</SafeAreaProvider>
|
|
77
|
+
</GestureHandlerRootView>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default App;
|
|
82
|
+
|
|
83
|
+
const styles = StyleSheet.create({
|
|
84
|
+
container: {
|
|
85
|
+
flex: 1,
|
|
86
|
+
},
|
|
87
|
+
flashMessage: {
|
|
88
|
+
marginTop: moderateScale(40),
|
|
89
|
+
backgroundColor: "#1B2148",
|
|
90
|
+
paddingVertical: moderateScale(10),
|
|
91
|
+
paddingHorizontal: moderateScale(15),
|
|
92
|
+
borderRadius: moderateScale(8),
|
|
93
|
+
marginHorizontal: moderateScale(12),
|
|
94
|
+
},
|
|
95
|
+
flashMessageText: {
|
|
96
|
+
color: "#fff",
|
|
97
|
+
fontSize: moderateScale(12),
|
|
98
|
+
fontWeight: "600",
|
|
99
|
+
},
|
|
100
|
+
});
|
package/template/Gemfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
|
+
ruby ">= 2.6.10"
|
|
5
|
+
|
|
6
|
+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
|
|
7
|
+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
|
8
|
+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
|
9
|
+
gem 'xcodeproj', '< 1.26.0'
|
|
10
|
+
gem 'concurrent-ruby', '< 1.3.4'
|
|
11
|
+
|
|
12
|
+
# Ruby 3.4.0 has removed some libraries from the standard library.
|
|
13
|
+
gem 'bigdecimal'
|
|
14
|
+
gem 'logger'
|
|
15
|
+
gem 'benchmark'
|
|
16
|
+
gem 'mutex_m'
|
|
17
|
+
gem 'nkf'
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
|
|
2
|
+
|
|
3
|
+
# Getting Started
|
|
4
|
+
|
|
5
|
+
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
|
|
6
|
+
|
|
7
|
+
## Step 1: Start Metro
|
|
8
|
+
|
|
9
|
+
First, you will need to run **Metro**, the JavaScript build tool for React Native.
|
|
10
|
+
|
|
11
|
+
To start the Metro dev server, run the following command from the root of your React Native project:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
# Using npm
|
|
15
|
+
npm start
|
|
16
|
+
|
|
17
|
+
# OR using Yarn
|
|
18
|
+
yarn start
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Step 2: Build and run your app
|
|
22
|
+
|
|
23
|
+
With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
|
|
24
|
+
|
|
25
|
+
### Android
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
# Using npm
|
|
29
|
+
npm run android
|
|
30
|
+
|
|
31
|
+
# OR using Yarn
|
|
32
|
+
yarn android
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### iOS
|
|
36
|
+
|
|
37
|
+
For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
|
|
38
|
+
|
|
39
|
+
The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
bundle install
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Then, and every time you update your native dependencies, run:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
bundle exec pod install
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
# Using npm
|
|
55
|
+
npm run ios
|
|
56
|
+
|
|
57
|
+
# OR using Yarn
|
|
58
|
+
yarn ios
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
|
|
62
|
+
|
|
63
|
+
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
|
|
64
|
+
|
|
65
|
+
## Step 3: Modify your app
|
|
66
|
+
|
|
67
|
+
Now that you have successfully run the app, let's make changes!
|
|
68
|
+
|
|
69
|
+
Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
|
|
70
|
+
|
|
71
|
+
When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
|
|
72
|
+
|
|
73
|
+
- **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Dev Menu**, accessed via <kbd>Ctrl</kbd> + <kbd>M</kbd> (Windows/Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (macOS).
|
|
74
|
+
- **iOS**: Press <kbd>R</kbd> in iOS Simulator.
|
|
75
|
+
|
|
76
|
+
## Congratulations! :tada:
|
|
77
|
+
|
|
78
|
+
You've successfully run and modified your React Native App. :partying_face:
|
|
79
|
+
|
|
80
|
+
### Now what?
|
|
81
|
+
|
|
82
|
+
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
|
|
83
|
+
- If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).
|
|
84
|
+
|
|
85
|
+
# Troubleshooting
|
|
86
|
+
|
|
87
|
+
If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
|
|
88
|
+
|
|
89
|
+
# Learn More
|
|
90
|
+
|
|
91
|
+
To learn more about React Native, take a look at the following resources:
|
|
92
|
+
|
|
93
|
+
- [React Native Website](https://reactnative.dev) - learn more about React Native.
|
|
94
|
+
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
|
|
95
|
+
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
|
|
96
|
+
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
|
|
97
|
+
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
|
|
@@ -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,75 @@
|
|
|
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
|
+
*.keystore
|
|
35
|
+
!debug.keystore
|
|
36
|
+
.kotlin/
|
|
37
|
+
|
|
38
|
+
# node.js
|
|
39
|
+
#
|
|
40
|
+
node_modules/
|
|
41
|
+
npm-debug.log
|
|
42
|
+
yarn-error.log
|
|
43
|
+
|
|
44
|
+
# fastlane
|
|
45
|
+
#
|
|
46
|
+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
|
47
|
+
# screenshots whenever they are needed.
|
|
48
|
+
# For more information about the recommended setup visit:
|
|
49
|
+
# https://docs.fastlane.tools/best-practices/source-control/
|
|
50
|
+
|
|
51
|
+
**/fastlane/report.xml
|
|
52
|
+
**/fastlane/Preview.html
|
|
53
|
+
**/fastlane/screenshots
|
|
54
|
+
**/fastlane/test_output
|
|
55
|
+
|
|
56
|
+
# Bundle artifact
|
|
57
|
+
*.jsbundle
|
|
58
|
+
|
|
59
|
+
# Ruby / CocoaPods
|
|
60
|
+
**/Pods/
|
|
61
|
+
/vendor/bundle/
|
|
62
|
+
|
|
63
|
+
# Temporary files created by Metro to check the health of the file watcher
|
|
64
|
+
.metro-health-check*
|
|
65
|
+
|
|
66
|
+
# testing
|
|
67
|
+
/coverage
|
|
68
|
+
|
|
69
|
+
# Yarn
|
|
70
|
+
.yarn/*
|
|
71
|
+
!.yarn/patches
|
|
72
|
+
!.yarn/plugins
|
|
73
|
+
!.yarn/releases
|
|
74
|
+
!.yarn/sdks
|
|
75
|
+
!.yarn/versions
|