ant-design / ant-design-mobile-rn

Ant Design for React Native
https://rn.mobile.ant.design/
MIT License
3k stars 610 forks source link

Using a deprecated package (@react-native-community/cameraroll), causing Android build errors #1261

Closed SamMakesThings closed 1 year ago

SamMakesThings commented 1 year ago

Reproduction link

https://en.wikipedia.org/wiki/N/A

Steps to reproduce

Look at the package.json, see that it's deprecated

What is expected?

That @ant-design/react-native uses the non-deprecated version of the package (@react-native-camera-roll/camera-roll) instead of the deprecated version (@react-native-community/camera-roll)

What is actually happening?

Other packages require the non-deprecated version, @react-native-camera-roll/camera-roll. However, ant-design errors without the deprecated version (@react-native-community/cameraroll). If I try to use both, the build script fails, saying "BuildConfig is defined multiple times". Please update to the non-deprecated package.

Environment Info
antd 5.0.1
React 0.65.2
System Android & iOS, any version
Browser N/A
RayanAbid commented 1 year ago

Hi @SamMakesThings did you try replacing the package in the node_modules folder?

I tried replacing it and it seems to have started working.

SamMakesThings commented 1 year ago

Honestly I just created a patch that removed it from package.json and removed the file that used it. It's frustrating that was necessary.

RayanAbid commented 1 year ago

Glad to hear it was fixed I did the same.

aidan-doherty commented 1 year ago

@RayanAbid I dont think it will be possible to replace it as the package appears to have moved, You can see the warning on npm site. https://www.npmjs.com/package/@react-native-community/cameraroll

Package has been moved to @react-native-camera-roll/camera-roll starting with version 5.0

RayanAbid commented 1 year ago

@aidan2129 I've got it to work by just replacing it with the @react-native-camera-roll/camera-roll in the node_modules/@ant-design I opened it up separately searched for the @react-native-camera-roll/camera-roll in the whole project and replaced it with @react-native-community/cameraroll and it's working fine now. Let me know if you need some more clarification.

aidan-doherty commented 1 year ago

Yup I fixed it locally by removing the ImagePicker and saving the change with patch-package as I dont use it. But I do not believe that is the ideal step you want everyone to have to go through each time they install this module. I'm can maybe try and get a pull request submitted later to replace the old versions across the app.

RayanAbid commented 1 year ago

That is one downside of using open-source packages, but that would be great if you can do that do let me know if you need any help we can figure it out together. @aidan2129

MitarSpasicc commented 1 year ago

Hello, I have the similar problem with @react-native-community/cameraroll. I'm using React "18.1.0" and expo "~47.0.8" Is there any working solution ?

I've managed to make it work with --legacy-peer-deps, but then the eas build crashed with the same error.

Thanks in advance.

ERROR: Could not resolve dependency: npm ERR! peer react@"16 || 17" from @react-native-community/cameraroll@4.1.2 npm ERR! node_modules/@react-native-community/cameraroll npm ERR! peer @react-native-community/cameraroll@">= 1.5.2" from @ant-design/react-native@5.0.2 npm ERR! node_modules/@ant-design/react-native npm ERR! @ant-design/react-native@"*" from the root project

RayanAbid commented 1 year ago

you will have to patch the node_module if you want @MitarSpasicc I can share my npm patch package diff file so that you can just add that in your patches folder and hopefully it'll work for you as well.

MitarSpasicc commented 1 year ago

@RayanAbid Thank you for the quick reply. Honestly, I will re-think of using this library. Patch is a temporary solution. Don't want to have similar problem in the future :). Best regards!

MitarSpasicc commented 1 year ago

Hi @RayanAbid . You’ve mentioned that you have patch for new release, so i wanted to ask you if there are chances to share it here. I’ve tried it on my own but I didn’t manage it to work. My company wants to use antd at any costs :) Thank you in advance

aoarashi1988 commented 1 year ago

@MitarSpasicc a PR about this issue has already been accepted , maybe you could wait a few days for the next release .

RayanAbid commented 1 year ago

@MitarSpasicc Sorry for the late reply. Do you still want it? I'll share the files here you can add it in a folder call it patches.

then all you have to do is install this package and run the command and it should start working.

@ant-design+react-native+5.0.2.patch

if you have any further questions and I'm not able to reply. You can dm on twitter

Once again sorry for the late reply.