Skip to content

Fix missing onCloseHandler in CustomerCenterProxy#1581

Draft
facumenzella wants to merge 1 commit into
mainfrom
facundo/fix-customer-center-proxy-close-handler
Draft

Fix missing onCloseHandler in CustomerCenterProxy#1581
facumenzella wants to merge 1 commit into
mainfrom
facundo/fix-customer-center-proxy-close-handler

Conversation

@facumenzella

Copy link
Copy Markdown
Member

Summary

  • CustomerCenterProxy.createCustomerCenterViewController() never set onCloseHandler on the CustomerCenterUIViewController it created
  • When onCloseHandler is nil, CustomerCenterView falls back to SwiftUI's @Environment(\.dismiss) action
  • On iOS 15, calling dismiss() at the root of a NavigationView is a no-op (there's even a comment in DismissCircleButton calling this out explicitly)
  • This meant the X close button had no effect when the Customer Center was presented via presentCustomerCenter() on iOS 15

The fix sets onCloseHandler to call vc.dismiss(animated: true), which:

  1. Properly dismisses via UIKit on all iOS versions
  2. Triggers viewDidDisappear with isBeingDismissed = true
  3. Calls customerCenterViewControllerWasDismissed on the delegate → resolves the RN/Flutter/etc. Promise

Note: the embedded CustomerCenterViewManager already set onCloseHandler correctly — this only affected the modal proxy path.

Test plan

  • Present Customer Center via presentCustomerCenter() on iOS 15 device/simulator
  • Navigate to "Display Purchase History"
  • Tap the X close button — should dismiss the entire Customer Center
  • Confirm the Promise resolves and onDismiss fires

Fixes CC-647

🤖 Generated with Claude Code

…n to be a no-op on iOS 15

When onCloseHandler is nil, CustomerCenterView falls back to SwiftUI's
dismiss() environment action. On iOS 15, calling dismiss() at the root
of a NavigationView is a no-op, so the Customer Center close button has
no effect when presentCustomerCenter() is used.

Setting onCloseHandler to call vc.dismiss(animated: true) ensures UIKit
properly dismisses the modal on all iOS versions, triggering
viewDidDisappear with isBeingDismissed=true and notifying the delegate.

Fixes CC-647

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facumenzella facumenzella added pr:feat A new feature pr:fix A bug fix and removed pr:feat A new feature labels Mar 27, 2026
@facumenzella facumenzella added pr:other and removed pr:fix A bug fix labels Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant