Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughIntroduces structured scan results with content and format across JS, iOS, and Android. Updates public types and signatures, adjusts example app rendering, revises docs and changelog, tweaks React Native configs, packaging ignores, and TypeScript settings, and broadens podspec source patterns. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor DevApp as App UI
participant JS as ImageCodeScanner.scan(path, opts)
participant Native as iOS/Android Scanner
participant Vision as Camera/Vision APIs
DevApp->>JS: scan(imagePath, options)
JS->>Native: scanFromPath(path, formats, preprocessing)
Native->>Vision: detect barcodes on images (incl. preprocessed variants)
Vision-->>Native: observations (symbology + payloads)
Native->>Native: map each to {content, format}
Native-->>JS: Promise<ScanResult[]>
JS-->>DevApp: results [{content, format}, ...]
note over Native,JS: Returned type changed from string[] to ScanResult[]
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
CONTRIBUTING.md (1)
112-121: Fix outdated script names.These entries no longer match the usage above and may not exist after removing workspace tooling.
Apply:
-- `yarn example start`: start the Metro server for the example app. -- `yarn example android`: run the example app on Android. -- `yarn example ios`: run the example app on iOS. +- `yarn example`: start the Metro server for the example app. +- `cd example && yarn android`: run the example app on Android. +- `cd example && yarn ios`: run the example app on iOS.
🧹 Nitpick comments (7)
.gitignore (1)
104-116: Yarn cache/state ignores for example: good; consider deduping below.The new
example/.yarn/*and related state entries are correct. There are duplicate ignores further down (e.g.,example/.expo/,example/dist/,example/build/). Optional: remove duplicates to keep the file lean.example/tsconfig.json (1)
15-19: TS path alias: add subpath mapping to avoid future import traps.If any internal subpaths get imported (intentionally or by IDE auto-import), add a wildcard mapping.
Apply:
"paths": { - "react-native-image-code-scanner": ["../src/index"] + "react-native-image-code-scanner": ["../src/index"], + "react-native-image-code-scanner/*": ["../src/*"] }.yarnrc.yml (2)
1-4: Yarn config aligns with portal workflow; lock installs for CI.Consider making installs immutable to catch drift in CI.
Apply:
enableTransparentWorkspaces: false +enableImmutableInstalls: true nmHoistingLimits: none
9-9: Minor consistency nit.The single-quoted spec is fine. If you standardize quoting elsewhere, keep it consistent across plugin specs.
CONTRIBUTING.md (3)
9-13: Clarify wording: Yarn manages the repo; portal links the example.Current phrasing suggests “managed using Yarn Portal.” Portal is the protocol used by the example dependency, not the monorepo manager.
Apply:
-This project is a monorepo managed using **Yarn Portal** for development. It contains the following packages: +This project is managed with **Yarn**. The example app consumes the library via the **Yarn portal:** protocol for local development. It contains:
28-29: Typo: Xcode capitalization.Apply:
-... in XCode and find the source files at `Pods > react-native-image-code-scanner`. +... in Xcode and find the source files at `Pods > react-native-image-code-scanner`.
11-11: Minor grammar around list intro.LanguageTool hint: adjust punctuation for the list.
Apply:
-It contains the following packages: +It contains the following:
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (2)
.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjsis excluded by!**/.yarn/**yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (6)
.gitignore(1 hunks).yarnrc.yml(1 hunks)CONTRIBUTING.md(2 hunks)example/package.json(1 hunks)example/tsconfig.json(1 hunks)package.json(0 hunks)
💤 Files with no reviewable changes (1)
- package.json
🧰 Additional context used
🧬 Code graph analysis (3)
example/tsconfig.json (1)
src/index.tsx (1)
ScanOptions(20-23)
example/package.json (2)
example/App.tsx (1)
App(34-284)example/src/App.tsx (2)
App(36-257)selectedImage(93-130)
CONTRIBUTING.md (1)
example/App.tsx (1)
App(34-284)
🪛 LanguageTool
CONTRIBUTING.md
[grammar] ~11-~11: There might be a mistake here.
Context: ...e library package in the root directory. - An example app in the example/ directo...
(QB_NEW_EN)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: build-ios
🔇 Additional comments (2)
example/package.json (1)
24-24: Verified: library package.json entry points correct. The root package.json definesmainas./lib/module/index.jsandtypesas./lib/typescript/src/index.d.ts, so Metro will load built JS and not TS.example/tsconfig.json (1)
21-22: Sanity-check Metro + TS config.Given
"noEmit": trueand aliasing to source, ensure Metro is resolving the runtime import from the built entry produced by the library (via portal-installed package) while the editor uses types fromsrc. If the lib doesn’t ship built JS locally, you’ll need a build step or a Metro config that transpiles the portal target.
| yarn example | ||
| ``` | ||
|
|
||
| To run the example app on Android: | ||
|
|
||
| ```sh | ||
| yarn example android | ||
| cd example && yarn android | ||
| ``` | ||
|
|
||
| To run the example app on iOS: | ||
|
|
||
| ```sh | ||
| yarn example ios | ||
| cd example && yarn ios | ||
| ``` |
There was a problem hiding this comment.
Command mismatch with scripts section.
You updated usage to yarn example and cd example && yarn android/ios here, but the Scripts list below still references yarn example start/android/ios. Align them.
Apply:
-To start the packager:
+To start the packager:
-```sh
-yarn example
-```
+```sh
+yarn example
+```
-To run the example app on Android:
+To run the example app on Android:
```sh
cd example && yarn android-To run the example app on iOS:
+To run the example app on iOS:
cd example && yarn ios
<details>
<summary>🤖 Prompt for AI Agents</summary>
In CONTRIBUTING.md around lines 37 to 50, the example usage and code-block
formatting were changed to show yarn example and separate cd example && yarn android/ios, but the Scripts section still references yarn example start/android/ios; update the Scripts list to match the new usage and fix the
fenced code blocks so they use proper triple-backtick with sh language tag
around the commands (e.g., wrap yarn example and the platform commands in
consistently show `yarn example` and `cd example && yarn android` / `cd example
&& yarn ios`.|
|
||
| ```sh | ||
| yarn example start | ||
| yarn example |
There was a problem hiding this comment.
Command won’t work: there’s no root “example” script. Use the example app’s start script instead.
Prompt for AI agents
Address the following comment on CONTRIBUTING.md at line 37:
<comment>Command won’t work: there’s no root “example” script. Use the example app’s start script instead.</comment>
<file context>
@@ -34,19 +34,19 @@ You can use various commands from the root directory to work with the project.
```sh
-yarn example start
+yarn example
</file context>
</details>
```suggestion
cd example && yarn start
| It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app. | ||
|
|
||
| If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ImageCodeScannerExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-image-code-scanner`. | ||
| If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ImageCodeScannerExample.xcworkspace` in XCode and find the source files at `Pods > react-native-image-code-scanner`. |
There was a problem hiding this comment.
Incorrect CocoaPods target name in Xcode path; the pod is RNImageCodeScanner, not react-native-image-code-scanner.
Prompt for AI agents
Address the following comment on CONTRIBUTING.md at line 28:
<comment>Incorrect CocoaPods target name in Xcode path; the pod is RNImageCodeScanner, not react-native-image-code-scanner.</comment>
<file context>
@@ -6,26 +6,26 @@ We want this community to be friendly and respectful to each other. Please follo
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
-If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ImageCodeScannerExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-image-code-scanner`.
+If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ImageCodeScannerExample.xcworkspace` in XCode and find the source files at `Pods > react-native-image-code-scanner`.
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-image-code-scanner` under `Android`.
</file context>
| If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ImageCodeScannerExample.xcworkspace` in XCode and find the source files at `Pods > react-native-image-code-scanner`. | |
| If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/ImageCodeScannerExample.xcworkspace` in XCode and find the source files at `Pods > RNImageCodeScanner`. |
| ## Development workflow | ||
|
|
||
| This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages: | ||
| This project is a monorepo managed using **Yarn Portal** for development. It contains the following packages: |
There was a problem hiding this comment.
Wording mischaracterizes the setup: portal: is used by the example app to link the local package, but it doesn’t “manage” the monorepo. Clarify that the example uses Yarn’s portal: protocol for development linkage.
Prompt for AI agents
Address the following comment on CONTRIBUTING.md at line 9:
<comment>Wording mischaracterizes the setup: portal: is used by the example app to link the local package, but it doesn’t “manage” the monorepo. Clarify that the example uses Yarn’s portal: protocol for development linkage.</comment>
<file context>
@@ -6,26 +6,26 @@ We want this community to be friendly and respectful to each other. Please follo
## Development workflow
-This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:
+This project is a monorepo managed using **Yarn Portal** for development. It contains the following packages:
- The library package in the root directory.
</file context>
| This project is a monorepo managed using **Yarn Portal** for development. It contains the following packages: | |
| This project is a monorepo; the example app uses Yarn's portal: protocol to link the local library during development. It contains the following packages: |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (7)
example/App.tsx (4)
254-257: Avoid using array index as a React key.Use a stable composite key to reduce re-render artifacts.
Apply this diff:
- {scanResult.data.map((code, index) => ( - <TouchableOpacity - key={index} + {scanResult.data.map((code, index) => ( + <TouchableOpacity + key={`${code.format}:${code.content}:${index}`}
259-259: Optional UX: copy/open content on tap.Consider copying to clipboard and, if it’s a URL, offering “Open link”.
If desired, I can draft a tiny helper to detect URLs and integrate
Linking+Clipboard.
266-271: Nice format badge.If you want friendlier labels (e.g., “EAN-13”), map enum names to display names before render.
478-490: Dark mode consideration for badges.Colors are hard-coded for light theme; consider using theme tokens to keep contrast in dark mode.
CHANGELOG.md (1)
12-16: Tighten phrasing; avoid “etc.” and call out breaking change.Minor wording tweaks improve clarity and Keep a Changelog style.
Apply this diff:
-- Format detection for all supported barcode types (QR_CODE, CODE_128, EAN_13, etc.) +- Format detection for all supported barcode types (QR_CODE, CODE_128, CODE_39, CODE_93, EAN_13, EAN_8, UPC_A, UPC_E, PDF_417, DATA_MATRIX, AZTEC, ITF, CODABAR, UNKNOWN) @@ -### Changed +### Changed (breaking) @@ -- Better type safety with comprehensive result interface +- Better type safety with a comprehensive result interfaceAlso applies to: 20-24, 27-29
README.md (2)
155-158: Consistent imports across examples.Use named
BarcodeFormateverywhere to avoid mixing APIs.Apply this diff:
-import ImageCodeScanner, { - BarcodeFormat, - ScanResult, -} from 'react-native-image-code-scanner'; +import ImageCodeScanner, { BarcodeFormat, ScanResult } from 'react-native-image-code-scanner'; @@ - results.forEach((result, index) => { + results.forEach((result, index) => { console.log(`Barcode ${index + 1}:`, result.content); console.log(`Format:`, result.format); });Also applies to: 172-176
499-501: Clarify “Platform Support” bullets.These lines read as “gallery only.” Consider clarifying this refers to the example app’s flows, not library limitations.
Example: “Example app: gallery flows on iOS/Android via Image Picker.”
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (16)
.gitignore(1 hunks).npmignore(1 hunks)CHANGELOG.md(1 hunks)README.md(13 hunks)RNImageCodeScanner.podspec(1 hunks)android/src/main/java/com/imagecodescanner/ImageCodeScannerModule.kt(1 hunks)example/App.tsx(4 hunks)example/package.json(1 hunks)example/react-native.config.js(1 hunks)example/src/App.tsx(4 hunks)ios/ImageCodeScanner.swift(1 hunks)package.json(0 hunks)react-native.config.js(0 hunks)src/NativeImageCodeScanner.ts(2 hunks)src/index.tsx(3 hunks)tsconfig.json(1 hunks)
💤 Files with no reviewable changes (2)
- react-native.config.js
- package.json
🚧 Files skipped from review as they are similar to previous changes (11)
- .npmignore
- RNImageCodeScanner.podspec
- ios/ImageCodeScanner.swift
- example/react-native.config.js
- tsconfig.json
- src/index.tsx
- example/package.json
- example/src/App.tsx
- src/NativeImageCodeScanner.ts
- .gitignore
- android/src/main/java/com/imagecodescanner/ImageCodeScannerModule.kt
🧰 Additional context used
🧬 Code graph analysis (1)
example/App.tsx (2)
src/NativeImageCodeScanner.ts (1)
ScanResult(4-7)src/index.tsx (1)
ScanResult(53-53)
🪛 LanguageTool
README.md
[grammar] ~376-~376: There might be a mistake here.
Context: ...s ## 🔄 Migration from v1.0.x to v1.1.0 ### Breaking Changes The main breaking chan...
(QB_NEW_EN)
[grammar] ~499-~499: There might be a mistake here.
Context: ...Support:** - 📱 iOS: Gallery access - 🤖 Android: Gallery access ## 🤝 Co...
(QB_NEW_EN)
[grammar] ~500-~500: There might be a mistake here.
Context: ... access - 🤖 Android: Gallery access ## 🤝 Contributing We welcome contribution...
(QB_NEW_EN)
CHANGELOG.md
[grammar] ~20-~20: There might be a mistake here.
Context: ...now returnsScanResult[]instead ofstring[]` - Updated API to provide more detailed sca...
(QB_NEW_EN)
[grammar] ~21-~21: There might be a mistake here.
Context: ...PI to provide more detailed scan results - Enhanced example app UI to show barcode ...
(QB_NEW_EN)
[grammar] ~22-~22: There might be a mistake here.
Context: ...to show barcode format alongside content - Improved result display with format badg...
(QB_NEW_EN)
[grammar] ~27-~27: There might be a mistake here.
Context: ...badges ### Fixed - Better type safety with comprehensive result interface - Enhanc...
(QB_NEW_EN)
[grammar] ~27-~27: There might be a mistake here.
Context: ...fety with comprehensive result interface - Enhanced debugging capabilities with for...
(QB_NEW_EN)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-android
🔇 Additional comments (6)
example/App.tsx (3)
18-19: Type-only import is correct.Good use of type import to avoid bundling types at runtime.
21-24: State shape update looks good.Wrapping results with timing via
ScanResultWithTimekeeps UI logic tidy.Also applies to: 37-37
107-111: Result assembly and timing capture LGTM.Clear separation of data and timing; resets handled above.
CHANGELOG.md (2)
8-8: Version bump looks correct.Date and semantic versioning align with the stated breaking change.
30-30: Verify the release tag exists before merging.Ensure
v1.1.0is pushed and the release is created so this link doesn’t 404.README.md (1)
309-318: API section update looks accurate.Return type and
ScanResultshape are clear.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
193-194: Quote env values for YAML safety and consistencyQuote to avoid YAML truthiness pitfalls and keep consistency with the prebuild step.
- RCT_NEW_ARCH_ENABLED: 0 - EXPO_USE_HERMES: true + RCT_NEW_ARCH_ENABLED: '0' + EXPO_USE_HERMES: 'true'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.github/workflows/ci.yml(1 hunks)example/package.json(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- example/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build-android
- GitHub Check: build-ios
| - name: Setup iOS Simulator | ||
| if: env.turbo_cache_hit != 1 | ||
| run: | | ||
| # List available simulators | ||
| xcrun simctl list devices available | ||
| # Boot the default simulator | ||
| xcrun simctl boot "iPhone 15" || xcrun simctl boot "iPhone 14" || true | ||
|
|
There was a problem hiding this comment.
🛠️ Refactor suggestion
Make simulator boot robust and wait for readiness
Hard-coding model names is brittle across Xcode/macOS images, and not waiting for boot can cause flakiness. Pick the first available iPhone UDID, boot it, and wait for bootstatus.
- name: Setup iOS Simulator
if: env.turbo_cache_hit != 1
run: |
# List available simulators
xcrun simctl list devices available
- # Boot the default simulator
- xcrun simctl boot "iPhone 15" || xcrun simctl boot "iPhone 14" || true
+ # Pick an available iPhone simulator (prefer newer models), boot it, and wait until it's ready
+ DEVICE_UDID=$(xcrun simctl list devices available | awk -F'[()]' '/iPhone/{print $2}' | head -n1)
+ if [ -n "$DEVICE_UDID" ]; then
+ echo "Booting simulator $DEVICE_UDID..."
+ xcrun simctl boot "$DEVICE_UDID" || true
+ xcrun simctl bootstatus "$DEVICE_UDID" -b || true
+ else
+ echo "No available iPhone simulators found; continuing without boot."
+ fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Setup iOS Simulator | |
| if: env.turbo_cache_hit != 1 | |
| run: | | |
| # List available simulators | |
| xcrun simctl list devices available | |
| # Boot the default simulator | |
| xcrun simctl boot "iPhone 15" || xcrun simctl boot "iPhone 14" || true | |
| - name: Setup iOS Simulator | |
| if: env.turbo_cache_hit != 1 | |
| run: | | |
| # List available simulators | |
| xcrun simctl list devices available | |
| # Pick an available iPhone simulator (prefer newer models), boot it, and wait until it's ready | |
| DEVICE_UDID=$(xcrun simctl list devices available | awk -F'[()]' '/iPhone/{print $2}' | head -n1) | |
| if [ -n "$DEVICE_UDID" ]; then | |
| echo "Booting simulator $DEVICE_UDID..." | |
| xcrun simctl boot "$DEVICE_UDID" || true | |
| xcrun simctl bootstatus "$DEVICE_UDID" -b || true | |
| else | |
| echo "No available iPhone simulators found; continuing without boot." | |
| fi |
🤖 Prompt for AI Agents
.github/workflows/ci.yml around lines 162 to 169: the workflow hard-codes
simulator model names which is brittle and doesn't wait for readiness; update
the step to programmatically select the first available iPhone UDID (parse xcrun
simctl list devices available or the JSON output), attempt to boot that UDID,
then wait for readiness using xcrun simctl bootstatus <UDID> --timeout <secs>
(handle already-booted/present errors gracefully), and fall back to a no-op if
no iPhone devices are available so the job remains non-blocking.
| - name: Clean iOS build artifacts | ||
| if: env.turbo_cache_hit != 1 | ||
| run: | | ||
| cd example | ||
| rm -rf ios | ||
| rm -rf .expo | ||
| yarn expo prebuild --clean --platform ios | ||
|
|
There was a problem hiding this comment.
🛠️ Refactor suggestion
Ensure Hermes/new-arch flags apply to prebuild (not just build)
EXPO_USE_HERMES and RCT_NEW_ARCH_ENABLED influence iOS native generation during expo prebuild. Set them for this step as well to avoid mismatches between generated Pods and later build flags.
- name: Clean iOS build artifacts
if: env.turbo_cache_hit != 1
- run: |
+ env:
+ EXPO_USE_HERMES: 'true'
+ RCT_NEW_ARCH_ENABLED: '0'
+ run: |
cd example
rm -rf ios
rm -rf .expo
yarn expo prebuild --clean --platform ios📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Clean iOS build artifacts | |
| if: env.turbo_cache_hit != 1 | |
| run: | | |
| cd example | |
| rm -rf ios | |
| rm -rf .expo | |
| yarn expo prebuild --clean --platform ios | |
| - name: Clean iOS build artifacts | |
| if: env.turbo_cache_hit != 1 | |
| env: | |
| EXPO_USE_HERMES: 'true' | |
| RCT_NEW_ARCH_ENABLED: '0' | |
| run: | | |
| cd example | |
| rm -rf ios | |
| rm -rf .expo | |
| yarn expo prebuild --clean --platform ios |
🤖 Prompt for AI Agents
In .github/workflows/ci.yml around lines 170 to 177, the prebuild step for iOS
doesn't apply EXPO_USE_HERMES and RCT_NEW_ARCH_ENABLED, which can cause
pods/native code to be generated with different settings than the later build;
update that step to set those environment variables for the prebuild (either via
an env: mapping on the step or by prefixing the prebuild command with the
workflow env values such as using the same env variables used elsewhere) so expo
prebuild runs with EXPO_USE_HERMES and RCT_NEW_ARCH_ENABLED matching the build
flags.
| - name: Fix ReactAppDependencyProvider issue | ||
| if: env.turbo_cache_hit != 1 | ||
| run: | | ||
| cd example/ios | ||
| # Workaround for ReactAppDependencyProvider missing in Expo SDK 52 + React Native 0.76+ | ||
| echo "Applying ReactAppDependencyProvider workaround..." | ||
| # Create a temporary Podfile with the fix | ||
| cp Podfile Podfile.backup | ||
| # Add the missing dependency after use_expo_modules | ||
| awk '/use_expo_modules/ { print; print " pod \"ReactAppDependencyProvider\", :path => \"../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios\""; next } 1' Podfile.backup > Podfile | ||
| pod install --repo-update | ||
|
|
There was a problem hiding this comment.
🛠️ Refactor suggestion
Guard Podfile patch with idempotency and existence checks
Make the workaround safe when RN/Expo fixes this upstream or the path changes. Skip insertion if the Pod is already present and only patch when the podspec exists.
- name: Fix ReactAppDependencyProvider issue
if: env.turbo_cache_hit != 1
run: |
cd example/ios
# Workaround for ReactAppDependencyProvider missing in Expo SDK 52 + React Native 0.76+
echo "Applying ReactAppDependencyProvider workaround..."
# Create a temporary Podfile with the fix
cp Podfile Podfile.backup
# Add the missing dependency after use_expo_modules
- awk '/use_expo_modules/ { print; print " pod \"ReactAppDependencyProvider\", :path => \"../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios\""; next } 1' Podfile.backup > Podfile
+ POD_PATH="../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactAppDependencyProvider.podspec"
+ if grep -q 'ReactAppDependencyProvider' Podfile.backup; then
+ echo "Pod already present; skipping patch."
+ cp Podfile.backup Podfile
+ elif [ -f "$POD_PATH" ]; then
+ awk '/use_expo_modules/ { print; print " pod \"ReactAppDependencyProvider\", :path => \"../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios\""; next } 1' Podfile.backup > Podfile
+ else
+ echo "Podspec not found at $POD_PATH; skipping patch to avoid breaking Pod install."
+ cp Podfile.backup Podfile
+ fi
pod install --repo-updateAdditionally, consider caching CocoaPods to speed up CI:
- paths: ~/.cocoapods, example/ios/Pods, example/ios/Podfile.lock
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Fix ReactAppDependencyProvider issue | |
| if: env.turbo_cache_hit != 1 | |
| run: | | |
| cd example/ios | |
| # Workaround for ReactAppDependencyProvider missing in Expo SDK 52 + React Native 0.76+ | |
| echo "Applying ReactAppDependencyProvider workaround..." | |
| # Create a temporary Podfile with the fix | |
| cp Podfile Podfile.backup | |
| # Add the missing dependency after use_expo_modules | |
| awk '/use_expo_modules/ { print; print " pod \"ReactAppDependencyProvider\", :path => \"../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios\""; next } 1' Podfile.backup > Podfile | |
| pod install --repo-update | |
| - name: Fix ReactAppDependencyProvider issue | |
| if: env.turbo_cache_hit != 1 | |
| run: | | |
| cd example/ios | |
| # Workaround for ReactAppDependencyProvider missing in Expo SDK 52 + React Native 0.76+ | |
| echo "Applying ReactAppDependencyProvider workaround..." | |
| # Create a temporary Podfile with the fix | |
| cp Podfile Podfile.backup | |
| # Add the missing dependency after use_expo_modules | |
| POD_PATH="../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactAppDependencyProvider.podspec" | |
| if grep -q 'ReactAppDependencyProvider' Podfile.backup; then | |
| echo "Pod already present; skipping patch." | |
| cp Podfile.backup Podfile | |
| elif [ -f "$POD_PATH" ]; then | |
| awk '/use_expo_modules/ { print; print " pod \"ReactAppDependencyProvider\", :path => \"../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios\""; next } 1' Podfile.backup > Podfile | |
| else | |
| echo "Podspec not found at $POD_PATH; skipping patch to avoid breaking Pod install." | |
| cp Podfile.backup Podfile | |
| fi | |
| pod install --repo-update |
🤖 Prompt for AI Agents
.github/workflows/ci.yml around lines 178 to 189: the current Podfile patch
blindly inserts the ReactAppDependencyProvider pod which can create duplicates
or fail if upstream fixes or the podspec path changes; update the workflow to
first check whether the Podfile already contains the pod and skip patching if
present, verify that the target podspec path
(../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios
or equivalent) exists before attempting to patch, perform the backup-and-rewrite
only when both checks pass to ensure idempotency, and add CocoaPods cache
entries (e.g., ~/.cocoapods, example/ios/Pods, example/ios/Podfile.lock) to the
job's cache configuration to speed up CI.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
example/tsconfig.json (2)
18-19: Exclude common build artifacts to reduce TS server churn.Not required, but helps editor perf in larger examples.
Apply:
- "exclude": ["node_modules"] + "exclude": ["node_modules", "dist", "build", "coverage"]
15-16: No tsconfig.json changes required; RN moduleSuffixes optionalReact 18.3.1 supports
"react-jsx". No.native,.ios, or.androidfiles were found, so addingmoduleSuffixeswon’t affect resolution until platform-specific files exist. Optional RN tweaks:"jsx": "react-jsx", "baseUrl": ".", + "moduleSuffixes": [".native", ".ios", ".android", ""], + "types": ["react", "react-native"]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
RNImageCodeScanner.podspec(1 hunks)example/package.json(1 hunks)example/tsconfig.json(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- RNImageCodeScanner.podspec
- example/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build-android
- GitHub Check: build-ios
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (3)
README.md (3)
196-196: Use named BarcodeFormat in examples (consistency with other snippets).Replace
ImageCodeScanner.BarcodeFormatwith the namedBarcodeFormatimport.Apply:
-import ImageCodeScanner, { ScanResult } from 'react-native-image-code-scanner'; +import ImageCodeScanner, { BarcodeFormat, ScanResult } from 'react-native-image-code-scanner'; @@ - const scanResults: ScanResult[] = await ImageCodeScanner.scan({ + const scanResults: ScanResult[] = await ImageCodeScanner.scan({ path: imagePath, - formats: [ImageCodeScanner.BarcodeFormat.QR_CODE], + formats: [BarcodeFormat.QR_CODE], // Automatic preprocessing is enabled by default });Also applies to: 208-213, 215-218
227-227: Same: prefer named BarcodeFormat for Expo Image Picker snippet.Keep imports/styles consistent with prior sections.
Apply:
-import ImageCodeScanner, { ScanResult } from 'react-native-image-code-scanner'; +import ImageCodeScanner, { BarcodeFormat, ScanResult } from 'react-native-image-code-scanner'; @@ - const scanResults: ScanResult[] = await ImageCodeScanner.scan({ + const scanResults: ScanResult[] = await ImageCodeScanner.scan({ path: imagePath, - formats: [ImageCodeScanner.BarcodeFormat.QR_CODE], + formats: [BarcodeFormat.QR_CODE], // Automatic preprocessing is enabled by default });Also applies to: 240-244, 247-250
265-277: Type fix: Object.values(BarcodeFormat) is string[].Cast or export a typed constant; otherwise this fails under strict TS.
Apply:
- const results: ScanResult[] = await ImageCodeScanner.scan({ + const results: ScanResult[] = await ImageCodeScanner.scan({ path: imagePath, - formats: Object.values(BarcodeFormat), // All supported formats + // All supported formats + formats: Object.values(BarcodeFormat) as BarcodeFormat[], // Automatic preprocessing is enabled by default });Alternatively, export
ALL_FORMATS: readonly BarcodeFormat[]from the lib and reference it here.
🧹 Nitpick comments (10)
.gitignore (1)
106-110: Redundant ignores; clarify PnP/Zero‑Installs intent.
- Lines 106–109 are already covered by
example/.yarn/*(since only the negated subfolders are re-included). They’re harmless but redundant.- Ignoring
example/.pnp.*is fine if you’re not doing Zero‑Installs. If you plan Zero‑Installs, you should commit.pnp.cjsand the cache instead.Option A — trim redundancy:
-example/.yarn/cache -example/.yarn/unplugged -example/.yarn/build-state.yml -example/.yarn/install-state.gzOption B — Zero‑Installs (if desired):
example/.yarn/* !example/.yarn/patches !example/.yarn/plugins !example/.yarn/releases !example/.yarn/sdks !example/.yarn/versions +!example/.yarn/cache - example/.pnp.* +!example/.pnp.cjsPlease confirm whether the example app is intended to use Zero‑Installs; I can adjust the snippet accordingly.
CHANGELOG.md (1)
20-23: Add a short migration snippet.Help users update in seconds.
Example addition:
### Changed - **Breaking Change**: `ImageCodeScanner.scan()` now returns `ScanResult[]` instead of `string[]` - Updated API to provide more detailed scan results - Enhanced example app UI to show barcode format alongside content - Improved result display with format badges + +#### Migration +Before: +```ts +const codes = await ImageCodeScanner.scan({ path }); +codes.forEach(code => console.log(code)); // string +``` +After: +```ts +const results = await ImageCodeScanner.scan({ path }); +results.forEach(r => console.log(r.content, r.format)); // ScanResult +```example/src/App.tsx (2)
22-26: Drop or populate unused fieldpreprocessingUsed.It’s declared but never set/read.
Option A — remove:
-interface ScanResultWithTime { - data: ScanResult[]; - time: number; - preprocessingUsed?: string; -} +interface ScanResultWithTime { + data: ScanResult[]; + time: number; +}Option B — set it when storing results (outside this hunk):
setScanResult({ data: results, time: scanTime, preprocessingUsed: 'auto', });
28-35: Consider exposing the full supported format list in the example UI.Docs/changelog say “all supported types,” but the demo only toggles a subset. Add AZTEC, ITF, CODABAR, EAN_8, UPC_A, UPC_E, CODE_93 for parity.
example/App.tsx (3)
21-24: Keep wrapper type consistent across both example apps.example/src includes an optional
preprocessingUsed; this file doesn’t. Pick one convention for both (either add here or remove there).Apply here if you want parity:
interface ScanResultWithTime { data: ScanResult[]; time: number; + preprocessingUsed?: string; }
259-260: Alert may truncate long payloads; offer copy to clipboard.Optional: add a long-press or secondary action to copy
code.content.Example:
onLongPress={() => { Clipboard.setString(code.content); Alert.alert('Copied to clipboard'); }}
53-58: Minor: unifyallowsEditingacross example apps.This file uses
allowsEditing: falsewhile example/src usestrue. Cropping can reduce scan success; defaulting both tofalseis safer.Also applies to: 75-79
README.md (3)
309-318: Make ScanResult.format typed as BarcodeFormat (not string).Improves type safety and aligns with enum usage elsewhere.
Apply:
-interface ScanResult { - content: string; // The decoded barcode content - format: string; // The detected barcode format (e.g., "QR_CODE", "EAN_13") -} +interface ScanResult { + content: string; // The decoded barcode content + format: BarcodeFormat; // The detected barcode format (e.g., BarcodeFormat.QR_CODE) +}Please confirm the public type exported by the package matches this.
425-426: Platform support text likely incomplete.Earlier you mention camera and gallery; this lists gallery only. Align for clarity.
Apply:
-- 📱 **iOS**: Gallery access -- 🤖 **Android**: Gallery access +- 📱 **iOS**: Camera and gallery access +- 🤖 **Android**: Camera and gallery access
442-442: Link the license text.Small UX improvement.
Apply:
-MIT +[MIT](LICENSE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (17)
.gitignore(1 hunks).npmignore(1 hunks)CHANGELOG.md(1 hunks)README.md(11 hunks)RNImageCodeScanner.podspec(1 hunks)android/src/main/java/com/imagecodescanner/ImageCodeScannerModule.kt(1 hunks)example/App.tsx(4 hunks)example/package.json(1 hunks)example/react-native.config.js(1 hunks)example/src/App.tsx(4 hunks)example/tsconfig.json(1 hunks)ios/ImageCodeScanner.swift(1 hunks)package.json(0 hunks)react-native.config.js(0 hunks)src/NativeImageCodeScanner.ts(2 hunks)src/index.tsx(3 hunks)tsconfig.json(1 hunks)
💤 Files with no reviewable changes (2)
- package.json
- react-native.config.js
🚧 Files skipped from review as they are similar to previous changes (10)
- tsconfig.json
- RNImageCodeScanner.podspec
- example/tsconfig.json
- src/NativeImageCodeScanner.ts
- .npmignore
- example/package.json
- ios/ImageCodeScanner.swift
- src/index.tsx
- android/src/main/java/com/imagecodescanner/ImageCodeScannerModule.kt
- example/react-native.config.js
🧰 Additional context used
🧬 Code graph analysis (2)
example/src/App.tsx (2)
src/NativeImageCodeScanner.ts (1)
ScanResult(4-7)src/index.tsx (1)
ScanResult(53-53)
example/App.tsx (2)
src/NativeImageCodeScanner.ts (1)
ScanResult(4-7)src/index.tsx (1)
ScanResult(53-53)
🪛 LanguageTool
README.md
[grammar] ~425-~425: There might be a mistake here.
Context: ...Support:** - 📱 iOS: Gallery access - 🤖 Android: Gallery access ## 🤝 Co...
(QB_NEW_EN)
[grammar] ~426-~426: There might be a mistake here.
Context: ... access - 🤖 Android: Gallery access ## 🤝 Contributing We welcome contribution...
(QB_NEW_EN)
CHANGELOG.md
[grammar] ~20-~20: There might be a mistake here.
Context: ...now returnsScanResult[]instead ofstring[]` - Updated API to provide more detailed sca...
(QB_NEW_EN)
[grammar] ~21-~21: There might be a mistake here.
Context: ...PI to provide more detailed scan results - Enhanced example app UI to show barcode ...
(QB_NEW_EN)
[grammar] ~22-~22: There might be a mistake here.
Context: ...to show barcode format alongside content - Improved result display with format badg...
(QB_NEW_EN)
[grammar] ~27-~27: There might be a mistake here.
Context: ...badges ### Fixed - Better type safety with comprehensive result interface - Enhanc...
(QB_NEW_EN)
[grammar] ~27-~27: There might be a mistake here.
Context: ...fety with comprehensive result interface - Enhanced debugging capabilities with for...
(QB_NEW_EN)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build-android
- GitHub Check: build-ios
🔇 Additional comments (6)
.gitignore (1)
99-105: Yarn Berry block for example app looks correct.The scoped ignore with negations mirrors Yarn’s recommended setup and aligns with the root-level block. Good call keeping patches/plugins/releases/sdks/versions tracked.
example/src/App.tsx (1)
17-18: LGTM on type import, state shape, and result rendering/badge.Matches the new ScanResult API and renders clearly.
Also applies to: 39-39, 246-248, 378-388
example/App.tsx (2)
18-19: LGTM on adopting structured results and format badge UI.Clean integration with ScanResult and clear UX.
Also applies to: 37-37, 266-271, 478-490
99-103: Android URI nuance: confirmcontent://is supported by scan(path).Expo ImagePicker may return
content://on Android. If the native module expects a filesystem path, convert/copy to a file URI before scanning.Optional helper (outside this hunk):
import * as FileSystem from 'expo-file-system'; async function ensureFileUri(uri: string) { if (uri.startsWith('content://')) { const dest = FileSystem.cacheDirectory + 'scan.jpg'; await FileSystem.copyAsync({ from: uri, to: dest }); return dest; } return uri; }README.md (2)
130-143: Basic usage snippet looks good.Types and result handling are clear and accurate.
157-158: Advanced usage reads well.Correct imports, types, and per-result logging.
Also applies to: 162-162, 172-175
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [1.0.0] - 2025-08-28 | ||
| ## [1.1.0] - 2025-09-05 |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Breaking change requires a major version bump (SemVer).
You’re changing the return type of a public API; that’s an incompatible change. Bump to 2.0.0 (or make the change backward‑compatible and keep 1.1.0).
Apply:
-## [1.1.0] - 2025-09-05
+## [2.0.0] - 2025-09-05
@@
-- **Breaking Change**: `ImageCodeScanner.scan()` now returns `ScanResult[]` instead of `string[]`
+- **Breaking Change**: `ImageCodeScanner.scan()` now returns `ScanResult[]` instead of `string[]`And update the release link below accordingly:
-[1.1.0]: https://github.com/nguyenthanhan/react-native-image-code-scanner/releases/tag/v1.1.0
+[2.0.0]: https://github.com/nguyenthanhan/react-native-image-code-scanner/releases/tag/v2.0.0Also applies to: 20-20
🤖 Prompt for AI Agents
In CHANGELOG.md around line 8, the release entry incorrectly uses 1.1.0 despite
a breaking public API change; update the version to 2.0.0 and adjust any release
links referenced below to point to the 2.0.0 tag/compare URL (and mirror the
same change wherever else this changelog entry is duplicated, per "Also applies
to: 20-20"). Ensure the header reads "## [2.0.0] - 2025-09-05" and update the
release link section at the bottom to reference 2.0.0.
| [1.1.0]: https://github.com/nguyenthanhan/react-native-image-code-scanner/releases/tag/v1.1.0 | ||
|
|
||
| - Lightweight and performant native implementation | ||
| - **Automatic preprocessing** enabled by default for best results | ||
| - Smart retry logic with multiple image enhancement techniques | ||
| - No additional setup required for Android | ||
| - Minimal iOS setup with just pod install | ||
| - **Expo integration** with proper prebuild workflow | ||
| - **Modern example app** using Expo Image Picker and StatusBar | ||
| - **Simplified API** - just pass image path and formats | ||
| - **Performance metrics** and timing measurements | ||
|
|
||
| ### Example App Features | ||
|
|
||
| - Modern Expo-based example application | ||
| - Barcode format selection UI with real-time toggles | ||
| - Automatic preprocessing info with optional disable switch | ||
| - Improved error handling and user feedback | ||
| - Comprehensive setup documentation | ||
| - Support for both Expo Go (UI testing) and prebuild (full functionality) | ||
| - Cross-platform compatibility (iOS, Android, Web) | ||
| - Performance timing and metrics display | ||
|
|
||
| [1.0.0]: https://github.com/nguyenthanhan/react-native-image-code-scanner/releases/tag/v1.0.0 | ||
| _This changelog will be updated with each new release to document all changes, improvements, and new features._ |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify release link/tag exists before merging.
If you adopt 2.0.0, update the link; otherwise keep 1.1.0 and drop “Breaking.” Quick check:
🏁 Script executed:
#!/bin/bash
# Verify GitHub release tag and npm version alignment
gh release view v2.0.0 || gh release view v1.1.0
npm view react-native-image-code-scanner versionLength of output: 284
🏁 Script executed:
#!/bin/bash
# Check for GitHub release tags via GitHub API
for tag in v1.1.0 v2.0.0; do
status=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/nguyenthanhan/react-native-image-code-scanner/releases/tags/$tag)
echo "$tag: HTTP $status"
done
# Confirm published npm version
npm view react-native-image-code-scanner versionLength of output: 498
Ensure GitHub release and npm package for v1.1.0 exist before merging.
Changelog link [1.1.0] points to a non-existent GitHub tag (HTTP 404) and npm shows latest version 1.0.0. Publish the v1.1.0 release (and bump npm) or adjust the changelog to reference an existing version.
🤖 Prompt for AI Agents
CHANGELOG.md around lines 30-32: the [1.1.0] release link points to a missing
GitHub tag and npm still shows 1.0.0; either create and push the v1.1.0 GitHub
release/tag and publish the v1.1.0 package to npm so the link and version are
valid, or update the changelog to reference an existing published version (e.g.,
change link and label to v1.0.0 or remove the unreleased entry) and keep
changelog and package version consistent before merging.
This PR updates badges and improves the npm publish workflow for safer, more deterministic releases.
Summary
README
GitHub Actions: publish.yml
release: publishedtrigger to avoid duplicate publishes (tag push already triggers)npm publish --provenanceWhy
Let me know if you want any additional tweaks (e.g., enforcing conventional commit messages in release notes or adding prerelease channel automation).
Summary by cubic
Simplified local development by removing Yarn workspaces tooling, switching the example app to portal linking, and tightening Yarn config for predictable installs.
Refactors
Migration
Summary by CodeRabbit
New Features
Documentation
Chores