-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[android][camera] Set the previews scaleType when changing ratio #30831
Conversation
@@ -394,7 +394,7 @@ export type CameraProps = ViewProps & { | |||
responsiveOrientationWhenOrientationLocked?: boolean; | |||
/** | |||
* A string representing the aspect ratio of the preview. For example, `4:3` and `16:9`. | |||
* @default 4:3 | |||
* @default 1:1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default was set to 1:1
to maintain current behaviour.
The Pull Request introduced fingerprint changes against the base commit: 8b52504 Fingerprint diff[
{
"op": "changed",
"source": {
"type": "dir",
"filePath": "../../packages/expo-camera/android",
"reasons": [
"expoAutolinkingAndroid"
],
"hash": "3b80516fc1fcaa90fc5e350a5f40b87ee10c1574"
}
}
] Generated by PR labeler 🤖 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for fixing this. just adding some nit comment if that makes sense to you.
packages/expo-camera/android/src/main/java/expo/modules/camera/records/CameraRecords.kt
Outdated
Show resolved
Hide resolved
packages/expo-camera/android/src/main/java/expo/modules/camera/ExpoCameraView.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebuild js and doc then good to merge 🚀
Why
Closes #30829
When setting the aspect ratio, it will not take effect unless you also change the
scaleType
on the preview. By default, it is set toFILL_CENTER
, which ignores the aspect ratio setting and scales the image up to fill its container.How
Based on the ratio value, set the
scaleType
of the previewView.Test Plan
Bare-expo. Changing ratios now affects the preview correctly.