Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

### React Native Versions

| React Native | Package Version | Architecture Support | Notes |
| ------------ | --------------- | ------------------------------ | ------------------------- |
| 0.70.x | ✅ 1.1.x | Old Architecture | Full support |
| 0.71.x | ✅ 1.1.x | Old Architecture | Full support |
| 0.72.x | ✅ 1.1.x | Old Architecture | Full support |
| 0.73.x | ✅ 1.1.x | Old & New Architecture | Full support |
| 0.74.x | ✅ 1.1.x | Old & New Architecture | Full support |
| 0.75.x | ✅ 1.1.x | Old & New Architecture | Full support |
| 0.76.x | ✅ 1.1.x | New Architecture (default) | Full support |
| 0.77.x | ✅ 1.1.x | New Architecture (default) | Full support |
| 0.78.x | ✅ 1.1.x | New Architecture (default) | Full support |
| **0.79.x** | ✅ **1.1.x** | **New Architecture (default)** | **Latest - Full support** |
| 0.80.x+ | 🔜 1.1.x | New Architecture | Ready when released |
| React Native | Package Version | Architecture Support | Notes |
| ------------ | --------------- | ------------------------------ | --------------------- |
| 0.70.x | ✅ 1.1.x | Old Architecture | Full support |
| 0.71.x | ✅ 1.1.x | Old Architecture | Full support |
| 0.72.x | ✅ 1.1.x | Old Architecture | Full support |
| 0.73.x | ✅ 1.1.x | Old & New Architecture | Full support |
| 0.74.x | ✅ 1.1.x | Old & New Architecture | Full support |
| 0.75.x | ✅ 1.1.x | Old & New Architecture | Full support |
| 0.76.x | ✅ 1.1.x | New Architecture (default) | Full support |
| 0.77.x | ✅ 1.1.x | New Architecture (default) | Full support |
| 0.78.x | ✅ 1.1.x | New Architecture (default) | Full support |
| **0.79.x** | ✅ **1.1.x** | **New Architecture (default)** | **Full support** |
| 0.80.x+ | 🔜 1.1.x | New Architecture | Compatibility pending |
Comment thread
coderabbitai[bot] marked this conversation as resolved.

### React Versions

Expand All @@ -28,12 +28,12 @@

### Expo SDK Compatibility

| Expo SDK | React Native | Package Version | Status |
| ---------- | ------------ | --------------- | --------------------------------------------- |
| SDK 49 | 0.72.x | ✅ 1.1.x | Supported (requires prebuild) |
| SDK 50 | 0.73.x | ✅ 1.1.x | Supported (requires prebuild) |
| SDK 51 | 0.74.x | ✅ 1.1.x | Supported (requires prebuild) |
| **SDK 52** | **0.79.x** | ✅ **1.1.x** | **Latest - Full support (requires prebuild)** |
| Expo SDK | React Native | Package Version | Status |
| ---------- | ------------ | --------------- | -------------------------------------------- |
| SDK 49 | 0.72.x | ✅ 1.1.x | Supported (requires prebuild) |
| SDK 50 | 0.73.x | ✅ 1.1.x | Supported (requires prebuild) |
| SDK 51 | 0.74.x | ✅ 1.1.x | Supported (requires prebuild) |
| **SDK 52** | **0.76.x** | ✅ **1.1.x** | **Example app baseline (requires prebuild)** |

**Note**: This library requires prebuild for Expo projects as it uses native modules.

Expand All @@ -52,9 +52,9 @@

### Android Requirements

- **Minimum SDK**: 21 (Android 5.0 Lollipop)
- **Target SDK**: 33+ (Android 13+)
- **Compile SDK**: 33+
- **Minimum SDK**: 24 (Android 7.0 Nougat)
- **Target SDK**: 34+ (Android 14+)
- **Compile SDK**: 35+
- **Kotlin**: 1.6.0+
- **Gradle**: 7.0+
- **Android Gradle Plugin**: 7.0+
Expand Down Expand Up @@ -142,7 +142,7 @@ If you're upgrading from React Native 0.6x:

3. Update iOS deployment target to 13.4 or higher

4. Update Android minSdkVersion to 21 or higher
4. Update Android minSdkVersion to 24 or higher

