Added zoom control#559
Conversation
scarlac
commented
Jul 12, 2023
- Added zoom control
- Added max zoom control
- Added onZoom handler
|
@DavidBertet in case you're interested. |
Added max zoom control Added onZoom handler
Looking at it! |
(must explicitly be reset using zoom={0} if that is wanted)
Fixed non-unique queue name
| const onSwitchCameraPressed = () => { | ||
| const direction = cameraType === CameraType.Back ? CameraType.Front : CameraType.Back; | ||
| setCameraType(direction); | ||
| setZoom(0); // When changing camera type, reset to default zoom for that camera |
There was a problem hiding this comment.
Should that be done by the native side / Camera component? Sounds like the expected behavior as a user of the framework. RealCamera probably does it already in update(cameraType
There was a problem hiding this comment.
Since it uses the declarative API it must fully control the zoom factor. Thus, it must also manually reset the value.
The only alternative to these things are to use an imperative API for zooming which circumvents the issues. It all boils down to the fact that the gesture control and default zoom are only available in native
| <NativeCamera maxZoom={props.maxZoom ?? 20} style={{ minWidth: 100, minHeight: 100 }} ref={nativeRef} {...props} /> | ||
| ); | ||
| }); | ||
|
|
||
| Camera.defaultProps = { |
There was a problem hiding this comment.
We can use defaultProps bellow to set 20 by default. We might want it on Android as well
| <NativeCamera maxZoom={props.maxZoom ?? 20} style={{ minWidth: 100, minHeight: 100 }} ref={nativeRef} {...props} /> | |
| ); | |
| }); | |
| Camera.defaultProps = { | |
| <NativeCamera style={{ minWidth: 100, minHeight: 100 }} ref={nativeRef} {...props} /> | |
| ); | |
| }); | |
| Camera.defaultProps = { | |
| maxZoom: 20, |
There was a problem hiding this comment.
Good catch. I actually wanted to remove that. maxZoom shouldn't be required in RN, as that means we can't tell if it's undefined (unrestricted) or 20 (restricted).
| */ | ||
| zoomMode?: ZoomMode; | ||
| /** | ||
| * **iOS only.** |
There was a problem hiding this comment.
not "iOS only" anymore
Fixed inline docs for props Refactored Swift/Kotlin code to look alike (e.g. gesture handling)
Added a customizable capture button in example
| pinchGestureStartedAt = detector.currentSpan | ||
| return true | ||
| } | ||
| override fun onScale(detector: ScaleGestureDetector?): Boolean { |
There was a problem hiding this comment.
I think this may have reverted a change made in https://github.com/teslamotors/react-native-camera-kit/pull/551/files?w=1
There was a problem hiding this comment.
Thanks @elliottkember - This was re-fixed and released in v14.0.0-beta13.
teslamotors#559 broke a change in teslamotors#551 regarding override types. This restores the fix