fix: align openPicker TurboModule spec to 3 args (fixes New Architecture crash) - #971
Open
shahidrogers wants to merge 1 commit into
Open
Conversation
…crash On the New Architecture the codegen spec for `openPicker` declared a single argument, but iOS both implements and is called with three (`props`, `onConfirm`, `onCancel`). The argument-count mismatch throws at runtime when opening the picker under bridgeless / new arch. Align the spec to three arguments and update the platforms to match: - src/fabric/NativeRNDatePicker.ts: spec now declares onConfirm/onCancel - ios: RNDatePickerManager conforms to NativeRNDatePickerSpec and provides getTurboModule (native method already took the 3 args) - android: openPicker override takes the two Callback params; Android delivers results via the event emitter so they are no-ops - src/modal.js: pass no-op callbacks on Android to satisfy the arg count
shahidrogers
had a problem deploying
to
e2e Android
July 3, 2026 02:16 — with
GitHub Actions
Failure
Author
|
Both failing checks are pre-existing / environmental — neither is caused by this PR:
The checks that actually exercise this change all pass — notably Happy to open a small separate PR to unblock CI (fix the pre-existing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the New Architecture, the codegen spec for
openPickerdeclares a single argument:But the picker is actually opened with three arguments on iOS, and the iOS native method is defined with three:
Under bridgeless / TurboModules the argument count is validated against the spec, so calling
openPickerthrows at runtime (the spec expects 1 arg, JS passes 3). This shows up as hard-to-diagnose crashes when the picker is opened on the New Architecture — related reports: #795, #699, #924.Fix
Make the spec the source of truth at three arguments and align every platform to it:
src/fabric/NativeRNDatePicker.ts— spec now declaresonConfirm/onCancel, matching the iOS native signature and what JS already passes.ios/RNDatePickerManager.h/.mm—RNDatePickerManagerconforms toNativeRNDatePickerSpecand providesgetTurboModuleunderRCT_NEW_ARCH_ENABLED(the nativeopenPickeralready took the three args, so no logic change).android/.../DatePickerModule.java— theopenPickeroverride takes the twoCallbackparams so it matches the regenerated 3-arg spec. Android delivers confirm/cancel through theRCTDeviceEventEmitter, so the callbacks are intentional no-ops (commented inline).src/modal.js— pass two no-op callbacks on Android so the call site satisfies the new argument count on both platforms.The spec can't diverge per-platform, so the shared 3-arg shape (with Android no-ops) keeps codegen happy while preserving each platform's existing result-delivery mechanism.
Verification
yarn typecheck,yarn test, andeslinton the changed JS/TS files all pass. (Two pre-existingprettiererrors insrc/DatePickerIOS.jsare untouched by this PR.)openPickercrash. Happy to adjust to fit CI/codegen expectations for the repo's baseline RN version.