Skip to content

Commit 706b6e8

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Add warning when app is running with the old architecture (#50735)
Summary: Pull Request resolved: #50735 This change adds a warning in JS that is printed when the app is running using the old architecture. The assumption is that, if it is running with Fabric, it is running with the new architecture. So running without Fabric implies old architecture. ## Changelog: [General][Added] - Add warning when the app runs with the legacy architecture Reviewed By: cortinico, rubennorte Differential Revision: D73041156 fbshipit-source-id: 89a14f6370ae54b9d115e0ef672f29084d009a8e
1 parent 99153d8 commit 706b6e8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/react-native/Libraries/ReactNative/renderApplication.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
1313

1414
import GlobalPerformanceLogger from '../Utilities/GlobalPerformanceLogger';
1515
import PerformanceLoggerContext from '../Utilities/PerformanceLoggerContext';
16+
import warnOnce from '../Utilities/warnOnce';
1617
import AppContainer from './AppContainer';
1718
import DisplayMode, {type DisplayModeType} from './DisplayMode';
1819
import getCachedComponentWithDebugName from './getCachedComponentWithDebugName';
@@ -104,5 +105,13 @@ export default function renderApplication<Props: Object>(
104105
useFabric: Boolean(fabric),
105106
useConcurrentRoot,
106107
});
108+
109+
const newArchitecture = !!fabric;
110+
if (!newArchitecture) {
111+
warnOnce(
112+
'[OSS][OldArchDeprecatedWarning]',
113+
'The app is running using the Legacy Architecture. The Legacy Architecture is deprecated and will be removed in a future version of React Native. Please consider migrating to the New Architecture. For more information, please see https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here',
114+
);
115+
}
107116
performanceLogger.stopTimespan('renderApplication_React_render');
108117
}

0 commit comments

Comments
 (0)