Skip to content

Commit e7fd8ad

Browse files
authored
fix(new-arch): metro warning for Flyout/Popup (#14817)
* fix(Flyout): deprecation warning in new arch * fix(Popup): deprecation warning in new arch * fix(Flyout): use warnOnce * fix(Popup): use warnOnce * Change files
1 parent cee4dd9 commit e7fd8ad

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "fix(new-arch): add deprecation warning for Flyout/Popup",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

vnext/src-win/Libraries/Components/Flyout/Flyout.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import FlyoutNativeComponent from './FlyoutNativeComponent';
1010
import * as React from 'react';
1111
import {findNodeHandle, StyleSheet} from 'react-native';
1212

13+
const warnOnce = require('../../Utilities/warnOnce').default;
14+
1315
type Placement =
1416
| 'top'
1517
| 'bottom'
@@ -66,6 +68,8 @@ type State = $ReadOnly<{
6668
targetRef?: React.ReactNode,
6769
}>;
6870

71+
const isFabric = global.nativeFabricUIManager;
72+
6973
/**
7074
* Renders a flyout component.
7175
*
@@ -93,6 +97,13 @@ export class Flyout extends React.Component<Props, State> {
9397

9498
constructor(props: Props) {
9599
super(props);
100+
101+
if (__DEV__ && isFabric) {
102+
warnOnce(
103+
'flyout-new-arch-deprecated',
104+
'`Flyout` is deprecated and not supported in the New Architecture. Use the new `Modal` component instead.',
105+
);
106+
}
96107
}
97108

98109
render(): React.Node {

vnext/src-win/Libraries/Components/Popup/Popup.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import type {ViewProps} from '../View/ViewPropTypes';
1111
import {findNodeHandle} from '../../ReactNative/RendererProxy';
1212
import StyleSheet from '../../StyleSheet/StyleSheet';
1313

14+
const warnOnce = require('../../Utilities/warnOnce').default;
15+
1416
const styles = StyleSheet.create({
1517
rctPopup: {
1618
position: 'absolute',
@@ -49,6 +51,8 @@ type State = $ReadOnly<{|
4951
targetRef?: React.ReactNode,
5052
|}>;
5153

54+
const isFabric = global.nativeFabricUIManager;
55+
5256
/**
5357
* Renders a popup component.
5458
*
@@ -75,6 +79,13 @@ export class Popup extends React.Component<Props, State> {
7579
constructor(props: Props) {
7680
super(props);
7781
this.state = {target: undefined, targetRef: null};
82+
83+
if (__DEV__ && isFabric) {
84+
warnOnce(
85+
'popup-new-arch-deprecated',
86+
'`Popup` is deprecated and not supported in the New Architecture. Use the new `Modal` component instead.',
87+
);
88+
}
7889
}
7990

8091
render(): React.Node {

0 commit comments

Comments
 (0)