Coder Social home page Coder Social logo

samitha9125 / react-native-timezone Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 5.0 2.84 MB

A Simple react native module to get Timezone of the mobile

License: MIT License

Java 22.57% JavaScript 10.16% Objective-C 12.04% Ruby 18.89% Swift 0.29% C 0.49% Objective-C++ 10.40% TypeScript 12.77% Kotlin 12.40%

react-native-timezone's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-native-timezone's Issues

Fixed: A problem occurred evaluating project ':react-native-timezone' with react-native v0.70.1

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.

Android not working

Getting this error when using in Android...

TypeError: null is not an object (evaluating '_reactNativeTimezone.default.getTimeZone')

Error installing

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

Support for Node 14

Would be great if this module could support node 14+. package.json currently requires >= 16.

  "engines": {
    "node": ">= 16.0.0"
  }

getTimeZone Warning in React Native 0.57

RN 0.57 Error

undefined is not an object (evaluating '_reactNativeTimezone.default.getTimeZone')

const timeZone = await TimeZone.getTimeZone().then(zone => zone);

Upgrade to RN 0.72+

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.