Move transform3D
property from RCTView
to RCTUIView
#1936
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.
Please select one of the following
Summary
We've received reports of the following red box in react-native-svg:
-[RNSVGSvgView setTransform3D:]: unrecognized selector sent to instance <address>
The reason for this is because of the following inheritance chain:
RNSVGSvgView
(subclass of)RNSVGView
(#defined as)UIView
RNSVGSvgView
(subclass of)RNSVGView
(subclass of)RCTUIView
(subclass of)RCTPlatformView
(#defined as)NSView
transform3D
exists onUIView
, but it doesn't exist onNSView
, so we previously implemented it onRCTView
, which is a separate subclass ofRCTUIView
. However,RCTView
(like its counterpart in RNCore) is meant to augment the default OS-level view with RN-specific functionality, whileRCTUIView
(which is exclusive to react-native-macos) is meant to addUIView
-like features that don't already exist onNSView
.By this logic,
transform3D
should really be at theRCTUIView
level.Other Notes
There are a couple of other cases in RNTester-macOS that have similar problems with their inheritance chains:
-[RCTSwitch setTransform3D:]
RCTSwitch
(subclass of)UISwitch
(subclass of)UIControl
(subclass of)UIView
βRCTSwitch
(subclass of)RCTUISwitch
(subclass of)NSSwitch
, doesn't pass throughRCTUIView
β-[RCTTextView setOnKeyUp:]
RCTTextView
(subclass of)UIView
βRCTSwitch
(subclass of)RCTUIView
(subclass of)RCTPlatformView
(#defined as)NSView
, doesn't pass throughRCTView
βThese require further discussions about how different control views are inherited. These could presumably be fixed by wrapping said control views in a
View
of their own, but this is an awkward experience that ought to be avoidable. We should discuss these at a later time, but this fix on its own still has merit.Changelog
[MACOS] [FIXED] -
transform3D
is now a property ofRCTUIView
Test Plan
a524840 fixes the issue on the Accessibility page, but that change is arguably too aggressive because of the differences between
RCTView
andRCTUIView
. Nevertheless, this demonstrates that this solution is viable.