zoontek / react-native-localize

🌍 A toolbox for your React Native app localization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NEW_ARCH + Fabric Collision (Redefinition of RNLocalize)

timothyerwin opened this issue · comments

Bug summary

For some reason this library is failing when NEW ARCH and Fabric are enabled:

/**
 * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
 *
 * Do not edit this file as changes may cause incorrect behavior and will be lost
 * once the code is regenerated.
 *
 * @generated by codegen project: GenerateModuleObjCpp
 *
 * We create an umbrella header (and corresponding implementation) here since
 * Cxx compilation in BUCK has a limitation: source-code producing genrule()s
 * must have a single output. More files => more genrule()s => slower builds.
 */

#ifndef __cplusplus
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
#endif
#import <Foundation/Foundation.h>
#import <RCTRequired/RCTRequired.h>
#import <RCTTypeSafety/RCTConvertHelpers.h>
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTCxxConvert.h>
#import <React/RCTManagedPointer.h>
#import <ReactCommon/RCTTurboModule.h>
#import <optional>
#import <vector>


@protocol NativeRNLocalizeSpec <RCTBridgeModule, RCTTurboModule>

- (NSString *)getCalendar;
- (NSString *)getCountry;
- (NSArray<NSString *> *)getCurrencies;
- (NSArray<NSDictionary *> *)getLocales;
- (NSDictionary *)getNumberFormatSettings;
- (NSString *)getTemperatureUnit;
- (NSString *)getTimeZone;
- (NSNumber *)uses24HourClock;
- (NSNumber *)usesMetricSystem;
- (NSNumber * _Nullable)usesAutoDateAndTime;
- (NSNumber * _Nullable)usesAutoTimeZone;

@end
namespace facebook {
  namespace react {
    /**
     * ObjC++ class for module 'NativeRNLocalize'
     */
    class JSI_EXPORT NativeRNLocalizeSpecJSI : public ObjCTurboModule {
    public:
      NativeRNLocalizeSpecJSI(const ObjCTurboModule::InitParams &params);
    };
  } // namespace react
} // namespace facebook

Library version

3.0.2

Environment info

•1% ➜ npx react-native info
warn Package react-native-sqlite-storage contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info Fetching system and libraries information...
System:
  OS: macOS 13.1
  CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Memory: 29.43 MB / 16.00 GB
  Shell:
    version: 5.8.1
    path: /bin/zsh
Binaries:
  Node:
    version: 18.15.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.10
    path: /usr/local/bin/yarn
  npm:
    version: 9.6.4
    path: /usr/local/bin/npm
  Watchman:
    version: 2023.07.24.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/gold/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK:
    API Levels:
      - "28"
      - "31"
      - "32"
      - "33"
    Build Tools:
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-33 | Google APIs Intel x86_64 Atom
      - android-33 | Google Play Intel x86 Atom_64
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10406996
  Xcode:
    version: 14.3/14E222b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.18
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/gold/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.3
    wanted: 0.72.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Steps to reproduce

  1. … install this library
  2. …enable new arch + fabric
  3. build

Reproducible sample code

N/A

I am just using the library per normal. it works fine before I enabled the new arch and fabric.

What is "failing"? More infos please! One word is not a valid issue description 😞

😂 well...actually it's in the title. xcode fails with "Redefinition of RNLocalize" and the code snippet I provided is where xcode says the duplications are occuring.

I stopped using the new arch and fabric because so many component are broken...it's not ready for prime time.

I don't mean to suggest this component is broken -- just when I finally got it launched all kinds of components failed with some unimplemented paintjob from react.

@timothyerwin The title give very limited infos too (no context on where / when it occurs).

"Bug summary", "Steps to reproduce", "Reproducible sample code" are here for something.

I think there's something broken in your install (probably what cause your other issues too)

Try a big clean with https://www.npmjs.com/package/react-native-clean-project, build again with new arch enabled.

well, I gave you all the information that xcode gave me during the build. it's not really more complicated than that. everything xcode gave, I forwarded here.

but, as I mentioned, I'm not using the new arch or fabric anymore so it's not an issue for me now but I'll close and leave it up in case others want to mention similar issue.

The same problem.

adding pods manually solved the problem

  target 'YourAwesomeProject' do
    #
    pod 'RNLocalize', :path => '../node_modules/react-native-localize'
  end