Skip to content

Fix React Native 0.83+ compatibility (getType + ReadableMap nullable)#88

Open
BenGWeeks wants to merge 2 commits into
LtbLightning:mainfrom
BenGWeeks:pr/rn083-compatibility
Open

Fix React Native 0.83+ compatibility (getType + ReadableMap nullable)#88
BenGWeeks wants to merge 2 commits into
LtbLightning:mainfrom
BenGWeeks:pr/rn083-compatibility

Conversation

@BenGWeeks
Copy link
Copy Markdown

Summary

Two small compatibility fixes to keep bdk-rn working on React Native 0.83+:

  1. getType().type — RN 0.83 deprecated getType() on bridge value classes (ReadableMap, ReadableArray) in favour of the .type Kotlin property. The old method still works at runtime today but emits a deprecation warning in 0.83 and will be removed in a future RN.

  2. ReadableMap.getMap() is now nullable — RN 0.83 changed the Java/Kotlin signature of ReadableMap.getMap(String) from ReadableMap to ReadableMap?. Without the !! (or null-safe handling) the Kotlin compiler errors with type-mismatch when the result is passed into a function expecting non-null. Three call sites needed adjustment in BdkRnModule.kt.

Test

Tested locally against React Native 0.83.4 + Expo SDK 55 inside the lightning-piggy-mobile consumer:

  • All on-chain wallet operations (xpub-derived address watching, balance queries, fee bumping, UTXO selection) compile and run without warnings.
  • Behaviourally identical to the pre-patch implementation; only the Kotlin-level types change.

Compatibility

The patch is forward-compatible with RN 0.83+. For RN ≤0.82, the .type accessor exists too (added in RN 0.71 or thereabouts), so this shouldn't break older consumers — but I haven't tested against RN 0.81/0.82 specifically. If maintainers have a preferred minimum-RN-version policy, happy to gate this with a version check or follow whichever approach lines up best.

Carrier

These commits have been carried in our Lightning Piggy fork (BenGWeeks/bdk-rn#lightning-piggy) since early April 2026 and have been running in dev builds without issue. Filing upstream now since the upstream version is the right home and RN 0.83+ is becoming the default for new SDK 55 projects.

BenGWeeks and others added 2 commits May 5, 2026 15:14
Dynamic.getType() was removed in RN 0.83 (Gradle 9.0). Replace with
property access .type which works across RN versions.

Same fix as LtbLightning#87 (submitted to upstream but not
merged — upstream appears unmaintained since Jan 2024).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
RN 0.83 changed ReadableArray.getMap() to return ReadableMap? (nullable)
instead of ReadableMap. Add non-null assertions where values are
guaranteed to exist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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