Open two-bridges opened 3 years ago
If you pass an array to format attribute, the app running on a physical iOS device will crash.
format
eg. [formats]="['QR_CODE']"
[formats]="['QR_CODE']"
Error: formatsString.split is not a function
formatsString.split is not a function
It was my error to try to send an array, but it was very painful to solve this issue in a production app.
I guess it could throw an ugly error but best if it did not to crash the whole app.
Possible Solution:
add typeof formatsString before trying to use formatsString, as shown below:
typeof formatsString
/node_modules/nativescript-barcodescanner/barcodescanner.ios.js
const getBarcodeTypes = (formatsString) => { const types = []; if (typeof formatsString === "string" && formatsString) { let formats = formatsString.split(","); for (let format of formats) { format = format.trim(); if (format === "QR_CODE")
If you pass an array to
format
attribute, the app running on a physical iOS device will crash.eg.
[formats]="['QR_CODE']"
Error:
formatsString.split is not a function
It was my error to try to send an array, but it was very painful to solve this issue in a production app.
I guess it could throw an ugly error but best if it did not to crash the whole app.
Possible Solution:
add
typeof formatsString
before trying to use formatsString, as shown below:/node_modules/nativescript-barcodescanner/barcodescanner.ios.js