skip to Main Content

I’m currently facing a dependency conflict in my React Native project when trying to use both react-native-image-crop-picker and react-native-image-crop-tools. Each library depends on different versions of TOCropViewController, leading to a conflict that I’m unable to resolve.

Here’s the situation:

[!] CocoaPods could not find compatible versions for pod "TOCropViewController":
  In snapshot (Podfile.lock):
    TOCropViewController (= 2.6.1)

  In Podfile:
    RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`) was resolved to 0.40.3, which depends on
      TOCropViewController

    react-native-image-crop-tools (from `../node_modules/react-native-image-crop-tools`) was resolved to 1.6.4, which depends on
      TOCropViewController (= 2.5.3)

I understand this is a basic dependency conflict so i added pod ‘TOCropViewController’, ‘2.5.3’ in Podfile. But it is not still working.
How to solve this?
Any advice is welcome. Thank you

2

Answers


  1. Chosen as BEST ANSWER

    I noticed that the react-native-image-crop-picker utilizes version 2.6.1 of TOCropViewController, which introduces a property not present in version 2.5.3. Since react-native-image-crop-tools was using the latter version, this incompatibility prompted me to update the TOCropViewController version in the react-native-image-crop-tools.

    Specifically, I changed the dependency version in the podspec located at

    node_modules/react-native-image-crop-tools/react-native-image-crop-tools/podspec from:

    s.dependency 'TOCropViewController', '2.5.3' => s.dependency 'TOCropViewController', '2.6.1'


  2. If it is necessary to use those two packages, you can try manually to adjust the version TOCropViewController inside react-native-image-crop-picker, until it is working as expected or directly disable it, if it possible. Then using https://www.npmjs.com/package/patch-package you can apply your changes to the patch every time you install/update your node modules. Keep in mind this is a solution where the two packages are a must.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search