@umang-thakkar/base-template 1.0.9 → 1.1.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/README.md +5 -2
- package/package.json +1 -1
- package/template/android/app/build.gradle +2 -2
- package/template/android/app/src/main/AndroidManifest.xml +1 -0
- package/template/android/app/src/main/java/com/basetemplate/MainApplication.kt +10 -21
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/template/android/gradlew +1 -1
- package/template/ios/BaseTemplate/Info.plist +8 -2
- package/template/ios/BaseTemplate.xcodeproj/project.pbxproj +5 -8
- package/template/ios/Podfile +0 -1
- package/template/package.json +25 -25
- package/template/src/helper/common-functions.ts +13 -18
- package/template/tsconfig.json +7 -2
- package/template/android/app/src/debug/AndroidManifest.xml +0 -9
- package/template/yarn.lock +0 -7003
package/README.md
CHANGED
|
@@ -239,9 +239,12 @@ The template includes a complete theming system with automatic system preference
|
|
|
239
239
|
- API calls and React Query hooks are in `src/api/queries.ts`.
|
|
240
240
|
- Example usage:
|
|
241
241
|
```ts
|
|
242
|
-
import { useQuery } from "react-query";
|
|
242
|
+
import { useQuery } from "@tanstack/react-query";
|
|
243
243
|
import { fetchData } from "../api/queries";
|
|
244
|
-
const { data, isLoading } = useQuery(
|
|
244
|
+
const { data, isLoading } = useQuery({
|
|
245
|
+
queryKey: ["data"],
|
|
246
|
+
queryFn: fetchData,
|
|
247
|
+
});
|
|
245
248
|
```
|
|
246
249
|
|
|
247
250
|
### 🧰 Utility Functions
|
package/package.json
CHANGED
|
@@ -19,9 +19,9 @@ react {
|
|
|
19
19
|
|
|
20
20
|
/* Variants */
|
|
21
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.
|
|
22
|
+
// skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
|
|
23
23
|
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
24
|
-
// debuggableVariants = ["liteDebug", "prodDebug"]
|
|
24
|
+
// debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
|
|
25
25
|
|
|
26
26
|
/* Bundling */
|
|
27
27
|
// A list containing the node command and its flags. Default is just 'node'.
|
|
@@ -5,31 +5,20 @@ import com.facebook.react.PackageList
|
|
|
5
5
|
import com.facebook.react.ReactApplication
|
|
6
6
|
import com.facebook.react.ReactHost
|
|
7
7
|
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
|
|
8
|
-
import com.facebook.react.ReactNativeHost
|
|
9
|
-
import com.facebook.react.ReactPackage
|
|
10
8
|
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
11
|
-
import com.facebook.react.defaults.DefaultReactNativeHost
|
|
12
9
|
|
|
13
10
|
class MainApplication : Application(), ReactApplication {
|
|
14
11
|
|
|
15
|
-
override val
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
|
|
26
|
-
|
|
27
|
-
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
28
|
-
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
override val reactHost: ReactHost
|
|
32
|
-
get() = getDefaultReactHost(applicationContext, reactNativeHost)
|
|
12
|
+
override val reactHost: ReactHost by lazy {
|
|
13
|
+
getDefaultReactHost(
|
|
14
|
+
context = applicationContext,
|
|
15
|
+
packageList =
|
|
16
|
+
PackageList(this).packages.apply {
|
|
17
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
18
|
+
// add(MyReactNativePackage())
|
|
19
|
+
},
|
|
20
|
+
)
|
|
21
|
+
}
|
|
33
22
|
|
|
34
23
|
override fun onCreate() {
|
|
35
24
|
super.onCreate()
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
5
|
validateDistributionUrl=true
|
|
6
6
|
zipStoreBase=GRADLE_USER_HOME
|
package/template/android/gradlew
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
3
|
<plist version="1.0">
|
|
4
4
|
<dict>
|
|
5
|
+
<key>CADisableMinimumFrameDurationOnPhone</key>
|
|
6
|
+
<true/>
|
|
5
7
|
<key>CFBundleDevelopmentRegion</key>
|
|
6
8
|
<string>en</string>
|
|
7
9
|
<key>CFBundleDisplayName</key>
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
<true/>
|
|
27
29
|
<key>NSAppTransportSecurity</key>
|
|
28
30
|
<dict>
|
|
31
|
+
<!-- Do not change NSAllowsArbitraryLoads to true, or you will risk app rejection! -->
|
|
29
32
|
<key>NSAllowsArbitraryLoads</key>
|
|
30
33
|
<false/>
|
|
31
34
|
<key>NSAllowsLocalNetworking</key>
|
|
@@ -33,8 +36,6 @@
|
|
|
33
36
|
</dict>
|
|
34
37
|
<key>NSLocationWhenInUseUsageDescription</key>
|
|
35
38
|
<string></string>
|
|
36
|
-
<key>RCTNewArchEnabled</key>
|
|
37
|
-
<false/>
|
|
38
39
|
<key>UILaunchStoryboardName</key>
|
|
39
40
|
<string>LaunchScreen</string>
|
|
40
41
|
<key>UIRequiredDeviceCapabilities</key>
|
|
@@ -44,8 +45,13 @@
|
|
|
44
45
|
<key>UISupportedInterfaceOrientations</key>
|
|
45
46
|
<array>
|
|
46
47
|
<string>UIInterfaceOrientationPortrait</string>
|
|
48
|
+
</array>
|
|
49
|
+
<key>UISupportedInterfaceOrientations~ipad</key>
|
|
50
|
+
<array>
|
|
47
51
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
48
52
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
53
|
+
<string>UIInterfaceOrientationPortrait</string>
|
|
54
|
+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
|
49
55
|
</array>
|
|
50
56
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
|
51
57
|
<false/>
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
|
|
12
12
|
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
|
|
13
13
|
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
|
|
14
|
-
F51ED5429573E67DACCDD39C /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
|
|
15
14
|
/* End PBXBuildFile section */
|
|
16
15
|
|
|
17
16
|
/* Begin PBXFileReference section */
|
|
@@ -160,7 +159,6 @@
|
|
|
160
159
|
files = (
|
|
161
160
|
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
|
|
162
161
|
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
|
|
163
|
-
F51ED5429573E67DACCDD39C /* PrivacyInfo.xcprivacy in Resources */,
|
|
164
162
|
);
|
|
165
163
|
runOnlyForDeploymentPostprocessing = 0;
|
|
166
164
|
};
|
|
@@ -181,7 +179,7 @@
|
|
|
181
179
|
);
|
|
182
180
|
runOnlyForDeploymentPostprocessing = 0;
|
|
183
181
|
shellPath = /bin/sh;
|
|
184
|
-
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
|
|
182
|
+
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"\\\"$WITH_ENVIRONMENT\\\" \\\"$REACT_NATIVE_XCODE\\\"\"\n";
|
|
185
183
|
};
|
|
186
184
|
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
|
|
187
185
|
isa = PBXShellScriptBuildPhase;
|
|
@@ -275,8 +273,10 @@
|
|
|
275
273
|
);
|
|
276
274
|
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
|
277
275
|
PRODUCT_NAME = BaseTemplate;
|
|
276
|
+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
|
278
277
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
279
278
|
SWIFT_VERSION = 5.0;
|
|
279
|
+
TARGETED_DEVICE_FAMILY = "1,2";
|
|
280
280
|
VERSIONING_SYSTEM = "apple-generic";
|
|
281
281
|
};
|
|
282
282
|
name = Debug;
|
|
@@ -302,7 +302,9 @@
|
|
|
302
302
|
);
|
|
303
303
|
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
|
304
304
|
PRODUCT_NAME = BaseTemplate;
|
|
305
|
+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
|
305
306
|
SWIFT_VERSION = 5.0;
|
|
307
|
+
TARGETED_DEVICE_FAMILY = "1,2";
|
|
306
308
|
VERSIONING_SYSTEM = "apple-generic";
|
|
307
309
|
};
|
|
308
310
|
name = Release;
|
|
@@ -376,10 +378,7 @@
|
|
|
376
378
|
"-DFOLLY_CFG_NO_COROUTINES=1",
|
|
377
379
|
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
|
|
378
380
|
);
|
|
379
|
-
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
380
381
|
SDKROOT = iphoneos;
|
|
381
|
-
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
|
|
382
|
-
USE_HERMES = true;
|
|
383
382
|
};
|
|
384
383
|
name = Debug;
|
|
385
384
|
};
|
|
@@ -444,9 +443,7 @@
|
|
|
444
443
|
"-DFOLLY_CFG_NO_COROUTINES=1",
|
|
445
444
|
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
|
|
446
445
|
);
|
|
447
|
-
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
448
446
|
SDKROOT = iphoneos;
|
|
449
|
-
USE_HERMES = true;
|
|
450
447
|
VALIDATE_PRODUCT = YES;
|
|
451
448
|
};
|
|
452
449
|
name = Release;
|
package/template/ios/Podfile
CHANGED
package/template/package.json
CHANGED
|
@@ -10,47 +10,47 @@
|
|
|
10
10
|
"test": "jest"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@react-native-async-storage/async-storage": "^
|
|
14
|
-
"@react-navigation/native": "^7.
|
|
15
|
-
"@react-navigation/native-stack": "^7.
|
|
16
|
-
"@react-navigation/stack": "^7.
|
|
17
|
-
"@reduxjs/toolkit": "^2.
|
|
18
|
-
"@tanstack/react-query": "^5.
|
|
19
|
-
"axios": "^1.
|
|
20
|
-
"
|
|
21
|
-
"react": "19.
|
|
22
|
-
"react-native": "0.
|
|
23
|
-
"react-native-gesture-handler": "^
|
|
24
|
-
"react-native-
|
|
25
|
-
"react-native-safe-area-context": "^5.5.2",
|
|
13
|
+
"@react-native-async-storage/async-storage": "^3.1.1",
|
|
14
|
+
"@react-navigation/native": "^7.3.3",
|
|
15
|
+
"@react-navigation/native-stack": "^7.17.5",
|
|
16
|
+
"@react-navigation/stack": "^7.10.5",
|
|
17
|
+
"@reduxjs/toolkit": "^2.12.0",
|
|
18
|
+
"@tanstack/react-query": "^5.101.0",
|
|
19
|
+
"axios": "^1.18.0",
|
|
20
|
+
"date-fns": "^4.4.0",
|
|
21
|
+
"react": "19.2.3",
|
|
22
|
+
"react-native": "0.84.0",
|
|
23
|
+
"react-native-gesture-handler": "^3.0.1",
|
|
24
|
+
"react-native-safe-area-context": "^5.8.0",
|
|
26
25
|
"react-native-screens": "^4.15.0",
|
|
27
26
|
"react-native-svg": "^15.12.1",
|
|
28
|
-
"react-native-
|
|
29
|
-
"react-
|
|
27
|
+
"react-native-reanimated": "^4.4.1",
|
|
28
|
+
"react-native-worklets": "^0.9.0",
|
|
29
|
+
"react-redux": "^9.3.0",
|
|
30
30
|
"redux-persist": "^6.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/core": "^7.25.2",
|
|
34
34
|
"@babel/preset-env": "^7.25.3",
|
|
35
35
|
"@babel/runtime": "^7.25.0",
|
|
36
|
-
"@react-native-community/cli": "20.
|
|
37
|
-
"@react-native-community/cli-platform-android": "20.
|
|
38
|
-
"@react-native-community/cli-platform-ios": "20.
|
|
39
|
-
"@react-native/babel-preset": "0.
|
|
40
|
-
"@react-native/eslint-config": "0.
|
|
41
|
-
"@react-native/metro-config": "0.
|
|
42
|
-
"@react-native/typescript-config": "0.
|
|
36
|
+
"@react-native-community/cli": "20.1.0",
|
|
37
|
+
"@react-native-community/cli-platform-android": "20.1.0",
|
|
38
|
+
"@react-native-community/cli-platform-ios": "20.1.0",
|
|
39
|
+
"@react-native/babel-preset": "0.84.0",
|
|
40
|
+
"@react-native/eslint-config": "0.84.0",
|
|
41
|
+
"@react-native/metro-config": "0.84.0",
|
|
42
|
+
"@react-native/typescript-config": "0.84.0",
|
|
43
43
|
"@tanstack/eslint-plugin-query": "^5.83.1",
|
|
44
44
|
"@types/jest": "^29.5.13",
|
|
45
|
-
"@types/react": "^19.
|
|
45
|
+
"@types/react": "^19.2.0",
|
|
46
46
|
"@types/react-test-renderer": "^19.1.0",
|
|
47
47
|
"eslint": "^8.19.0",
|
|
48
48
|
"jest": "^29.6.3",
|
|
49
49
|
"prettier": "2.8.8",
|
|
50
|
-
"react-test-renderer": "19.
|
|
50
|
+
"react-test-renderer": "19.2.3",
|
|
51
51
|
"typescript": "^5.8.3"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
54
|
+
"node": ">= 22.11.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import
|
|
2
|
+
import { format, isValid, parseISO } from "date-fns";
|
|
3
3
|
|
|
4
4
|
const errorMessage = (error: unknown): string => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
if (axios.isAxiosError(error)) {
|
|
6
|
+
return error.response?.data?.message || error.message;
|
|
7
|
+
}
|
|
8
|
+
return String(error);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export function toFormattedDate(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
): string |
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return date.format(format);
|
|
24
|
-
}
|
|
12
|
+
dateString: string,
|
|
13
|
+
formatStr: string,
|
|
14
|
+
): string | null {
|
|
15
|
+
if (!dateString) return null;
|
|
16
|
+
const date = parseISO(dateString);
|
|
17
|
+
if (!isValid(date)) return null;
|
|
18
|
+
return format(date, formatStr);
|
|
19
|
+
}
|
package/template/tsconfig.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
-
xmlns:tools="http://schemas.android.com/tools">
|
|
4
|
-
|
|
5
|
-
<application
|
|
6
|
-
android:usesCleartextTraffic="true"
|
|
7
|
-
tools:targetApi="28"
|
|
8
|
-
tools:ignore="GoogleAppIndexingWarning"/>
|
|
9
|
-
</manifest>
|