teslamotors / react-native-camera-kit

A high performance, easy to use, rock solid camera library for React Native apps.
MIT License
2.49k stars 590 forks source link

Feature Request: New Architecture Support #537

Open perqa opened 1 year ago

perqa commented 1 year ago

Feature Request: New Architecture Support

Hello, I'm wondering if someone is looking into migrating React Native Camera Kit to use Fabric (i.e. the React Native New Architecture). I'm opening this issue to understand what's the current status of this. I saw that someone opened a ticket on a specific module here , but I'm after a more general reply.

Why it is needed Originally requested here

Code sample Not a real code sample, but contains a sample of a library that is backward compatible with both the old and the new arch of React Native.

scarlac commented 1 year ago

No immediate plans to support the new Architecture. We welcome any PRs that might add support for it though.

parz1 commented 1 year ago

maybe you can adapt this module through this @perqa https://github.com/reactwg/react-native-new-architecture/discussions/135

deepesh-bex commented 1 year ago

@parz1 I tried doing that but the screen just becomes black. No crash but no success either.

module.exports = {
  dependencies: {
    ...
  },
  project: {
    ios: {
      sourceDir: "./ios",
      unstable_reactLegacyComponentNames: ["CKCamera"],
    },
    android: {
      unstable_reactLegacyComponentNames: ["CKCameraManager"],
    },
  },
  assets: ["./assets/fonts/"],
};

Maybe I'm doing something wrong in here?

scarlac commented 1 year ago

Make sure you prompt for permissions. Otherwise screen shows as black. We recommend react-native-permissions. It's a good library that stays up to date with permissions on both platforms (permissions change frequently on both platforms)

deepesh-bex commented 1 year ago

I implemented the library, but still got a black screen. What other reasons can be there for a black screen?

This black screen issue is particularly in iOS (android works fine with new arch)

scarlac commented 1 year ago

Check the native logs to see what the issue is. With Xcode compilation you can see it in the console. There should be some sort of log statement.

deepesh-bex commented 1 year ago

If I do bundle exec RCT_NEW_ARCH_ENABLED=1 && pod install It works but if I do

bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install It doesn't

The Xcode logs have {fabric: true} flag when running the second one. Should I make changes to the

unstable_reactLegacyComponentNames: ["CKCamera"],

and include more components which we have in iOS?

ThienMD commented 12 months ago

The same issue for me when I tried: unstable_reactLegacyComponentNames: ["CKCamera"],

VitorHRD commented 10 months ago

The same issue for me:

module.exports = {
  project: {
    ios: {},
    android: {
      unstable_reactLegacyComponentNames: ['CKCameraManager' ,'CKCamera'],
    },
  },
  assets: ['./src/assets/fonts/'],
};

For me the bug doesn't happen on iOS, but on Android it shows that the component is not supported in fabric mode, my app has all the libraries configured for fabric mode, going back is impossible for me

WoLewicki commented 4 months ago

Hey, we at Software Mansion have been working on improving support for the new architecture for quite a while and we would like to help with migrating this library. Are you open to PRs?

scarlac commented 4 months ago

Hey, we at Software Mansion have been working on improving support for the new architecture for quite a while and we would like to help with migrating this library. Are you open to PRs?

Yes

WoLewicki commented 3 months ago

Hey! I submitted the PR with New Architecture here: https://github.com/teslamotors/react-native-camera-kit/pull/672 :tada: