React-native-i18n: React as a dependency in podspec

Created on 14 Feb 2018  路  7Comments  路  Source: AlexanderZaytsev/react-native-i18n

Hello,

Could you please explain the reason of having React as a dependency in your podspec file? First of all, it's installing the old version of react and gives a warning that React v11 is deprecated and also for me it breaks the build somehow (it breaks an integration of app-center library actually), but anyway, can't get a reason of having React as a dependency here.

Most helpful comment

add dependencies to your Podfile :
pod 'React', :path => '../node_modules/react-native'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'RNI18n', :path => '../node_modules/react-native-i18n
run pod install

All 7 comments

I've tried this way and had a problem when a deprecated react version was installed.
I'm trying the manual installation.

Hello,

I installed react-native-i18n today and having the same problem. What is the solution? Here is the error message after 'react-native run-ios' command.

error: bundling failed: ambiguous resolution: module ....../src/app.js tries to require react-native, but there are several files providing this module. You can delete or fix them:

  • ....../ios/Pods/React/package.json
  • ....../node_modules/react-native/package.json

    BUNDLE [ios, dev] ./index.js 鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 1.9% (32/234), failed.

    Also, there a bunch of warnings. Here is one of them.

This warning is caused by a @providesModule declaration with the same name across two different files.
jest-haste-map: @providesModule naming collision:
Duplicate module name: NativeMethodsMixin

BTW, there is no problem with Android.

You need to use the local version of React as pod dep, as explained in the doc: http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies

@zoontek thank you for the answer!

Why do we need to use it? The point of the issue is that when you install react-native-i18n it breaks a build by adding React as a dependency. And as I see it's not necessary here (please correct me if I'm wrong).

Yes, it's not necessary for this lib I think, but it might be necessary if you manage your others deps with Cocoapods :)

I could remove it, but I need a proper and clear explanation in the README.

@zoontek tried that but still have the same problem, duplicated React in my project and the package can't make the bundle

add dependencies to your Podfile :
pod 'React', :path => '../node_modules/react-native'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'RNI18n', :path => '../node_modules/react-native-i18n
run pod install

Was this page helpful?
0 / 5 - 0 ratings