You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.
I agree, and this goes for every option, not only barCodeTypes:
Features/options supported by both iOS and Android will have the same values. To read QR codes setting qr will work for both iOS and Android, and the type of the possible values for the barCodeTypes prop will include all those types of bar codes available in both iOS and Android.
For those features/options supported by only one OS, there will be an extension of the base prop value type for that OS that extends with the OS-specific features/options.
For example:
Invalid options should be rejected by an OS, but the JS side should filter sending valid options for one OS when the runtime is of another OS. That means:
// This doesn't fail on either Android or iOS<BarcodePluginbarcodeTypes={['qr','appleQR']}/>// This fails on both Android and iOS<BarcodePluginbarcodeTypes={['invalid']}/>
This means v4 will have a lot of breaking changes in props and options to make the API as clean and platform-agnostic as possible. Typescript types and good documentation is the way to get it right.
Native options should not be hidden by the JS side just as an attempt to provide a uniform API across both OS.
Take the quality option of record as an example: Current possible values are '2160p' | ... | '288p', '4:3' but iOS doesn't actually have a 4:3 value, it does have 640x480 option which provides a 4:3 ratio but is the same as setting it to 480p. On top of that, many of the supported iOS are not being exposed in the API, so the right way to document this is to say the quality option supports 2160p ... 288p on both Android and iOS, and additionally any valid iOS AVCaptureSession.Preset value is a valid option. This does mean we have to add every possible option for each OS into the OS specific types and update them as they are added, but I think it is worth it to expose the full potential of the native side.
In v3 the
barCodeTypes
are not correctly typed, it is not supporting the detected types on iOs.For example, if I would like to restrict the valid codes to only QR, the TS typings say to pass:
but it does not work on iOs, I need to pass:
I do not know if makes sense to fix this on v3 or just see this looking forward.
Docs: https://developer.apple.com/documentation/avfoundation/avmetadatamachinereadablecodeobject/machine-readable_object_types
The text was updated successfully, but these errors were encountered: