Skip to content

fix: crash on catalyst#1464

Merged
kirillzyusko merged 2 commits into
mainfrom
fix/catalyst-crash
May 16, 2026
Merged

fix: crash on catalyst#1464
kirillzyusko merged 2 commits into
mainfrom
fix/catalyst-crash

Conversation

@kirillzyusko
Copy link
Copy Markdown
Owner

@kirillzyusko kirillzyusko commented May 15, 2026

📜 Description

Fixed a crash when using ClippingScrollViewDecorator (KeyboardAwareScrollView/KeyboardChatScrollView) in MacCatalyst apps.

💡 Motivation and Context

That crash happens because we try to exchange of methods that don't exist in MacCatalyst implementation. When we run this code the UIKit gets backed by AppKit and mobile-specific methods don't exist. The fix is very simple - for mac catalyst we don't need to exchange the implementations of methods that don't exist.

Fix: #1454

📢 Changelog

iOS

  • don't swizzle implementation of non-existing methods on MacCatalyst;

🤔 How Has This Been Tested?

Tested in example catalyst app:

image

📸 Screenshots (if appropriate):

Before After
image image

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

@kirillzyusko kirillzyusko self-assigned this May 15, 2026
@kirillzyusko kirillzyusko added 🍎 iOS iOS specific 🎯 crash Library triggers a crash of the app KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component KeyboardChatScrollView 💬 Anything about chat functionality labels May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

📊 Package size report

Current size Target Size Difference
317542 bytes 317460 bytes 82 bytes 📈

@kirillzyusko kirillzyusko marked this pull request as ready for review May 16, 2026 15:22
@github-actions
Copy link
Copy Markdown
Contributor

  1. UIScrollView dynamic subclassing issue on macOS Catalyst
    Why: The code skips applying patches on macOS Catalyst due to AppKit-backed views but doesn't handle reverting existing subclasses if they were applied before, potentially causing runtime errors when UIScrollView instances are recreated.
    Fix: Add logic to revert the class changes when views move to a different environment or implement safeguards to prevent subclassing on AppKit-backed views.

  2. Missing handling of existing patched classes
    Why: The current code doesn't check if the UIScrollView has already been patched, leading to potential issues with multiple initializations or state mismatches post-patch.
    Fix: Implement a mechanism to detect and clean up any existing patched classes when the environment changes or views are reinitialized.

LGTM

@kirillzyusko kirillzyusko merged commit cb011a8 into main May 16, 2026
18 of 19 checks passed
@kirillzyusko kirillzyusko deleted the fix/catalyst-crash branch May 16, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎯 crash Library triggers a crash of the app 🍎 iOS iOS specific KeyboardAwareScrollView 📜 Anything related to KeyboardAwareScrollView component KeyboardChatScrollView 💬 Anything about chat functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On Mac Catalyst, using KeyboardAwareScrollView causes abnormal crashes.

1 participant