Repository navigation
fix: add a macOS Fabric component view and fix the image delegate methods - #181
Merged
Merged
Conversation
…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>
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.
Closes #180
1. macOS + New Architecture crashed on launch
codegenConfig.ios.componentProvider, which macOS shares, registersRNCProgressView→RNCProgressViewComponentView. That class existed only for UIKit (ios/Fabric), so on macOS the generatedRCTThirdPartyComponentsProviderinsertedniland threw:New
macos/Fabric/RNCProgressViewComponentView.{h,mm}, with the same class name. It's anNSProgressIndicator-based component view that wraps the existing macOSRNCProgressView, 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.progressViewStylehas no macOS equivalent; the old architecture already maps both styles to a bar.RNCProgressViewImagealias from fix(macos): build against react-native-macos 0.81 and add a macOS CI job #179, so it builds on react-native-macos 0.76 and 0.81.podspec:
macos/Fabricis excluded from the base macOS sources and added to thefabricsubspec asss.osx.source_files.2. Image delegate callbacks used pre-0.76 selectors (iOS and macOS)
Both component views implemented
didReceiveProgress:fromObserver:anddidReceiveFailureFromObserver:. Since at least RN 0.76,RCTImageResponseDelegaterequiresdidReceiveProgress:loaded:total:fromObserver:anddidReceiveFailure:fromObserver:, andRCTImageResponseObserverProxycalls those. The mismatch only produced a warning at compile time, and at runtime it threw:This was hit on macOS when the example's
progressImagefailed 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)
Titled
fix:, so merging releases 2.0.2.🤖 Generated with Claude Code