### From Old to New Architecture

Expand Down
67 changes: 59 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Scan QR codes and barcodes from local image files in React Native (iOS Vision +

## Requirements

- React Native `>=0.70.0`, React `>=17.0.0`, Node `>=18`
- iOS `13.4+`, Android `minSdkVersion 21+`
- React Native `>=0.70.0` (validated through `0.79.x`; `0.80.x+` compatibility is pending), React `>=17.0.0`, Node `>=18`
- iOS `13.4+`, Android `minSdkVersion 24+`

## Installation

Expand All @@ -45,7 +45,7 @@ npx expo run:ios # or: npx expo run:android
### React Native CLI

```bash
npm install react-native-image-code-scanner
yarn add react-native-image-code-scanner
cd ios && pod install
```

Expand All @@ -58,11 +58,18 @@ If your app picks images from camera, add to `Info.plist`:

## Usage

Works with any image picker — pass the local file URI to `scan()`:
Works with image pickers that return a supported local path or URI:

- Android: local file paths, `file://` URIs, and resolver-backed `content://` URIs.
- iOS: local file paths and `file://` URIs, including percent-encoded paths.

Schemes such as `ph://`, `assets-library://`, remote URLs, and other provider-specific values are not guaranteed to work.

```ts
import * as ImagePicker from 'expo-image-picker';
import ImageCodeScanner, { BarcodeFormat } from 'react-native-image-code-scanner';
import ImageCodeScanner, {
BarcodeFormat,
} from 'react-native-image-code-scanner';

async function pickAndScan() {
const picked = await ImagePicker.launchImageLibraryAsync({
Expand All @@ -82,7 +89,7 @@ async function pickAndScan() {
}
```

Also compatible with `react-native-image-picker` and other pickers that return a local URI.
Also compatible with `react-native-image-picker` and other pickers when they return one of the supported values above.

## API

Expand All @@ -92,6 +99,9 @@ ImageCodeScanner.scan(options: ScanOptions): Promise<ScanResult[]>
interface ScanOptions {
path: string;
formats?: BarcodeFormat[]; // default: [QR_CODE]
enhanceContrast?: boolean; // default: true
convertToGrayscale?: boolean; // default: true
tryRotations?: boolean; // default: true
}

interface ScanResult {
Expand All @@ -104,7 +114,8 @@ interface ScanResult {

**Supported formats:** `QR_CODE`, `CODE_128`, `CODE_39`, `CODE_93`, `EAN_13`, `EAN_8`, `UPC_A`, `UPC_E`, `PDF_417`, `DATA_MATRIX`, `AZTEC`, `ITF`, `CODABAR`

Preprocessing runs automatically: original → grayscale → contrast enhancement → rotation retries.
Preprocessing runs automatically by default: original → grayscale → contrast enhancement → rotation retries.
Set `enhanceContrast`, `convertToGrayscale`, or `tryRotations` to `false` to skip those retry passes.

## Tips

Expand All @@ -116,13 +127,53 @@ Preprocessing runs automatically: original → grayscale → contrast enhancemen

- **No result:** check image quality/resolution, limit `formats`, crop closer to the barcode.
- **iOS build:** `cd ios && pod install`; deployment target `13.4+`.
- **Android build:** `cd android && ./gradlew clean`; `minSdkVersion >= 21`.
- **Android build:** `cd android && ./gradlew clean`; `minSdkVersion >= 24`.
- **Expo:** requires prebuild; not supported in Expo Go.

## Example App

See [example app](./example) and [example README](./example/README.md).

## Publishing to npm

1. Run checks:

```bash
yarn typecheck
yarn lint
yarn test
yarn build
```

2. Create a release:

```bash
yarn release
```

This bumps the version and creates a `vX.Y.Z` tag.

3. Push the release commit and tag:

```bash
git push && git push --tags
```

GitHub Actions publishes to npm automatically after CI passes for the release tag.

Verify the published version:

```bash
npm view react-native-image-code-scanner version
```

For a beta release:

```bash
yarn release:beta
git push && git push --tags
```

## Contributing

Please read [CONTRIBUTING.md](CONTRIBUTING.md).
Expand Down
Loading
Loading