Search code examples
react-nativedependenciesconflictreact-native-image-crop-picker

Dependency Conflict with TOCropViewController in React Native Project


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


Solution

  • 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.