Commit 45b6015
[upstream][paper] Fix crash when statically enabling wantsUpdateLayer for View component
Summary:
This diff fixes an invariant that wasn't valid anymore after having enabled `wantsUpdateLayer` statically for the View component in Fabric.
`RCTUIView` in RCTUIKit enables `wantsUpdateLayer` only if the instance implements the `displayLayer:` method. Because the View component always wants to have `wantsUpdateLayer` enabled, the assumption that `displayLayer:` exists wasn't valid anymore.
This diff only calls the `displayLayer:` method if the instance effectively responds to it. To avoid a perf hit on the check, we only test for it in the initialization and cache the result.
Test Plan:
* Run the Cosmo app
```
~/fbsource/xplat/arfx/cosmo/mac/run.sh
```
| Before | After |
|--|
| {F1460101180} | {F1460101226} |
Reviewers: shawndempsey, jorgecab, #rn-desktop
Reviewed By: shawndempsey
Differential Revision: https://phabricator.intern.facebook.com/D54090975
# Conflicts:
# packages/react-native/React/Base/macOS/RCTUIKit.m1 parent 8600765 commit 45b6015
1 file changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| |||
259 | 261 | | |
260 | 262 | | |
261 | 263 | | |
262 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
263 | 270 | | |
264 | 271 | | |
265 | 272 | | |
| |||
0 commit comments