Skip to content

Commit f44f117

Browse files
committed
fix: mark OCR loadNativeModule methods as async
The `await` keyword was used in loadNativeModule without the method being marked async, causing a Babel parse error (UnexpectedReservedWord).
1 parent f293cb2 commit f44f117

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

packages/react-native-executorch/src/controllers/BaseOCRController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export abstract class BaseOCRController {
3030
recognizerPath: string,
3131
language: OCRLanguage,
3232
extraParams?: any
33-
): any;
33+
): Promise<any>;
3434

3535
protected internalLoad = async (
3636
detectorSource: ResourceSource,
@@ -63,7 +63,7 @@ export abstract class BaseOCRController {
6363
'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'
6464
);
6565
}
66-
this.nativeModule = this.loadNativeModule(
66+
this.nativeModule = await this.loadNativeModule(
6767
paths[0]!,
6868
paths[1]!,
6969
language,

packages/react-native-executorch/src/controllers/OCRController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { OCRLanguage } from '../types/ocr';
44
import { BaseOCRController } from './BaseOCRController';
55

66
export class OCRController extends BaseOCRController {
7-
protected loadNativeModule(
7+
protected async loadNativeModule(
88
detectorPath: string,
99
recognizerPath: string,
1010
language: OCRLanguage
11-
): any {
11+
): Promise<any> {
1212
return await global.loadOCR(detectorPath, recognizerPath, symbols[language]);
1313
}
1414

packages/react-native-executorch/src/controllers/VerticalOCRController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { OCRLanguage } from '../types/ocr';
44
import { BaseOCRController } from './BaseOCRController';
55

66
export class VerticalOCRController extends BaseOCRController {
7-
protected loadNativeModule(
7+
protected async loadNativeModule(
88
detectorPath: string,
99
recognizerPath: string,
1010
language: OCRLanguage,
1111
independentCharacters?: boolean
12-
): any {
12+
): Promise<any> {
1313
return await global.loadVerticalOCR(
1414
detectorPath,
1515
recognizerPath,

0 commit comments

Comments
 (0)