You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking to replace React Native's context-setting experimental_layoutConformanceView property with a new LayoutConformance context-like component, imported as experimental_LayoutConformance.
Introducing a new context-like component for every Strict DOM component would add overhead, and RSD setting contexts for mixed RN component trees underneath it is not super understandable. I think we should remove the usage from RSD, but encourage apps who want the behavior to add a LayoutConformance component to their root (we do this for Meta apps code-sharing aleady).
Context
React Native currently exposes a configurable "layout conformance" flag to let users pick which subtrees are laid out with preference to W3C/correct layout, as compared to buggy "compatibility mode". This helps us continue to ship new features and fixes to Yoga as we evolve the engine, delivering less surprises when code-sharing between RN and Web.
The original desired API for layout contexts was a StrictLayout context-like component, inspired by React.StrictMode. This was hard to do at the time, so we added a new (context-setting) property on View, experimental_layoutConformance="strict|classic".
With recent support or display: contents, we can achieve the original goal, of a context-like component, which introduces contexts into the ShadowTree, without creating a layout box.
Before
import{View}from'react-native';// Root of the app<View{...props}experimental_layoutConformance="strict">{content}</View>
After
import{View,experimental_LayoutConformanceasLayoutConformance}from'react-native';// Root of the app<LayoutConformancemode="strict"><View{...props}>{content}</View></LayoutConformance>
PR: facebook/react-native#48188
Phabricator Diff (with more product context): https://www.internalfb.com/diff/D66910054
The gist
I am looking to replace React Native's context-setting
experimental_layoutConformance
View
property with a newLayoutConformance
context-like component, imported asexperimental_LayoutConformance
.Impact to React Strict DOM
createStrictDOMComponent
setsexperimental_layoutConformance="strict"
for every View component.Introducing a new context-like component for every Strict DOM component would add overhead, and RSD setting contexts for mixed RN component trees underneath it is not super understandable. I think we should remove the usage from RSD, but encourage apps who want the behavior to add a
LayoutConformance
component to their root (we do this for Meta apps code-sharing aleady).Context
React Native currently exposes a configurable "layout conformance" flag to let users pick which subtrees are laid out with preference to W3C/correct layout, as compared to buggy "compatibility mode". This helps us continue to ship new features and fixes to Yoga as we evolve the engine, delivering less surprises when code-sharing between RN and Web.
The original desired API for layout contexts was a
StrictLayout
context-like component, inspired byReact.StrictMode
. This was hard to do at the time, so we added a new (context-setting) property onView
,experimental_layoutConformance="strict|classic"
.With recent support or
display: contents
, we can achieve the original goal, of a context-like component, which introduces contexts into the ShadowTree, without creating a layout box.Before
After
Meta Internal
React Technologies Workplace Thread
Diff (with extra context)
The text was updated successfully, but these errors were encountered: