Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: new arch: serveral zoom depending bugs #691

Open
cixio opened this issue Jan 7, 2025 · 3 comments
Open

iOS: new arch: serveral zoom depending bugs #691

cixio opened this issue Jan 7, 2025 · 3 comments

Comments

@cixio
Copy link

cixio commented Jan 7, 2025

Describe the bug

  • pinch to zoom does not work (zoomMode)
  • set a zoom value does not work (zoom)
  • when using new arch the module uses the wide-angle-camera (0,5x zoom in camera app) at first, in old arch the normal-view-camera (1x zoom in camera app)

To Reproduce
Create App with new arch. To force use of old arch (to see differnces) add ENV['RCT_NEW_ARCH_ENABLED'] = "0" to the first line of Podfile, pod install and run app

Expected behavior
zoomMode + zoom should work, view should be the same on startup

Screenshots
Ohne Titel

Smartphone (please complete the following information):

  • Device: iPhone 14 Pro
  • OS: iOS 18.1

react-native-camera-kit v14.1

@cixio cixio changed the title iOS: new arch / old arch: no the same standard zoom factor iOS: new arch / old arch: not the same standard zoom factor Jan 7, 2025
@cixio cixio changed the title iOS: new arch / old arch: not the same standard zoom factor iOS: new arch: serveral zoom depending bugs Jan 7, 2025
@cixio
Copy link
Author

cixio commented Jan 7, 2025

Updated first comment and title as zoom functions do not work at all in new arch.

@cixio
Copy link
Author

cixio commented Jan 8, 2025

Maybe this line is part of the problem

_view.zoomMode = [focusMode isEqualToString:@"on"] ? CKZoomModeOn : CKZoomModeOff;

_view.zoomMode = [focusMode isEqualToString:@"on"] ? CKZoomModeOn : CKZoomModeOff;

focusMode seems to be wrong in this line. But fixing this does not solve the problems - at least not the way I tried.

@DavidBertet
Copy link
Contributor

This is because when we set onZoom in the new CKCameraViewComponentView, we aren't adding it in the changedProps

[_view setOnZoom:^(NSDictionary* event) {
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
id zoom = [event valueForKey:@"zoom"] == nil ? 0 : [event valueForKey:@"zoom"];
std::dynamic_pointer_cast<const facebook::react::CKCameraEventEmitter>(strongSelf->_eventEmitter)->onZoom({.zoom = [zoom doubleValue]});
}
}];

So cameraView never forwards it to the actual camera implementation

if changedProps.contains("onZoom") {
camera.update(onZoom: onZoom)
}

Hence, when we call onZoom after a pinch, it is nil

self.onZoomCallback?(["zoom": desiredOrCameraZoom])

self.onZoom?(["zoom": zoomForDevice])

@WoLewicki, we might want to split cameraView prop management in 2 methods like the new CKCameraViewComponentView

  • One that manages callbacks props. These are set once at the init and can't be updated
  • One the manages variable props. These can be update during the life of the view

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants