stefalda / ReactNativeLocalization

Class to localize the ReactNative interface
MIT License
899 stars 124 forks source link

Fails to build iOS app after adding the library #214

Closed bfmehdi closed 2 years ago

bfmehdi commented 2 years ago

I created a new react native project using Ignite and running it on M1 MacBook. I have Xcode 13.2.1 installed. This is the output of my react-native info

System:
    OS: macOS 12.2.1
    CPU: (8) arm64 Apple M1
    Memory: 84.48 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.2 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.2 - /usr/local/bin/npm
    Watchman: 2022.02.07.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK:
      API Levels: 28, 29, 30, 31, 32
      Build Tools: 28.0.3, 29.0.2, 30.0.0, 30.0.1, 30.0.2, 30.0.3, 32.0.0, 32.1.0, 33.0.0
      System Images: android-30 | Google APIs ARM 64 v8a, android-30 | Google Play ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8139111
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_321 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.67.2 => 0.67.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found 

After adding the library using yarn add react-native-localization and installing the pods, the project fails during the building on iOS.

I get this errors on Xcode

Screenshot 2022-02-22 at 16 21 02

By removing the library the app works again.

rusakovic commented 2 years ago

Confirm the issue. "expo": "^44.0.6", with expo unimodules "react-native": "^0.67.3", "react-native-localization": "^2.3.1", image

stefalda commented 2 years ago

Are you using Expo?

Have you checked this web page?

https://docs.expo.dev/workflow/using-libraries/

rusakovic commented 2 years ago

Are you using Expo?

Have you checked this web page?

https://docs.expo.dev/workflow/using-libraries/

I use ejected EXPO. Does it have an impact on this issue?

stefalda commented 2 years ago

I guess so... Have you tried to create an empty React Native project, add the library and compile?

Thanks

On Sun, Mar 13, 2022 at 2:53 PM Maxim Rusakovič @.***> wrote:

Are you using Expo?

Have you checked this web page?

https://docs.expo.dev/workflow/using-libraries/

I use ejected EXPO. Does it have an impact on this issue?

— Reply to this email directly, view it on GitHub https://github.com/stefalda/ReactNativeLocalization/issues/214#issuecomment-1066107154, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGA53WFF7CDNRXXMK7SHRLU7XXN3ANCNFSM5PBXSEUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

wafisher commented 2 years ago

Try this patch:

File: react-native-localization+2.3.1.patch when using patch-package

# https://github.com/expo/expo/issues/15622#issuecomment-997141629 type of change
diff --git a/node_modules/react-native-localization/ios/ReactLocalization.h b/node_modules/react-native-localization/ios/ReactLocalization.h
index 909f842..1f9302d 100644
--- a/node_modules/react-native-localization/ios/ReactLocalization.h
+++ b/node_modules/react-native-localization/ios/ReactLocalization.h
@@ -23,13 +23,8 @@

 #import <Foundation/Foundation.h>
 #import <UIKit/UIDevice.h>
-#if __has_include("RCTBridgeModule.h")
-#import "RCTBridgeModule.h"
-#import "RCTLog.h"
-#else
 #import <React/RCTBridgeModule.h>
 #import <React/RCTLog.h>
-#endif
 @interface ReactLocalization : NSObject<RCTBridgeModule>

 @end