Repository navigation
Conversation
The interop component view sets the paper view as its contentView, and RCTViewComponentView places contentView at the layout content frame (inset by padding/border). The paper view's children, however, are mounted directly into it with frames computed by Yoga relative to the outer frame, which already include the padding. As a result the padding is applied twice: the legacy view shrinks by the padding while its children are pushed out by it. Keep the paper view at the full bounds, matching Paper.
|
Hi @nej1044! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Summary:
On iOS with the New Architecture, a legacy (Paper) component rendered through the interop layer applies its
paddingtwice when it has children.RCTLegacyViewManagerInteropComponentViewsets the paper view as itscontentView.RCTViewComponentViewplacescontentViewatlayoutMetrics.getContentFrame(), which is the frame inset by padding and border. The paper view's children are mounted directly into the paper view, though, and Yoga computes their frames relative to the outer frame, so those frames already include the padding. The result:A common case is
react-native-linear-gradientused as a gradient border:On Paper and on Android, a 1px gradient border shows on all four sides. On iOS with the New Architecture it shows only on the top and left edges, because the child covers the right and bottom edges. Larger paddings visibly shift the content. Related reports: react-native-linear-gradient/react-native-linear-gradient#677 and #668, and #48114.
The fix keeps the paper view at the component view's full bounds, matching Paper. Children positions are unchanged because they already come from Yoga.
Changelog:
[IOS] [FIXED] - Legacy interop components no longer apply
paddingtwice (the native view shrank and its children were offset)Test Plan:
Tested in a production app on React Native 0.81.6 with the New Architecture on an iPhone 15 (iOS 26), applying the same change as a patch.
LinearGradientwithpadding: 1wrapping an opaque card shows the gradient border only on the top and left edges.Other
LinearGradientusages in the app that have larger paddings (16–37px) now lay out the same as on Paper.