Enable ViewConfig validation in RNTester (#45530)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45530

Enable viewconfig validation for RNTester to catch where static and native viewconfigs are mismatched, during development or contribution time. This relies on `useNativeViewConfigsInBridgelessMode()` which is already enabled in `DefaultNewArchitectureEntryPoint` on Android, and seems to be in iOS AppDelegate `RCTRootViewFactory` as well.

We put it in an early place in the bundle before first render, since we don't have RNTester preludes right now, but I think it is still early enough?

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D59946366

fbshipit-source-id: ae0c23b13a566489a88a7b4e408f61dce314b003
This commit is contained in:
Nick Gerleman
2024-07-19 09:37:03 -07:00
committed by Facebook GitHub Bot
parent e50e554039
commit d9263fbdbb
@@ -35,6 +35,18 @@ import {
View,
useColorScheme,
} from 'react-native';
import * as NativeComponentRegistry from 'react-native/Libraries/NativeComponent/NativeComponentRegistry';
// In Bridgeless mode, in dev, enable static view config validator
if (global.RN$Bridgeless === true && __DEV__) {
NativeComponentRegistry.setRuntimeConfigProvider(() => {
return {
native: false,
strict: true,
verify: true,
};
});
}
// RNTester App currently uses in memory storage for storing navigation state