Native Barcode Scanner

0
Hello! We are currently using the native barcode scanner from Native Resources on a project - and are in a situation where we need to be able to take in special characters. Has anyone run into this or know of any work arounds? The current scanner does not appear to be able to do this. https://marketplace.mendix.com/link/component/109513
asked
1 answers
0

Hey Marie!

I have not used that widget personally, but knowing a little bit about the onBarCodeRead function called by RNCamera component you might get more back than just text data.
The widget itself calls this function when it scans a barcode.

private onBarCodeRead(event: { data: string }): void {
    if (this.props.barcode.status !== ValueStatus.Available || !event.data) {
        return;
    }

    if (event.data !== this.props.barcode.value) {
        this.props.barcode.setValue(event.data);
    }

    executeAction(this.props.onDetect);
}

Currently only “data” from the event is passed in, but there should also be a “rawData” variable available to you which should be the bytes. You can then encode the bytes into whatever text encoding you used to create the barcode.
So you can just modify the Widget code and include the rawData in your onBarCodeRead function.

private onBarCodeRead(event: { data: string, rawData: any }): void {

This is just an idea on something to try. Not exactly sure if it will work. But I think it might.

answered