Skip to content

Commit 2f321fc

Browse files
-refactor: delete ts code
1 parent 284df8d commit 2f321fc

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

  • BarcodeReaderSimpleSample

BarcodeReaderSimpleSample/App.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@ const requestPermissions = async () => {
3737
};
3838

3939
const decodeFile = async filePath => {
40-
try {
41-
return await this.dbr.decodeFile(filePath);
42-
} catch (err) {
43-
return null;
44-
}
40+
return this.dbr.decodeFile(filePath);
4541
};
4642

47-
const mergeResultsText = (results: BarcodeResult[]) => {
43+
const mergeResultsText = results => {
4844
let str = '';
4945
if (results && results.length > 0) {
5046
for (let i = 0; i < results.length; i++) {
@@ -64,10 +60,15 @@ const useImagePicker = (imagePickerLauncher, setModalState) => {
6460
return false;
6561
}
6662
setModalState({isVisible: true, text: 'decoding...'});
67-
decodeFile(res.assets[0].uri.split('file://')[1]).then(results => {
68-
let str = mergeResultsText(results);
69-
setModalState({isVisible: true, text: str});
70-
});
63+
decodeFile(res.assets[0].uri.split('file://')[1]).then(
64+
results => {
65+
let str = mergeResultsText(results);
66+
setModalState({isVisible: true, text: str});
67+
},
68+
err => {
69+
setModalState({isVisible: true, text: err});
70+
},
71+
);
7172
});
7273
};
7374

0 commit comments

Comments
 (0)