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

[camera] Fix barcodeTypes prop in types and in Swift #26888

Merged
merged 7 commits into from
Feb 2, 2024

Conversation

byudaniel
Copy link
Contributor

Why

Android was not receiving the barCodeTypes prop, so when scanning barcodes it was scanning for every type of barcode.

How

I fixed the casing on the prop to be consistent with iOS and the docs.

Test Plan

Tested manually with Galaxy 21 and S22 Ultra to ensure it only picked up the specified barcode type.

Checklist

@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Feb 2, 2024
@alanjhughes
Copy link
Collaborator

Hi @byudaniel - The name of the prop is correct, barcodeTypes is what is should be. If you are passing barCodeTypes from javascript it will not work

@byudaniel
Copy link
Contributor Author

byudaniel commented Feb 2, 2024

Hi @byudaniel - The name of the prop is correct, barcodeTypes is what is should be. If you are passing barCodeTypes from javascript it will not work

If you do a case search in ./packages/expo-camera the only place it is barcodeTypes is within packages/expo-camera/android/src/main/java/expo/modules/camera/next/ExpoCameraView.kt and packages/expo-camera/android/src/main/java/expo/modules/camera/next/records/CameraRecords.kt. Before this change it worked properly with barcodeTypes on iOS, but not on Android.

See also

export type BarcodeSettings = {
barCodeTypes: BarCodeType[];
.

@alanjhughes
Copy link
Collaborator

@byudaniel - yes so the correct fix is to fix the casing on the Typescript type

@byudaniel
Copy link
Contributor Author

@alanjhughes - OK, so I'll update the PR to update the Swift code and the types and revert the changes to the Kotlin files.

@byudaniel byudaniel changed the title [android][camera] Fix barCodeTypes prop [camera] Fix barCodeTypes prop in types and in Swift Feb 2, 2024
@alanjhughes
Copy link
Collaborator

@byudaniel - yes, that'd be great!

@byudaniel byudaniel changed the title [camera] Fix barCodeTypes prop in types and in Swift [camera] Fix barcodeTypes prop in types and in Swift Feb 2, 2024
@alanjhughes
Copy link
Collaborator

@byudaniel - looking good. Have you checked that everything is working correctly on the CameraScreenNext example?

@alanjhughes
Copy link
Collaborator

@byudaniel the example screen isn't using the correct name now.

@byudaniel
Copy link
Contributor Author

@alanjhughes I confirmed that it is working in CameraScreenNext.tsx with an Android and an iOS device. I also updated the barcodeTypes property to the right casing in that file.

Copy link
Collaborator

@alanjhughes alanjhughes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thank you for your contribution! 👍

@alanjhughes alanjhughes merged commit 9dac08a into expo:main Feb 2, 2024
10 checks passed
@brentvatne brentvatne added the published Changes from the PR have been published to npm label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants