react-native-camera-kit
react-native-camera-kit copied to clipboard
Add resize mode cover/contain
Motivation
I've added support for a dynamic resizeMode in the RealCamera class to address the need for flexible aspect ratio handling of the camera's preview layer. This enhancement allows switching between .resizeAspectFill and .resizeAspect, improving UI flexibility. My main goal was to enable both a full-cover and contained fit for the camera preview without manual adjustments. This feature is critical for applications requiring dynamic adjustments to the camera preview based on user interaction or specific UI layouts.
Testing on iOS
Despite not being a Swift developer, I managed to implement and test these changes on iOS:
Manual Testing: Conducted to ensure the resizeMode property correctly updates the videoGravity of the AVCaptureVideoPreviewLayer. UI Verification: Confirmed the UI updates accordingly, without any disruptions or visual glitches. Regression Testing: Checked that existing functionalities (camera initialization, capture functionality, zoom, and focus adjustments) remain unaffected. Testing was limited to iOS due to my current setup. Android testing is needed to ensure cross-platform compatibility and functionality.
Screenshots
(iOS screenshots demonstrating .cover and .contain modes will be attached.)
I encourage others with an Android setup to implement these if applicable. This addition is straightforward but should significantly enhance how we handle camera previews across different scenarios.
i'll have a look tomorrow!
https://github.com/teslamotors/react-native-camera-kit/assets/34944192/87beb715-02d6-42e3-affb-e6bcbbb15bdc
This is how I made the example
All other issues are addressed. You were right btw, somehow the call to the function didn't make it in the first iteration of this PR :)
i'll take a look at the minor comments, however, is this repo even alive?