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

fix: booleans on ios and missing prop #690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions android/src/main/java/com/rncamerakit/CKCameraManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,6 @@ class CKCameraManager : SimpleViewManager<CKCamera>(), CKCameraManagerInterface<
override fun setResizeMode(view: CKCamera?, value: String?) = Unit

override fun setScanThrottleDelay(view: CKCamera?, value: Int) = Unit

override fun setMaxPhotoQualityPrioritization(view: CKCamera?, value: String?) = Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public void setProperty(T view, String propName, @Nullable Object value) {
case "focusMode":
mViewManager.setFocusMode(view, value == null ? null : (String) value);
break;
case "maxPhotoQualityPrioritization":
mViewManager.setMaxPhotoQualityPrioritization(view, value == null ? null : (String) value);
break;
case "zoomMode":
mViewManager.setZoomMode(view, value == null ? null : (String) value);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
public interface CKCameraManagerInterface<T extends View> {
void setFlashMode(T view, @Nullable String value);
void setFocusMode(T view, @Nullable String value);
void setMaxPhotoQualityPrioritization(T view, @Nullable String value);
void setZoomMode(T view, @Nullable String value);
void setZoom(T view, double value);
void setMaxZoom(T view, double value);
Expand Down
20 changes: 11 additions & 9 deletions ios/ReactNativeCameraKit/CKCameraViewComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
_view.flashMode = [flashMode isEqualToString:@"auto"] ? CKFlashModeAuto : [flashMode isEqualToString:@"on"] ? CKFlashModeOn : CKFlashModeOff;
[changedProps addObject:@"flashMode"];
}
id maxPhotoQualityPrioritization = CKConvertFollyDynamicToId(newProps.maxPhotoQualityPrioritization);
if (maxPhotoQualityPrioritization != nil && [maxPhotoQualityPrioritization isKindOfClass:NSString.class]) {
_view.maxPhotoQualityPrioritization = [flashMode isEqualToString:@"balanced"] ? CKMaxPhotoQualityPrioritizationBalanced : [flashMode isEqualToString:@"quality"] ? CKMaxPhotoQualityPrioritizationQuality : CKMaxPhotoQualityPrioritizationSpeed;
[changedProps addObject:@"flashMode"];
}
id torchMode = CKConvertFollyDynamicToId(newProps.torchMode);
if (torchMode != nil && [torchMode isKindOfClass:NSString.class]) {
_view.torchMode = [torchMode isEqualToString:@"on"] ? CKTorchModeOn : CKTorchModeOff;
Expand All @@ -180,14 +185,12 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
_view.ratioOverlayColor = ratioOverlayColor;
[changedProps addObject:@"ratioOverlayColor"];
}
id scanBarcode = CKConvertFollyDynamicToId(newProps.scanBarcode);
if (scanBarcode != nil) {
_view.scanBarcode = scanBarcode;
if (_view.scanBarcode != newProps.scanBarcode) {
_view.scanBarcode = newProps.scanBarcode;
[changedProps addObject:@"scanBarcode"];
}
id showFrame = CKConvertFollyDynamicToId(newProps.showFrame);
if (showFrame != nil) {
_view.showFrame = showFrame;
if (_view.showFrame != newProps.showFrame) {
_view.showFrame = newProps.showFrame;
[changedProps addObject:@"showFrame"];
}
id scanThrottleDelay = CKConvertFollyDynamicToId(newProps.scanThrottleDelay);
Expand All @@ -210,9 +213,8 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
_view.resetFocusTimeout = [resetFocusTimeout intValue];
[changedProps addObject:@"resetFocusTimeout"];
}
id resetFocusWhenMotionDetected = CKConvertFollyDynamicToId(newProps.resetFocusWhenMotionDetected);
if (resetFocusWhenMotionDetected != nil) {
_view.resetFocusWhenMotionDetected = resetFocusWhenMotionDetected;
if (_view.resetFocusWhenMotionDetected != newProps.resetFocusWhenMotionDetected) {
_view.resetFocusWhenMotionDetected = newProps.resetFocusWhenMotionDetected;
[changedProps addObject:@"resetFocusWhenMotionDetected"];
}
id focusMode = CKConvertFollyDynamicToId(newProps.focusMode);
Expand Down
1 change: 1 addition & 0 deletions src/specs/CameraNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type OnZoom = {
export interface NativeProps extends ViewProps {
flashMode?: string;
focusMode?: string;
maxPhotoQualityPrioritization?: string;
zoomMode?: string;
zoom?: Double;
maxZoom?: Double;
Expand Down
Loading