Skip to content

fix: Android 3-digit hex + iOS UPC-A, repair toolchain, replace CI - #20

Merged
vittoridavide merged 9 commits into
masterfrom
chore/toolchain-and-hex-fix
Aug 20, 2026
Merged

vittoridavide merged 9 commits into
masterfrom
chore/toolchain-and-hex-fix

Conversation

@vittoridavide

Copy link
Copy Markdown
Owner

What

Repairs a broken dev toolchain, fixes one Android rendering bug, and replaces a CI pipeline that could not run.

fix: 3-digit hex colors on Android

BarcodeView.handleColor expanded #RGB by concatenating the digits rather than doubling them, so #0AF became #0AF0AF instead of #00AAFF. iOS already expanded correctly, so the two platforms disagreed on every shorthand color.

Verified on a physical device (Huawei JNY-LX1, RN 0.83): two QR codes rendered side by side with #0AF and #00AAFF now sample to identical pixels.

chore: toolchain repair

  • babel.config.js referenced metro-react-native-babel-preset, replaced by @react-native/babel-preset in RN 0.73 and no longer installed. Jest could not transform anything and ESLint failed to parse any file it read through Babel.
  • typecheck now runs against tsconfig.build.json. The root config also pulls in example/, whose @/* aliases are invisible from the root and whose react-native@0.83.2 collides with the root's 0.73.2 — both declare the same ambient codegenNativeComponent module with incompatible HostComponent<P> definitions.
  • Dropped @types/react-native (obsolete since RN 0.71 ships its own types) and the resolutions pin holding @types/react at 17, which was also forcing 17 onto the example app that needs 19.
  • Stopped linting Expo's generated, gitignored expo-env.d.ts.

ci: CircleCI → GitHub Actions

The CircleCI config ran circleci/node:10 against a package requiring Node >= 18 and pinning Yarn 3.6.1, with Yarn v1 install flags that Yarn 3 rejects. It also invoked yarn typescript, a script that no longer exists.

style: / docs:

Prettier formatting across src/ and example/, and a new CLAUDE.md.

Checks

yarn lint, yarn typecheck, yarn test, and yarn prepare all pass locally.

Notes

  • yarn lint still emits 35 warnings, all in example/ — 34 are react/react-in-jsx-scope false positives from @react-native/eslint-config@0.72.2 predating the automatic JSX runtime. Warnings only; lint exits 0.
  • yarn test runs a single it.todo placeholder. There is no real coverage yet.
  • Running on RN 0.83 surfaced a deprecation warning for the deep import in src/BarcodeCreatorNativeComponent.ts; not addressed here.

The CircleCI config ran circleci/node:10 while package.json requires
Node >= 18 and pins Yarn 3.6.1, and its install step used Yarn v1 flags
(--cwd, --frozen-lockfile) that Yarn 3 rejects, so the pipeline could
not run at all.
The file is gitignored and regenerated without a trailing newline on
every `expo start`/`expo run`, which reintroduced a prettier/prettier
error after each run of the example app.
checkSum() weighted digits from the left (x1, x3, x1, ...), which is the
EAN-13 rule. Applied to a 12-digit UPC-A the weights land on the wrong
parity, so every valid code failed validation, drawOutputImage() returned
nil and the view stayed blank. drawUPCA() was correct and simply never
reached.

The check digit is always rightmost and always counts x1, so anchoring
the alternation there is correct for both lengths. Verified on the
simulator: the UPC-A sample region went from 100% background to a real
barcode, with EAN-13 unchanged.
@vittoridavide

Copy link
Copy Markdown
Owner Author

Added: iOS UPC-A fix

Running the example on an iOS simulator (first iOS build in this branch) surfaced a second, pre-existing bug: UPC-A rendered nothing on iOS, while Android rendered it fine.

CIEANBarcodeGenerator.checkSum() weighted digits from the left — x1, x3, x1, … — which is the EAN-13 rule. On a 12-digit UPC-A the weights land on the wrong parity, so validation failed, drawOutputImage() returned nil, and the view stayed blank. drawUPCA() was correct and simply never reached.

For the example's own 036000291452:

as written (EAN-13 weighting):  8  -> rejected
correct UPC-A weighting:        0  -> valid

The check digit is always rightmost and always counts x1, so anchoring the alternation there is correct for both lengths.

Verified on iPhone 17 Pro simulator, sampling the UPC-A cell:

before after
UPC-A 100% background (blank) 47.1% black / 46.5% white
EAN-13 rendering still rendering

Also verified on both platforms that #0AF and #00AAFF now produce identical pixels, which was the point of the Android fix.

Known remaining divergence (not addressed here)

iOS requires exactly 12 digits with a valid check digit for UPC-A (13 for EAN-13). Android accepts ^\d{11,12}$ / ^\d{12,13}$ and lets ZXing compute the check digit. So an 11-digit UPC-A still renders on Android and stays blank on iOS. That is a design decision rather than a bug, and is left for a follow-up.

@vittoridavide vittoridavide changed the title chore: repair toolchain, fix Android 3-digit hex, replace CI fix: Android 3-digit hex + iOS UPC-A, repair toolchain, replace CI Aug 18, 2026
The license badge pointed at github.com/nicovitt, an unrelated account.
Keywords listed only the platforms, so npm searches for barcode, qrcode,
pdf417 and the rest never surfaced the package.
@vittoridavide
vittoridavide merged commit 8b2cc6b into master Aug 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant