Skip to content

fix: add a macOS Fabric component view and fix the image delegate methods - #181

Merged
Naturalclar merged 1 commit into
masterfrom
fix/macos-fabric
Nov 25, 2026
Merged

Naturalclar merged 1 commit into
masterfrom
fix/macos-fabric

Conversation

@Naturalclar

Copy link
Copy Markdown
Member

Closes #180

1. macOS + New Architecture crashed on launch

codegenConfig.ios.componentProvider, which macOS shares, registers RNCProgressView → RNCProgressViewComponentView. That class existed only for UIKit (ios/Fabric), so on macOS the generated RCTThirdPartyComponentsProvider inserted nil and threw:

-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]

New macos/Fabric/RNCProgressViewComponentView.{h,mm}, with the same class name. It's an NSProgressIndicator-based component view that wraps the existing macOS RNCProgressView, so drawing of tint colors and images is shared with the old architecture. It mirrors the iOS view for props (progress, progressTintColor, trackTintColor) and for loading images through the shadow node state.

podspec: macos/Fabric is excluded from the base macOS sources and added to the fabric subspec as ss.osx.source_files.

2. Image delegate callbacks used pre-0.76 selectors (iOS and macOS)

Both component views implemented didReceiveProgress:fromObserver: and didReceiveFailureFromObserver:. Since at least RN 0.76, RCTImageResponseDelegate requires didReceiveProgress:loaded:total:fromObserver: and didReceiveFailure:fromObserver:, and RCTImageResponseObserverProxy calls those. The mismatch only produced a warning at compile time, and at runtime it threw:

-[RNCProgressViewComponentView didReceiveFailure:fromObserver:]: unrecognized selector sent to instance

This was hit on macOS when the example's progressImage failed to load. The iOS view had the same selectors, so it would throw the same way on a failed or progressive image load.

Verified locally (react-native-macos 0.81.9, New Architecture)

  • Before: the example app crashes on launch with the nil-insertion error.
  • After the component view only: it gets past launch, then crashes with the selector error above.
  • After both changes: it launches, loads the bundle from Metro and keeps running (45 s, no exceptions). I couldn't take a screenshot of the window, so rendering wasn't checked visually.
  • CI covers compilation for iOS, Android and macOS on both architectures.

Titled fix:, so merging releases 2.0.2.

🤖 Generated with Claude Code

…hods

macOS + New Architecture crashed on launch: codegen's componentProvider
(shared with iOS) registers RNCProgressView as RNCProgressViewComponentView,
which only existed for UIKit, so NSClassFromString returned nil and the
generated components dictionary threw. Add macos/Fabric/
RNCProgressViewComponentView, an NSProgressIndicator-based component view
that wraps the existing macOS RNCProgressView, and compile it on macOS when
RCT_NEW_ARCH_ENABLED=1.

Both component views also implemented RCTImageResponseDelegate's progress
and failure callbacks under their pre-0.76 selectors, so React Native's
didReceiveProgress:loaded:total:fromObserver: and
didReceiveFailure:fromObserver: raised 'unrecognized selector' (seen on
macOS when the example's progressImage failed to load). Implement the
current selectors.

Closes #180

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Naturalclar
Naturalclar merged commit 3211ac2 into master Nov 25, 2026
10 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.

macOS: app crashes on launch with the New Architecture (no RNCProgressViewComponentView)

1 participant