react-native-timezone 3.0.1 → 3.2.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 +1 -1
- package/README.md +76 -13
- package/android/build.gradle +19 -9
- package/android/generated/java/com/samitha/timezone/NativeTimezoneSpec.java +50 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNTimezoneSpec-generated.cpp +50 -0
- package/android/generated/jni/RNTimezoneSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNTimezoneSpec/RNTimezoneSpecJSI-generated.cpp +48 -0
- package/android/generated/jni/react/renderer/components/RNTimezoneSpec/RNTimezoneSpecJSI.h +94 -0
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/samitha/timezone/TimezoneModule.kt +87 -0
- package/android/src/main/java/com/samitha/timezone/TimezonePackage.kt +34 -0
- package/ios/Timezone.h +1 -7
- package/ios/Timezone.mm +71 -33
- package/ios/generated/RNTimezoneSpec/RNTimezoneSpec-generated.mm +60 -0
- package/ios/generated/RNTimezoneSpec/RNTimezoneSpec.h +62 -0
- package/ios/generated/RNTimezoneSpecJSI-generated.cpp +48 -0
- package/ios/generated/RNTimezoneSpecJSI.h +94 -0
- package/lib/commonjs/NativeTimezone.js.map +1 -1
- package/lib/commonjs/index.js +7 -18
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeTimezone.js +2 -0
- package/lib/module/NativeTimezone.js.map +1 -1
- package/lib/module/index.js +5 -15
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeTimezone.d.ts +10 -0
- package/lib/typescript/commonjs/src/NativeTimezone.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeTimezone.d.ts +10 -0
- package/lib/typescript/module/src/NativeTimezone.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +8 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +75 -111
- package/react-native-timezone.podspec +19 -21
- package/react-native.config.js +12 -0
- package/src/NativeTimezone.ts +4 -3
- package/src/index.tsx +4 -25
- package/android/src/main/java/com/samitha/rn/timezone/TimezoneModuleImpl.java +0 -60
- package/android/src/main/java/com/samitha/rn/timezone/TimezonePackage.java +0 -45
- package/android/src/newarch/TimezoneModule.java +0 -9
- package/android/src/oldarch/TimezoneModule.java +0 -39
- package/lib/commonjs/index.d.js +0 -6
- package/lib/commonjs/index.d.js.map +0 -1
- package/lib/module/index.d.js +0 -2
- package/lib/module/index.d.js.map +0 -1
- package/lib/typescript/src/NativeTimezone.d.ts +0 -9
- package/lib/typescript/src/NativeTimezone.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts +0 -8
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/src/index.d.ts +0 -8
package/package.json
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-timezone",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "A Simple react native module to get Timezone and Region of the Android/iOS devices.",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"example": "pnpm --filter react-native-timezone-example",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"typecheck": "tsc",
|
|
12
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
13
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
14
|
+
"prepare": "bob build",
|
|
15
|
+
"release": "release-it"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": {
|
|
20
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
21
|
+
"default": "./lib/module/index.js"
|
|
22
|
+
},
|
|
23
|
+
"require": {
|
|
24
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
25
|
+
"default": "./lib/commonjs/index.js"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
10
29
|
"files": [
|
|
11
30
|
"src",
|
|
12
31
|
"lib",
|
|
13
32
|
"android",
|
|
14
33
|
"ios",
|
|
15
|
-
"cpp",
|
|
16
34
|
"*.podspec",
|
|
35
|
+
"react-native.config.js",
|
|
17
36
|
"!ios/build",
|
|
18
37
|
"!android/build",
|
|
19
38
|
"!android/gradle",
|
|
@@ -25,20 +44,6 @@
|
|
|
25
44
|
"!**/__mocks__",
|
|
26
45
|
"!**/.*"
|
|
27
46
|
],
|
|
28
|
-
"scripts": {
|
|
29
|
-
"example": "yarn workspace react-native-timezone-example",
|
|
30
|
-
"test": "jest",
|
|
31
|
-
"typecheck": "tsc --noEmit",
|
|
32
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
34
|
-
"prepare": "bob build",
|
|
35
|
-
"release": "release-it"
|
|
36
|
-
},
|
|
37
|
-
"keywords": [
|
|
38
|
-
"react-native",
|
|
39
|
-
"ios",
|
|
40
|
-
"android"
|
|
41
|
-
],
|
|
42
47
|
"repository": {
|
|
43
48
|
"type": "git",
|
|
44
49
|
"url": "git+https://github.com/samitha9125/react-native-timezone.git"
|
|
@@ -55,109 +60,55 @@
|
|
|
55
60
|
"devDependencies": {
|
|
56
61
|
"@commitlint/config-conventional": "^17.0.2",
|
|
57
62
|
"@evilmartians/lefthook": "^1.5.0",
|
|
58
|
-
"@react-native/
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@types/
|
|
62
|
-
"@types/react
|
|
63
|
+
"@react-native-community/cli": "15.0.1",
|
|
64
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
65
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
66
|
+
"@types/jest": "^29.5.5",
|
|
67
|
+
"@types/react": "^18.2.44",
|
|
63
68
|
"commitlint": "^17.0.2",
|
|
64
|
-
"del-cli": "^5.
|
|
65
|
-
"eslint": "^8.
|
|
66
|
-
"eslint-config-prettier": "^
|
|
67
|
-
"eslint-plugin-prettier": "^
|
|
68
|
-
"jest": "^
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"react": "
|
|
72
|
-
"react-native": "0.
|
|
73
|
-
"
|
|
74
|
-
"release-it": "^15.0.0",
|
|
69
|
+
"del-cli": "^5.1.0",
|
|
70
|
+
"eslint": "^8.51.0",
|
|
71
|
+
"eslint-config-prettier": "^9.0.0",
|
|
72
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
73
|
+
"jest": "^29.7.0",
|
|
74
|
+
"prettier": "^3.0.3",
|
|
75
|
+
"react": "18.3.1",
|
|
76
|
+
"react-native": "0.76.5",
|
|
77
|
+
"react-native-builder-bob": "^0.35.2",
|
|
78
|
+
"release-it": "^17.10.0",
|
|
75
79
|
"turbo": "^1.10.7",
|
|
76
|
-
"typescript": "^5.
|
|
80
|
+
"typescript": "^5.2.2"
|
|
77
81
|
},
|
|
78
82
|
"resolutions": {
|
|
79
|
-
"@types/react": "
|
|
83
|
+
"@types/react": "^18.2.44"
|
|
80
84
|
},
|
|
81
85
|
"peerDependencies": {
|
|
82
|
-
"react": "
|
|
83
|
-
"react-native": "
|
|
84
|
-
},
|
|
85
|
-
"workspaces": [
|
|
86
|
-
"example"
|
|
87
|
-
],
|
|
88
|
-
"packageManager": "yarn@3.6.1",
|
|
89
|
-
"engines": {
|
|
90
|
-
"node": ">= 18.0.0"
|
|
91
|
-
},
|
|
92
|
-
"jest": {
|
|
93
|
-
"preset": "react-native",
|
|
94
|
-
"modulePathIgnorePatterns": [
|
|
95
|
-
"<rootDir>/example/node_modules",
|
|
96
|
-
"<rootDir>/lib/"
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
"commitlint": {
|
|
100
|
-
"extends": [
|
|
101
|
-
"@commitlint/config-conventional"
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
"release-it": {
|
|
105
|
-
"git": {
|
|
106
|
-
"commitMessage": "chore: release ${version}",
|
|
107
|
-
"tagName": "v${version}"
|
|
108
|
-
},
|
|
109
|
-
"npm": {
|
|
110
|
-
"publish": true
|
|
111
|
-
},
|
|
112
|
-
"github": {
|
|
113
|
-
"release": true
|
|
114
|
-
},
|
|
115
|
-
"plugins": {
|
|
116
|
-
"@release-it/conventional-changelog": {
|
|
117
|
-
"preset": "angular"
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
"eslintConfig": {
|
|
122
|
-
"root": true,
|
|
123
|
-
"extends": [
|
|
124
|
-
"@react-native",
|
|
125
|
-
"prettier"
|
|
126
|
-
],
|
|
127
|
-
"rules": {
|
|
128
|
-
"prettier/prettier": [
|
|
129
|
-
"error",
|
|
130
|
-
{
|
|
131
|
-
"quoteProps": "consistent",
|
|
132
|
-
"singleQuote": true,
|
|
133
|
-
"tabWidth": 2,
|
|
134
|
-
"trailingComma": "es5",
|
|
135
|
-
"useTabs": false
|
|
136
|
-
}
|
|
137
|
-
]
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
"eslintIgnore": [
|
|
141
|
-
"node_modules/",
|
|
142
|
-
"lib/"
|
|
143
|
-
],
|
|
144
|
-
"prettier": {
|
|
145
|
-
"quoteProps": "consistent",
|
|
146
|
-
"singleQuote": true,
|
|
147
|
-
"tabWidth": 2,
|
|
148
|
-
"trailingComma": "es5",
|
|
149
|
-
"useTabs": false
|
|
86
|
+
"react": ">=18.0.0",
|
|
87
|
+
"react-native": ">=0.71.0"
|
|
150
88
|
},
|
|
89
|
+
"packageManager": "pnpm@9.15.4",
|
|
151
90
|
"react-native-builder-bob": {
|
|
152
91
|
"source": "src",
|
|
153
92
|
"output": "lib",
|
|
154
93
|
"targets": [
|
|
155
|
-
"
|
|
156
|
-
|
|
94
|
+
"codegen",
|
|
95
|
+
[
|
|
96
|
+
"commonjs",
|
|
97
|
+
{
|
|
98
|
+
"esm": true
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"module",
|
|
103
|
+
{
|
|
104
|
+
"esm": true
|
|
105
|
+
}
|
|
106
|
+
],
|
|
157
107
|
[
|
|
158
108
|
"typescript",
|
|
159
109
|
{
|
|
160
|
-
"project": "tsconfig.build.json"
|
|
110
|
+
"project": "tsconfig.build.json",
|
|
111
|
+
"esm": true
|
|
161
112
|
}
|
|
162
113
|
]
|
|
163
114
|
]
|
|
@@ -165,6 +116,19 @@
|
|
|
165
116
|
"codegenConfig": {
|
|
166
117
|
"name": "RNTimezoneSpec",
|
|
167
118
|
"type": "modules",
|
|
168
|
-
"jsSrcsDir": "src"
|
|
119
|
+
"jsSrcsDir": "src",
|
|
120
|
+
"outputDir": {
|
|
121
|
+
"ios": "ios/generated",
|
|
122
|
+
"android": "android/generated"
|
|
123
|
+
},
|
|
124
|
+
"android": {
|
|
125
|
+
"javaPackageName": "com.samitha.timezone"
|
|
126
|
+
},
|
|
127
|
+
"includesGeneratedCode": true
|
|
128
|
+
},
|
|
129
|
+
"create-react-native-library": {
|
|
130
|
+
"type": "turbo-module",
|
|
131
|
+
"languages": "kotlin-objc",
|
|
132
|
+
"version": "0.45.5"
|
|
169
133
|
}
|
|
170
134
|
}
|
|
@@ -11,34 +11,32 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.license = package["license"]
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios =>
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
15
|
s.source = { :git => "https://github.com/samitha9125/react-native-timezone.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
s.frameworks
|
|
19
|
-
|
|
20
|
-
s.source_files = "ios/**/*.{h,m,mm}"
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
18
|
+
s.ios.frameworks = ['CoreTelephony']
|
|
21
19
|
|
|
22
20
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
23
21
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
24
22
|
if respond_to?(:install_modules_dependencies, true)
|
|
25
23
|
install_modules_dependencies(s)
|
|
26
24
|
else
|
|
27
|
-
|
|
25
|
+
s.dependency "React-Core"
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
end
|
|
27
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
29
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
30
|
+
s.pod_target_xcconfig = {
|
|
31
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
32
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
33
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
34
|
+
}
|
|
35
|
+
s.dependency "React-Codegen"
|
|
36
|
+
s.dependency "RCT-Folly"
|
|
37
|
+
s.dependency "RCTRequired"
|
|
38
|
+
s.dependency "RCTTypeSafety"
|
|
39
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
44
42
|
end
|
package/src/NativeTimezone.ts
CHANGED
|
@@ -2,9 +2,10 @@ import type { TurboModule } from 'react-native';
|
|
|
2
2
|
import { TurboModuleRegistry } from 'react-native';
|
|
3
3
|
|
|
4
4
|
export interface Spec extends TurboModule {
|
|
5
|
-
getTimeZone(): string;
|
|
6
|
-
getRegionByLocale(): string;
|
|
7
|
-
getRegionByTelephony(): string;
|
|
5
|
+
getTimeZone(): string | null;
|
|
6
|
+
getRegionByLocale(): string | null;
|
|
7
|
+
getRegionByTelephony(): string | null;
|
|
8
|
+
isAutoTimeZoneEnabled(): boolean | null;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export default TurboModuleRegistry.getEnforcing<Spec>('Timezone');
|
package/src/index.tsx
CHANGED
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`The package 'react-native-timezone' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
-
'- You rebuilt the app after installing the package\n' +
|
|
7
|
-
'- You are not using Expo Go\n';
|
|
8
|
-
|
|
9
|
-
// @ts-expect-error
|
|
10
|
-
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
11
|
-
const TimezoneModule = isTurboModuleEnabled
|
|
12
|
-
? require('./NativeTimezone').default
|
|
13
|
-
: NativeModules.Timezone;
|
|
14
|
-
|
|
15
|
-
const Timezone = TimezoneModule
|
|
16
|
-
? TimezoneModule
|
|
17
|
-
: new Proxy(
|
|
18
|
-
{},
|
|
19
|
-
{
|
|
20
|
-
get() {
|
|
21
|
-
throw new Error(LINKING_ERROR);
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
);
|
|
3
|
+
import Timezone from './NativeTimezone';
|
|
25
4
|
|
|
26
5
|
export default {
|
|
27
6
|
getTimeZone: () => Timezone.getTimeZone(),
|
|
28
7
|
getRegionByLocale: () => Timezone.getRegionByLocale(),
|
|
29
|
-
getRegionByTelephony: () => Timezone.getRegionByTelephony()
|
|
8
|
+
getRegionByTelephony: () => Timezone.getRegionByTelephony(),
|
|
30
9
|
isAutoTimeZoneEnabled: () => {
|
|
31
10
|
if (Platform.OS === 'android') {
|
|
32
11
|
return Timezone.isAutoTimeZoneEnabled();
|
|
33
12
|
}
|
|
34
|
-
return
|
|
13
|
+
return null;
|
|
35
14
|
},
|
|
36
15
|
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
package com.samitha.rn.timezone;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
import android.os.Build;
|
|
5
|
-
|
|
6
|
-
import com.facebook.react.bridge.Promise;
|
|
7
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
9
|
-
|
|
10
|
-
import java.util.TimeZone;
|
|
11
|
-
import java.util.Calendar;
|
|
12
|
-
import android.telephony.TelephonyManager;
|
|
13
|
-
|
|
14
|
-
import android.provider.Settings;
|
|
15
|
-
import android.content.ContentResolver;
|
|
16
|
-
import android.util.Log;
|
|
17
|
-
|
|
18
|
-
public class TimezoneModuleImpl {
|
|
19
|
-
public static final String NAME = "Timezone";
|
|
20
|
-
|
|
21
|
-
// Whether the device is set to automatically detect the time zone.
|
|
22
|
-
@ReactMethod
|
|
23
|
-
public static boolean isAutoTimeZoneEnabled(ReactApplicationContext reactContext) {
|
|
24
|
-
ContentResolver resolver = reactContext.getContentResolver();
|
|
25
|
-
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
|
|
26
|
-
? Settings.Global.getInt(resolver, Settings.Global.AUTO_TIME_ZONE, 0)
|
|
27
|
-
: Settings.System.getInt(resolver, Settings.System.AUTO_TIME_ZONE, 0)) != 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@ReactMethod
|
|
31
|
-
public static String getTimeZone() {
|
|
32
|
-
try {
|
|
33
|
-
Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
|
|
34
|
-
TimeZone zone = calendar.getTimeZone();
|
|
35
|
-
return zone.getID();
|
|
36
|
-
}catch (Exception e){
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@ReactMethod
|
|
42
|
-
public static String getRegionByTelephony(ReactApplicationContext reactContext) {
|
|
43
|
-
try {
|
|
44
|
-
TelephonyManager tm = (TelephonyManager)reactContext.getSystemService(reactContext.TELEPHONY_SERVICE);
|
|
45
|
-
return tm.getNetworkCountryIso();
|
|
46
|
-
}catch (Exception e){
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@ReactMethod
|
|
53
|
-
public static String getRegionByLocale(ReactApplicationContext reactContext) {
|
|
54
|
-
try {
|
|
55
|
-
return reactContext.getResources().getConfiguration().locale.getCountry();
|
|
56
|
-
}catch (Exception e){
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
package com.samitha.rn.timezone;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.Nullable;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.NativeModule;
|
|
6
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.react.module.model.ReactModuleInfo;
|
|
8
|
-
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
9
|
-
import com.facebook.react.TurboReactPackage;
|
|
10
|
-
|
|
11
|
-
import java.util.HashMap;
|
|
12
|
-
import java.util.Map;
|
|
13
|
-
|
|
14
|
-
public class TimezonePackage extends TurboReactPackage {
|
|
15
|
-
|
|
16
|
-
@Nullable
|
|
17
|
-
@Override
|
|
18
|
-
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
19
|
-
if (name.equals(TimezoneModule.NAME)) {
|
|
20
|
-
return new TimezoneModule(reactContext);
|
|
21
|
-
} else {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Override
|
|
27
|
-
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
28
|
-
return () -> {
|
|
29
|
-
final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
|
|
30
|
-
boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
31
|
-
moduleInfos.put(
|
|
32
|
-
TimezoneModule.NAME,
|
|
33
|
-
new ReactModuleInfo(
|
|
34
|
-
TimezoneModule.NAME,
|
|
35
|
-
TimezoneModule.NAME,
|
|
36
|
-
false, // canOverrideExistingModule
|
|
37
|
-
false, // needsEagerInit
|
|
38
|
-
true, // hasConstants
|
|
39
|
-
false, // isCxxModule
|
|
40
|
-
isTurboModule // isTurboModule
|
|
41
|
-
));
|
|
42
|
-
return moduleInfos;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
package com.samitha.rn.timezone;
|
|
2
|
-
|
|
3
|
-
import androidx.annotation.NonNull;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
7
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
8
|
-
import com.facebook.react.module.annotations.ReactModule;
|
|
9
|
-
|
|
10
|
-
public class TimezoneModule extends ReactContextBaseJavaModule {
|
|
11
|
-
public static final String NAME = TimezoneModuleImpl.NAME;
|
|
12
|
-
|
|
13
|
-
TimezoneModule(ReactApplicationContext context) {
|
|
14
|
-
super(context);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@Override
|
|
18
|
-
@NonNull
|
|
19
|
-
public String getName() {
|
|
20
|
-
return TimezoneModuleImpl.NAME;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
24
|
-
public boolean isAutoTimeZoneEnabled() {
|
|
25
|
-
return TimezoneModuleImpl.isAutoTimeZoneEnabled(getReactApplicationContext());
|
|
26
|
-
}
|
|
27
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
28
|
-
public String getTimeZone() {
|
|
29
|
-
return TimezoneModuleImpl.getTimeZone();
|
|
30
|
-
}
|
|
31
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
32
|
-
public String getRegionByTelephony() {
|
|
33
|
-
return TimezoneModuleImpl.getRegionByTelephony(getReactApplicationContext());
|
|
34
|
-
}
|
|
35
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
36
|
-
public String getRegionByLocale() {
|
|
37
|
-
return TimezoneModuleImpl.getRegionByLocale(getReactApplicationContext());
|
|
38
|
-
}
|
|
39
|
-
}
|
package/lib/commonjs/index.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.d.ts"],"mappings":""}
|
package/lib/module/index.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.d.ts"],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native';
|
|
2
|
-
export interface Spec extends TurboModule {
|
|
3
|
-
getTimeZone(): string;
|
|
4
|
-
getRegionByLocale(): string;
|
|
5
|
-
getRegionByTelephony(): string;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: Spec;
|
|
8
|
-
export default _default;
|
|
9
|
-
//# sourceMappingURL=NativeTimezone.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTimezone.d.ts","sourceRoot":"","sources":["../../../src/NativeTimezone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,WAAW,IAAI,MAAM,CAAC;IACtB,iBAAiB,IAAI,MAAM,CAAC;IAC5B,oBAAoB,IAAI,MAAM,CAAC;CAChC;;AAED,wBAAkE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":";;;;;;AAyBA,wBAUE"}
|