Skip to content

Commit abfc235

Browse files
javachefacebook-github-bot
authored andcommitted
Remove legacy arch fallback from LayoutConformance (#56440)
Summary: Remove the `isFabricUIManagerInstalled` guard and `UnimplementedLayoutConformance` fallback since the legacy architecture is no longer supported. Convert to Flow component syntax. Changelog: [General][Removed] - Removed legacy architecture fallback from `LayoutConformance` Differential Revision: D100817102
1 parent dfddcc9 commit abfc235

3 files changed

Lines changed: 8 additions & 33 deletions

File tree

packages/eslint-plugin-react-native/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const publicAPIMapping = {
3535
},
3636
'Libraries/Components/LayoutConformance/LayoutConformance': {
3737
default: 'experimental_LayoutConformance',
38-
types: ['LayoutConformanceProps'],
38+
types: [],
3939
},
4040
'Libraries/Lists/FlatList': {
4141
default: 'FlatList',

packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,23 @@ import StyleSheet from '../../StyleSheet/StyleSheet';
1212
import LayoutConformanceNativeComponent from './LayoutConformanceNativeComponent';
1313
import * as React from 'react';
1414

15-
export type LayoutConformanceProps = Readonly<{
15+
export default component LayoutConformance(
1616
/**
1717
* strict: Layout in accordance with W3C spec, even when breaking
1818
* compatibility: Layout with the same behavior as previous versions of React Native
1919
*/
2020
mode: 'strict' | 'compatibility',
21-
2221
children: React.Node,
23-
}>;
24-
25-
// We want a graceful fallback for apps using legacy arch, but need to know
26-
// ahead of time whether the component is available, so we test for global.
27-
// This does not correctly handle mixed arch apps (which is okay, since we just
28-
// degrade the error experience).
29-
const isFabricUIManagerInstalled = global?.nativeFabricUIManager != null;
30-
31-
function LayoutConformance(props: LayoutConformanceProps): React.Node {
22+
) {
3223
return (
33-
<LayoutConformanceNativeComponent {...props} style={styles.container} />
24+
<LayoutConformanceNativeComponent
25+
mode={mode}
26+
children={children}
27+
style={styles.container}
28+
/>
3429
);
3530
}
3631

37-
function UnimplementedLayoutConformance(
38-
props: LayoutConformanceProps,
39-
): React.Node {
40-
if (__DEV__) {
41-
const warnOnce = require('../../Utilities/warnOnce').default;
42-
43-
warnOnce(
44-
'layoutconformance-unsupported',
45-
'"LayoutConformance" is only supported in the New Architecture',
46-
);
47-
}
48-
49-
return props.children;
50-
}
51-
52-
export default (isFabricUIManagerInstalled
53-
? LayoutConformance
54-
: UnimplementedLayoutConformance) as component(...LayoutConformanceProps);
55-
5632
const styles = StyleSheet.create({
5733
container: {
5834
display: 'contents',

packages/react-native/index.js.flow

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export {default as InputAccessoryView} from './Libraries/Components/TextInput/In
6464
export type {KeyboardAvoidingViewProps} from './Libraries/Components/Keyboard/KeyboardAvoidingView';
6565
export {default as KeyboardAvoidingView} from './Libraries/Components/Keyboard/KeyboardAvoidingView';
6666

67-
export type {LayoutConformanceProps} from './Libraries/Components/LayoutConformance/LayoutConformance';
6867
export {default as experimental_LayoutConformance} from './Libraries/Components/LayoutConformance/LayoutConformance';
6968

7069
export type {

0 commit comments

Comments
 (0)