samitha9125 / react-native-timezone Goto Github PK
View Code? Open in Web Editor NEWA Simple react native module to get Timezone of the mobile
License: MIT License
A Simple react native module to get Timezone of the mobile
License: MIT License
Hi! ๐
Firstly, thanks for your work on this project! ๐
I have created a patch to fix this compilation issue using patch-package to patch [email protected]
.
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-timezone/android/build.gradle b/node_modules/react-native-timezone/android/build.gradle
index a28f0dd..59d8ab5 100644
--- a/node_modules/react-native-timezone/android/build.gradle
+++ b/node_modules/react-native-timezone/android/build.gradle
@@ -31,6 +31,6 @@ repositories {
}
dependencies {
- compile 'com.facebook.react:react-native:+'
+ implementation 'com.facebook.react:react-native:+'
}
\ No newline at end of file
To use above patch, create a file under the file path patches/react-native-timezone+2.0.0.patch
(create a patch folder at root level if you do not have it already) and paste the above code block inside it. Then run npx patch-package
. It will apply the above patch. The build should run successfully now.
Getting this error when using in Android...
TypeError: null is not an object (evaluating '_reactNativeTimezone.default.getTimeZone')
Just to let you know I had to use --force to install this
Error log:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react-native
npm ERR! react-native@"0.64.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.41.2" from [email protected]
npm ERR! node_modules/react-native-timezone
npm ERR! react-native-timezone@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/XXXXX/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/XXXX/.npm/_logs/2021-06-14T15_42_38_227Z-debug.log
It seems like typescript won't detect this lib's types.
Would be great if this module could support node 14+. package.json currently requires >= 16.
"engines": {
"node": ">= 16.0.0"
}
undefined is not an object (evaluating '_reactNativeTimezone.default.getTimeZone')
const timeZone = await TimeZone.getTimeZone().then(zone => zone);
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch [email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-timezone/react-native-timezone.podspec b/node_modules/react-native-timezone/react-native-timezone.podspec
index e19d339..813f843 100644
--- a/node_modules/react-native-timezone/react-native-timezone.podspec
+++ b/node_modules/react-native-timezone/react-native-timezone.podspec
@@ -16,20 +16,25 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm}"
- s.dependency "React-Core"
- # Don't install the dependencies when we run `pod install` in the old architecture.
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
- s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
- s.pod_target_xcconfig = {
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
- "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
- }
- s.dependency "React-Codegen"
- s.dependency "RCT-Folly"
- s.dependency "RCTRequired"
- s.dependency "RCTTypeSafety"
- s.dependency "ReactCommon/turbomodule/core"
+ if respond_to?(:install_modules_dependencies, true)
+ install_modules_dependencies(s)
+ else
+ s.dependency "React-Core"
+
+ # Don't install the dependencies when we run `pod install` in the old architecture.
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
+ s.pod_target_xcconfig = {
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
+ }
+ s.dependency "React-Codegen"
+ s.dependency "RCT-Folly"
+ s.dependency "RCTRequired"
+ s.dependency "RCTTypeSafety"
+ s.dependency "ReactCommon/turbomodule/core"
+ end
end
end
This issue body was partially generated by patch-package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.