react-native-rectangle-doc-scanner 15.4.0 → 15.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +473 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,29 @@ yarn/npm으로 설치하기만 하면 됩니다 - **수동 설정 불필요!**
|
|
|
38
38
|
- 설치 중 iOS 최적화 파일 자동 복사
|
|
39
39
|
- `pod install` 후 즉시 사용 가능
|
|
40
40
|
|
|
41
|
+
## 빠른 시작 가이드
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 1. 패키지 설치
|
|
45
|
+
yarn add react-native-rectangle-doc-scanner \
|
|
46
|
+
github:Michaelvilleneuve/react-native-document-scanner \
|
|
47
|
+
react-native-perspective-image-cropper \
|
|
48
|
+
react-native-fs \
|
|
49
|
+
react-native-image-crop-picker \
|
|
50
|
+
react-native-image-picker \
|
|
51
|
+
react-native-svg \
|
|
52
|
+
expo-modules-core
|
|
53
|
+
|
|
54
|
+
# 2. iOS 설정
|
|
55
|
+
cd ios && pod install && cd ..
|
|
56
|
+
|
|
57
|
+
# 3. iOS Info.plist에 카메라 권한 추가 (수동)
|
|
58
|
+
# 4. 앱 실행
|
|
59
|
+
npx react-native run-ios
|
|
60
|
+
# 또는
|
|
61
|
+
npx react-native run-android
|
|
62
|
+
```
|
|
63
|
+
|
|
41
64
|
## 설치 방법
|
|
42
65
|
|
|
43
66
|
### 1. 패키지 설치
|
|
@@ -384,6 +407,54 @@ import { FullDocScanner } from 'react-native-rectangle-doc-scanner';
|
|
|
384
407
|
/>
|
|
385
408
|
```
|
|
386
409
|
|
|
410
|
+
## 의존성 패키지 상세 정보
|
|
411
|
+
|
|
412
|
+
이 라이브러리는 다양한 패키지에 의존합니다. 각 패키지의 역할은 다음과 같습니다:
|
|
413
|
+
|
|
414
|
+
### 필수 의존성 (Peer Dependencies)
|
|
415
|
+
|
|
416
|
+
| 패키지 | 역할 | 필수 여부 |
|
|
417
|
+
|--------|------|-----------|
|
|
418
|
+
| `react-native-fs` | 파일 시스템 접근 (이미지 저장/읽기) | ✅ 필수 |
|
|
419
|
+
| `react-native-image-crop-picker` | 이미지 선택 및 크롭 | ✅ 필수 |
|
|
420
|
+
| `react-native-image-picker` | 갤러리/카메라에서 이미지 선택 | ✅ 필수 |
|
|
421
|
+
| `react-native-svg` | SVG 렌더링 (UI 오버레이) | ✅ 필수 |
|
|
422
|
+
| `expo-modules-core` | Expo 모듈 코어 기능 | ✅ 필수 |
|
|
423
|
+
| `expo-image-manipulator` | 이미지 회전 및 편집 | ⚙️ 선택 (회전 기능용) |
|
|
424
|
+
| `react-native-image-rotate` | 이미지 회전 (대안) | ⚙️ 선택 (회전 기능용) |
|
|
425
|
+
|
|
426
|
+
### 내부 의존성 (Dependencies)
|
|
427
|
+
|
|
428
|
+
| 패키지 | 역할 |
|
|
429
|
+
|--------|------|
|
|
430
|
+
| `react-native-document-scanner` | 네이티브 문서 스캐너 구현 (GitHub) |
|
|
431
|
+
| `react-native-perspective-image-cropper` | 원근 보정 크롭 에디터 |
|
|
432
|
+
| `prop-types` | React PropTypes 검증 |
|
|
433
|
+
|
|
434
|
+
### 개발 의존성 (DevDependencies)
|
|
435
|
+
|
|
436
|
+
| 패키지 | 역할 |
|
|
437
|
+
|--------|------|
|
|
438
|
+
| `typescript` | TypeScript 컴파일러 |
|
|
439
|
+
| `@types/react` | React 타입 정의 |
|
|
440
|
+
| `@types/react-native` | React Native 타입 정의 |
|
|
441
|
+
| `@types/react-native-fs` | react-native-fs 타입 정의 |
|
|
442
|
+
|
|
443
|
+
### 네이티브 의존성
|
|
444
|
+
|
|
445
|
+
**iOS (CocoaPods):**
|
|
446
|
+
- OpenCV (이미지 처리 및 문서 감지)
|
|
447
|
+
- AVFoundation (카메라 API)
|
|
448
|
+
- CoreImage (이미지 필터 및 품질 처리)
|
|
449
|
+
|
|
450
|
+
**Android (Gradle):**
|
|
451
|
+
- OpenCV 4.9.0 (문서 감지)
|
|
452
|
+
- CameraX 1.3.0 (카메라 API)
|
|
453
|
+
- Kotlin Coroutines 1.7.3 (비동기 처리)
|
|
454
|
+
- ML Kit Document Scanner (문서 스캔)
|
|
455
|
+
- ML Kit Object Detection (실시간 사각형 감지)
|
|
456
|
+
- AndroidX Core, AppCompat (Android 기본 라이브러리)
|
|
457
|
+
|
|
387
458
|
## 기술 스택
|
|
388
459
|
|
|
389
460
|
### iOS
|
|
@@ -391,22 +462,24 @@ import { FullDocScanner } from 'react-native-rectangle-doc-scanner';
|
|
|
391
462
|
- **카메라 API**: AVCapturePhotoOutput (iOS 10+)
|
|
392
463
|
- **이미지 처리**: OpenCV, CoreImage (CIContext)
|
|
393
464
|
- **최소 버전**: iOS 11.0
|
|
465
|
+
- **지원 아키텍처**: arm64, x86_64 (시뮬레이터)
|
|
394
466
|
|
|
395
467
|
### Android
|
|
396
|
-
- **언어**: Kotlin
|
|
468
|
+
- **언어**: Kotlin 1.8.21
|
|
397
469
|
- **카메라**: CameraX 1.3.0, Camera2 API
|
|
398
470
|
- **이미지 처리**: OpenCV 4.9.0
|
|
399
471
|
- **ML Kit**: 문서 스캔 및 객체 감지
|
|
400
|
-
- **최소 SDK**: 21 (Android 5.0)
|
|
401
|
-
- **타겟 SDK**: 33 (Android 13)
|
|
402
|
-
- **
|
|
403
|
-
- **
|
|
472
|
+
- **최소 SDK**: 21 (Android 5.0 Lollipop)
|
|
473
|
+
- **타겟 SDK**: 33 (Android 13 Tiramisu)
|
|
474
|
+
- **Java**: JDK 17
|
|
475
|
+
- **Gradle**: 7.4.2+
|
|
476
|
+
- **Android Gradle Plugin**: 7.4.2+
|
|
404
477
|
|
|
405
478
|
## 문제 해결
|
|
406
479
|
|
|
407
480
|
### iOS 빌드 오류
|
|
408
481
|
|
|
409
|
-
Pod 설치 후에도 빌드 오류가 발생하는
|
|
482
|
+
**Pod 설치 후에도 빌드 오류가 발생하는 경우:**
|
|
410
483
|
|
|
411
484
|
```bash
|
|
412
485
|
cd ios
|
|
@@ -416,19 +489,139 @@ pod install
|
|
|
416
489
|
cd ..
|
|
417
490
|
```
|
|
418
491
|
|
|
492
|
+
**"Module not found" 또는 헤더 파일 관련 오류:**
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
# Xcode에서 Product > Clean Build Folder (Shift + Cmd + K)
|
|
496
|
+
# 또는 터미널에서:
|
|
497
|
+
cd ios
|
|
498
|
+
xcodebuild clean -workspace YourApp.xcworkspace -scheme YourApp
|
|
499
|
+
cd ..
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
**CocoaPods 버전 문제:**
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
sudo gem install cocoapods
|
|
506
|
+
pod --version # 1.11.0 이상 권장
|
|
507
|
+
```
|
|
508
|
+
|
|
419
509
|
### Android 빌드 오류
|
|
420
510
|
|
|
421
|
-
Gradle 빌드 오류가 발생하는
|
|
511
|
+
**Gradle 빌드 오류가 발생하는 경우:**
|
|
422
512
|
|
|
423
513
|
```bash
|
|
424
514
|
cd android
|
|
425
515
|
./gradlew clean
|
|
516
|
+
./gradlew --stop # Gradle daemon 중지
|
|
517
|
+
cd ..
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
**Java 버전 오류:**
|
|
521
|
+
|
|
522
|
+
이 라이브러리는 Java 17이 필요합니다. Java 버전을 확인하세요:
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
java -version # java version "17.x.x" 확인
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
**Kotlin 버전 충돌:**
|
|
529
|
+
|
|
530
|
+
`android/build.gradle`에서 Kotlin 버전이 1.8.21 이상인지 확인:
|
|
531
|
+
|
|
532
|
+
```gradle
|
|
533
|
+
buildscript {
|
|
534
|
+
ext.kotlin_version = '1.8.21'
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
**OpenCV 의존성 오류:**
|
|
539
|
+
|
|
540
|
+
OpenCV가 자동으로 다운로드되지 않는 경우:
|
|
541
|
+
|
|
542
|
+
```bash
|
|
543
|
+
cd android
|
|
544
|
+
./gradlew clean
|
|
545
|
+
./gradlew :app:dependencies # 의존성 확인
|
|
426
546
|
cd ..
|
|
427
547
|
```
|
|
428
548
|
|
|
429
549
|
### 권한 오류
|
|
430
550
|
|
|
431
|
-
|
|
551
|
+
**카메라가 작동하지 않는 경우:**
|
|
552
|
+
|
|
553
|
+
1. **iOS**: Info.plist에 권한 설명이 추가되어 있는지 확인:
|
|
554
|
+
- `NSCameraUsageDescription`
|
|
555
|
+
- `NSPhotoLibraryUsageDescription`
|
|
556
|
+
- `NSPhotoLibraryAddUsageDescription`
|
|
557
|
+
|
|
558
|
+
2. **Android**: PermissionsAndroid로 런타임 권한 요청:
|
|
559
|
+
```typescript
|
|
560
|
+
await PermissionsAndroid.request(
|
|
561
|
+
PermissionsAndroid.PERMISSIONS.CAMERA
|
|
562
|
+
);
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
3. 기기 설정에서 앱의 카메라 권한이 허용되어 있는지 확인
|
|
566
|
+
|
|
567
|
+
### Postinstall 스크립트 오류
|
|
568
|
+
|
|
569
|
+
**postinstall이 실행되지 않는 경우:**
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
# 수동으로 postinstall 실행
|
|
573
|
+
node node_modules/react-native-rectangle-doc-scanner/scripts/postinstall.js
|
|
574
|
+
|
|
575
|
+
# 또는 패키지 재설치
|
|
576
|
+
rm -rf node_modules
|
|
577
|
+
yarn install # 또는 npm install
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
**"react-native-document-scanner not found" 오류:**
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
# react-native-document-scanner 설치 확인
|
|
584
|
+
yarn add github:Michaelvilleneuve/react-native-document-scanner
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Metro Bundler 오류
|
|
588
|
+
|
|
589
|
+
**"Unable to resolve module" 오류:**
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
# Metro 캐시 삭제
|
|
593
|
+
npx react-native start --reset-cache
|
|
594
|
+
|
|
595
|
+
# 또는
|
|
596
|
+
rm -rf $TMPDIR/metro-*
|
|
597
|
+
rm -rf $TMPDIR/haste-*
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
### Peer Dependencies 경고
|
|
601
|
+
|
|
602
|
+
**"unmet peer dependency" 경고가 나타나는 경우:**
|
|
603
|
+
|
|
604
|
+
모든 peer dependencies를 설치했는지 확인:
|
|
605
|
+
|
|
606
|
+
```bash
|
|
607
|
+
yarn add react-native-fs \
|
|
608
|
+
react-native-image-crop-picker \
|
|
609
|
+
react-native-image-picker \
|
|
610
|
+
react-native-svg \
|
|
611
|
+
expo-modules-core
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
### Expo 프로젝트
|
|
615
|
+
|
|
616
|
+
Expo를 사용하는 경우, 일부 네이티브 모듈이 Expo Go에서 작동하지 않을 수 있습니다.
|
|
617
|
+
개발 빌드(development build)를 사용하세요:
|
|
618
|
+
|
|
619
|
+
```bash
|
|
620
|
+
npx expo prebuild
|
|
621
|
+
npx expo run:ios
|
|
622
|
+
# 또는
|
|
623
|
+
npx expo run:android
|
|
624
|
+
```
|
|
432
625
|
|
|
433
626
|
## 라이선스
|
|
434
627
|
|
|
@@ -470,6 +663,29 @@ Just install with yarn/npm - **no manual configuration needed!**
|
|
|
470
663
|
- Optimized iOS files copied during installation
|
|
471
664
|
- Works immediately after `pod install`
|
|
472
665
|
|
|
666
|
+
## Quick Start Guide
|
|
667
|
+
|
|
668
|
+
```bash
|
|
669
|
+
# 1. Install packages
|
|
670
|
+
yarn add react-native-rectangle-doc-scanner \
|
|
671
|
+
github:Michaelvilleneuve/react-native-document-scanner \
|
|
672
|
+
react-native-perspective-image-cropper \
|
|
673
|
+
react-native-fs \
|
|
674
|
+
react-native-image-crop-picker \
|
|
675
|
+
react-native-image-picker \
|
|
676
|
+
react-native-svg \
|
|
677
|
+
expo-modules-core
|
|
678
|
+
|
|
679
|
+
# 2. iOS setup
|
|
680
|
+
cd ios && pod install && cd ..
|
|
681
|
+
|
|
682
|
+
# 3. Add camera permissions to iOS Info.plist (manual)
|
|
683
|
+
# 4. Run your app
|
|
684
|
+
npx react-native run-ios
|
|
685
|
+
# or
|
|
686
|
+
npx react-native run-android
|
|
687
|
+
```
|
|
688
|
+
|
|
473
689
|
## Installation
|
|
474
690
|
|
|
475
691
|
### 1. Install the Package
|
|
@@ -586,7 +802,77 @@ The library has the following minimum requirements:
|
|
|
586
802
|
|
|
587
803
|
These are automatically applied, but make sure your project's `android/build.gradle` uses compatible versions.
|
|
588
804
|
|
|
589
|
-
|
|
805
|
+
**Example `android/build.gradle` configuration:**
|
|
806
|
+
|
|
807
|
+
```gradle
|
|
808
|
+
buildscript {
|
|
809
|
+
ext {
|
|
810
|
+
buildToolsVersion = "33.0.0"
|
|
811
|
+
minSdkVersion = 21
|
|
812
|
+
compileSdkVersion = 33
|
|
813
|
+
targetSdkVersion = 33
|
|
814
|
+
kotlinVersion = "1.8.21"
|
|
815
|
+
}
|
|
816
|
+
dependencies {
|
|
817
|
+
classpath("com.android.tools.build:gradle:7.4.2")
|
|
818
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
**Example `android/app/build.gradle` configuration:**
|
|
824
|
+
|
|
825
|
+
```gradle
|
|
826
|
+
android {
|
|
827
|
+
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
828
|
+
|
|
829
|
+
compileOptions {
|
|
830
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
831
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
kotlinOptions {
|
|
835
|
+
jvmTarget = '17'
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
defaultConfig {
|
|
839
|
+
minSdkVersion rootProject.ext.minSdkVersion
|
|
840
|
+
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
### 5. Automatic Quality Patch (Postinstall)
|
|
846
|
+
|
|
847
|
+
This library automatically optimizes camera quality through a **postinstall script**:
|
|
848
|
+
|
|
849
|
+
```bash
|
|
850
|
+
# Automatically runs on package installation
|
|
851
|
+
node scripts/postinstall.js
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
**What postinstall does:**
|
|
855
|
+
1. Locates the `react-native-document-scanner` package (auto-detected in node_modules)
|
|
856
|
+
2. Copies optimized iOS files from the vendor folder:
|
|
857
|
+
- `IPDFCameraViewController.m/h` - Uses AVCapturePhotoOutput
|
|
858
|
+
- `DocumentScannerView.m/h` - High quality settings
|
|
859
|
+
- `RNPdfScannerManager.m/h` - Native bridge
|
|
860
|
+
- `ios.js`, `index.js` - JavaScript interface
|
|
861
|
+
3. Original files are backed up with `.original` extension
|
|
862
|
+
|
|
863
|
+
**To run manually:**
|
|
864
|
+
|
|
865
|
+
```bash
|
|
866
|
+
npm run postinstall
|
|
867
|
+
# or
|
|
868
|
+
node scripts/postinstall.js
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
**Troubleshooting:**
|
|
872
|
+
- If postinstall fails, ensure `react-native-document-scanner` is installed
|
|
873
|
+
- When using yarn workspaces or monorepos, package hoisting may affect the path
|
|
874
|
+
|
|
875
|
+
### 6. Request Runtime Permissions
|
|
590
876
|
|
|
591
877
|
You need to request camera permissions at runtime in your app:
|
|
592
878
|
|
|
@@ -746,6 +1032,54 @@ import { FullDocScanner } from 'react-native-rectangle-doc-scanner';
|
|
|
746
1032
|
/>
|
|
747
1033
|
```
|
|
748
1034
|
|
|
1035
|
+
## Dependency Details
|
|
1036
|
+
|
|
1037
|
+
This library depends on various packages. Here's what each package does:
|
|
1038
|
+
|
|
1039
|
+
### Required Dependencies (Peer Dependencies)
|
|
1040
|
+
|
|
1041
|
+
| Package | Purpose | Required |
|
|
1042
|
+
|---------|---------|----------|
|
|
1043
|
+
| `react-native-fs` | File system access (save/read images) | ✅ Required |
|
|
1044
|
+
| `react-native-image-crop-picker` | Image selection and cropping | ✅ Required |
|
|
1045
|
+
| `react-native-image-picker` | Pick images from gallery/camera | ✅ Required |
|
|
1046
|
+
| `react-native-svg` | SVG rendering (UI overlays) | ✅ Required |
|
|
1047
|
+
| `expo-modules-core` | Expo module core functionality | ✅ Required |
|
|
1048
|
+
| `expo-image-manipulator` | Image rotation and editing | ⚙️ Optional (for rotation) |
|
|
1049
|
+
| `react-native-image-rotate` | Image rotation (alternative) | ⚙️ Optional (for rotation) |
|
|
1050
|
+
|
|
1051
|
+
### Internal Dependencies
|
|
1052
|
+
|
|
1053
|
+
| Package | Purpose |
|
|
1054
|
+
|---------|---------|
|
|
1055
|
+
| `react-native-document-scanner` | Native document scanner implementation (GitHub) |
|
|
1056
|
+
| `react-native-perspective-image-cropper` | Perspective correction crop editor |
|
|
1057
|
+
| `prop-types` | React PropTypes validation |
|
|
1058
|
+
|
|
1059
|
+
### Development Dependencies
|
|
1060
|
+
|
|
1061
|
+
| Package | Purpose |
|
|
1062
|
+
|---------|---------|
|
|
1063
|
+
| `typescript` | TypeScript compiler |
|
|
1064
|
+
| `@types/react` | React type definitions |
|
|
1065
|
+
| `@types/react-native` | React Native type definitions |
|
|
1066
|
+
| `@types/react-native-fs` | react-native-fs type definitions |
|
|
1067
|
+
|
|
1068
|
+
### Native Dependencies
|
|
1069
|
+
|
|
1070
|
+
**iOS (CocoaPods):**
|
|
1071
|
+
- OpenCV (image processing and document detection)
|
|
1072
|
+
- AVFoundation (camera API)
|
|
1073
|
+
- CoreImage (image filters and quality processing)
|
|
1074
|
+
|
|
1075
|
+
**Android (Gradle):**
|
|
1076
|
+
- OpenCV 4.9.0 (document detection)
|
|
1077
|
+
- CameraX 1.3.0 (camera API)
|
|
1078
|
+
- Kotlin Coroutines 1.7.3 (async processing)
|
|
1079
|
+
- ML Kit Document Scanner (document scanning)
|
|
1080
|
+
- ML Kit Object Detection (real-time rectangle detection)
|
|
1081
|
+
- AndroidX Core, AppCompat (Android base libraries)
|
|
1082
|
+
|
|
749
1083
|
## Tech Stack
|
|
750
1084
|
|
|
751
1085
|
### iOS
|
|
@@ -753,22 +1087,24 @@ import { FullDocScanner } from 'react-native-rectangle-doc-scanner';
|
|
|
753
1087
|
- **Camera API**: AVCapturePhotoOutput (iOS 10+)
|
|
754
1088
|
- **Image Processing**: OpenCV, CoreImage (CIContext)
|
|
755
1089
|
- **Minimum Version**: iOS 11.0
|
|
1090
|
+
- **Supported Architectures**: arm64, x86_64 (simulator)
|
|
756
1091
|
|
|
757
1092
|
### Android
|
|
758
|
-
- **Language**: Kotlin
|
|
1093
|
+
- **Language**: Kotlin 1.8.21
|
|
759
1094
|
- **Camera**: CameraX 1.3.0, Camera2 API
|
|
760
1095
|
- **Image Processing**: OpenCV 4.9.0
|
|
761
1096
|
- **ML Kit**: Document scanning and object detection
|
|
762
|
-
- **Minimum SDK**: 21 (Android 5.0)
|
|
763
|
-
- **Target SDK**: 33 (Android 13)
|
|
764
|
-
- **
|
|
765
|
-
- **
|
|
1097
|
+
- **Minimum SDK**: 21 (Android 5.0 Lollipop)
|
|
1098
|
+
- **Target SDK**: 33 (Android 13 Tiramisu)
|
|
1099
|
+
- **Java**: JDK 17
|
|
1100
|
+
- **Gradle**: 7.4.2+
|
|
1101
|
+
- **Android Gradle Plugin**: 7.4.2+
|
|
766
1102
|
|
|
767
1103
|
## Troubleshooting
|
|
768
1104
|
|
|
769
1105
|
### iOS Build Errors
|
|
770
1106
|
|
|
771
|
-
If you encounter build errors after pod install
|
|
1107
|
+
**If you encounter build errors after pod install:**
|
|
772
1108
|
|
|
773
1109
|
```bash
|
|
774
1110
|
cd ios
|
|
@@ -778,19 +1114,139 @@ pod install
|
|
|
778
1114
|
cd ..
|
|
779
1115
|
```
|
|
780
1116
|
|
|
1117
|
+
**"Module not found" or header file related errors:**
|
|
1118
|
+
|
|
1119
|
+
```bash
|
|
1120
|
+
# In Xcode: Product > Clean Build Folder (Shift + Cmd + K)
|
|
1121
|
+
# Or from terminal:
|
|
1122
|
+
cd ios
|
|
1123
|
+
xcodebuild clean -workspace YourApp.xcworkspace -scheme YourApp
|
|
1124
|
+
cd ..
|
|
1125
|
+
```
|
|
1126
|
+
|
|
1127
|
+
**CocoaPods version issues:**
|
|
1128
|
+
|
|
1129
|
+
```bash
|
|
1130
|
+
sudo gem install cocoapods
|
|
1131
|
+
pod --version # Recommended 1.11.0+
|
|
1132
|
+
```
|
|
1133
|
+
|
|
781
1134
|
### Android Build Errors
|
|
782
1135
|
|
|
783
|
-
If you encounter Gradle build errors
|
|
1136
|
+
**If you encounter Gradle build errors:**
|
|
1137
|
+
|
|
1138
|
+
```bash
|
|
1139
|
+
cd android
|
|
1140
|
+
./gradlew clean
|
|
1141
|
+
./gradlew --stop # Stop Gradle daemon
|
|
1142
|
+
cd ..
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
**Java version errors:**
|
|
1146
|
+
|
|
1147
|
+
This library requires Java 17. Check your Java version:
|
|
1148
|
+
|
|
1149
|
+
```bash
|
|
1150
|
+
java -version # Should show "17.x.x"
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
**Kotlin version conflicts:**
|
|
1154
|
+
|
|
1155
|
+
Ensure Kotlin version in `android/build.gradle` is 1.8.21 or higher:
|
|
1156
|
+
|
|
1157
|
+
```gradle
|
|
1158
|
+
buildscript {
|
|
1159
|
+
ext.kotlin_version = '1.8.21'
|
|
1160
|
+
}
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
**OpenCV dependency errors:**
|
|
1164
|
+
|
|
1165
|
+
If OpenCV doesn't download automatically:
|
|
784
1166
|
|
|
785
1167
|
```bash
|
|
786
1168
|
cd android
|
|
787
1169
|
./gradlew clean
|
|
1170
|
+
./gradlew :app:dependencies # Check dependencies
|
|
788
1171
|
cd ..
|
|
789
1172
|
```
|
|
790
1173
|
|
|
791
1174
|
### Permission Errors
|
|
792
1175
|
|
|
793
|
-
If the camera is not working
|
|
1176
|
+
**If the camera is not working:**
|
|
1177
|
+
|
|
1178
|
+
1. **iOS**: Check that permission descriptions are added to Info.plist:
|
|
1179
|
+
- `NSCameraUsageDescription`
|
|
1180
|
+
- `NSPhotoLibraryUsageDescription`
|
|
1181
|
+
- `NSPhotoLibraryAddUsageDescription`
|
|
1182
|
+
|
|
1183
|
+
2. **Android**: Request runtime permissions using PermissionsAndroid:
|
|
1184
|
+
```typescript
|
|
1185
|
+
await PermissionsAndroid.request(
|
|
1186
|
+
PermissionsAndroid.PERMISSIONS.CAMERA
|
|
1187
|
+
);
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
3. Verify that camera permissions are granted in device settings
|
|
1191
|
+
|
|
1192
|
+
### Postinstall Script Errors
|
|
1193
|
+
|
|
1194
|
+
**If postinstall doesn't run:**
|
|
1195
|
+
|
|
1196
|
+
```bash
|
|
1197
|
+
# Run postinstall manually
|
|
1198
|
+
node node_modules/react-native-rectangle-doc-scanner/scripts/postinstall.js
|
|
1199
|
+
|
|
1200
|
+
# Or reinstall packages
|
|
1201
|
+
rm -rf node_modules
|
|
1202
|
+
yarn install # or npm install
|
|
1203
|
+
```
|
|
1204
|
+
|
|
1205
|
+
**"react-native-document-scanner not found" error:**
|
|
1206
|
+
|
|
1207
|
+
```bash
|
|
1208
|
+
# Verify react-native-document-scanner installation
|
|
1209
|
+
yarn add github:Michaelvilleneuve/react-native-document-scanner
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
### Metro Bundler Errors
|
|
1213
|
+
|
|
1214
|
+
**"Unable to resolve module" error:**
|
|
1215
|
+
|
|
1216
|
+
```bash
|
|
1217
|
+
# Clear Metro cache
|
|
1218
|
+
npx react-native start --reset-cache
|
|
1219
|
+
|
|
1220
|
+
# Or
|
|
1221
|
+
rm -rf $TMPDIR/metro-*
|
|
1222
|
+
rm -rf $TMPDIR/haste-*
|
|
1223
|
+
```
|
|
1224
|
+
|
|
1225
|
+
### Peer Dependencies Warning
|
|
1226
|
+
|
|
1227
|
+
**If you see "unmet peer dependency" warnings:**
|
|
1228
|
+
|
|
1229
|
+
Make sure all peer dependencies are installed:
|
|
1230
|
+
|
|
1231
|
+
```bash
|
|
1232
|
+
yarn add react-native-fs \
|
|
1233
|
+
react-native-image-crop-picker \
|
|
1234
|
+
react-native-image-picker \
|
|
1235
|
+
react-native-svg \
|
|
1236
|
+
expo-modules-core
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
### Expo Projects
|
|
1240
|
+
|
|
1241
|
+
If using Expo, some native modules may not work in Expo Go.
|
|
1242
|
+
Use a development build instead:
|
|
1243
|
+
|
|
1244
|
+
```bash
|
|
1245
|
+
npx expo prebuild
|
|
1246
|
+
npx expo run:ios
|
|
1247
|
+
# or
|
|
1248
|
+
npx expo run:android
|
|
1249
|
+
```
|
|
794
1250
|
|
|
795
1251
|
## License
|
|
796
1252
|
|