Skip to content

Fix: nitro-modules 0.33+ compatibility + Xcode 26 workaround#318

Merged
robertherber merged 2 commits intokingstinct:masterfrom
AlshehriAli0:fix/nitro-modules-0.33-compat
Feb 24, 2026
Merged

Fix: nitro-modules 0.33+ compatibility + Xcode 26 workaround#318
robertherber merged 2 commits intokingstinct:masterfrom
AlshehriAli0:fix/nitro-modules-0.33-compat

Conversation

@AlshehriAli0
Copy link
Contributor

@AlshehriAli0 AlshehriAli0 commented Feb 24, 2026

Summary

Continuation of #303 and #305, I use this package and need to upgrade nitro modules for compatibility with other packages (e.g. react-native-mmkv@4.x), but the current <0.33 peer dep is blocking.

nitro-modules 0.33 migration

  • isBigInt/getBigIntisInt64/getInt64 in QuantityTypeModule.swift
  • Struct initializers updated to use explicit constructors (nitro 0.33 generates non-mutable structs)
  • readonly removed from array properties in TS types (nitro 0.33 maps these differently)
  • Peer dep bumped to >=0.33

Xcode 26 / Swift 6.2 workaround (fix-codegen script)

nitrogen's codegen emits Bool(fromCxx: cachedCxxPart) in every *Spec_cxx.swift file. This requires std::shared_ptr to conform to Swift's CxxConvertibleToBool protocol. In Swift 6.2 (Xcode 26), shared_ptr no longer gets this conformance autically, causing build failures in all 12 generated spec files.

The workaround: A fix-codegen script (runs automatically after bun codegen) replaces Bool(fromCxx: cachedCxxPart) with cachedCxxPart.use_count() > 0. it's functionally equivalent.

This is a temporary solution until nitrogen fixes the codegen template upstream (the pattern was introduced in nitro v0.31.3 via mrousavy/nitro#996).

Test plan

  • bun typecheck passes
  • bun lint passes
  • bun run build-sim succeeds
  • App launches on iOS Simulator

Fixes #302

@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

🦋 Changeset detected

Latest commit: a78d484

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@kingstinct/react-native-healthkit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@AlshehriAli0
Copy link
Contributor Author

@robertherber

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/kingstinct/react-native-healthkit/@kingstinct/react-native-healthkit@318

commit: a78d484

@AlshehriAli0 AlshehriAli0 force-pushed the fix/nitro-modules-0.33-compat branch 2 times, most recently from 0c25f09 to 929e76d Compare February 24, 2026 09:06
- Migrate isBigInt/getBigInt to isInt64/getInt64 for nitro-modules 0.33+
- Update struct initializers to use explicit constructors (nitro 0.33 breaking change)
- Remove readonly from array properties (nitro 0.33 compatibility)
- Bump react-native-nitro-modules peer dep to >=0.33
- Add fix-codegen script as temporary workaround for Swift 6.2/Xcode 26 CxxConvertibleToBool issue

Fixes kingstinct#302
@AlshehriAli0 AlshehriAli0 force-pushed the fix/nitro-modules-0.33-compat branch from 929e76d to 1d4e74d Compare February 24, 2026 09:11
Fix compatibility with nitro-modules 0.33+ and provide Xcode 26 workaround.
@robertherber robertherber merged commit 067c9f8 into kingstinct:master Feb 24, 2026
7 of 8 checks 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.

Build fails with react-native-nitro-modules >= 0.33: AnyMap.isBigInt removed

2 participants