mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Default to native view configs in bridged mode and to static view configs in bridgeless mode (#39704)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39704 Default to native view configs in bridged mode and to static view configs in bridgeless mode. Remove `setRuntimeConfigProvider` calls from RNTester and from the Template. Changelog: [Internal] Reviewed By: RSNara Differential Revision: D49687252 fbshipit-source-id: 140e1c510ba3fbc153978b59c8bb4b4e35bc7571
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c03d520e16
commit
b27fab70c5
+10
-4
@@ -55,14 +55,20 @@ export function get<Config>(
|
||||
): HostComponent<Config> {
|
||||
ReactNativeViewConfigRegistry.register(name, () => {
|
||||
const {native, strict, verify} = getRuntimeConfig?.(name) ?? {
|
||||
native: true,
|
||||
native: !global.RN$Bridgeless,
|
||||
strict: false,
|
||||
verify: false,
|
||||
};
|
||||
|
||||
const viewConfig = native
|
||||
? getNativeComponentAttributes(name)
|
||||
: createViewConfig(viewConfigProvider());
|
||||
let viewConfig;
|
||||
if (native) {
|
||||
viewConfig = getNativeComponentAttributes(name);
|
||||
} else {
|
||||
viewConfig = createViewConfig(viewConfigProvider());
|
||||
if (viewConfig == null) {
|
||||
viewConfig = getNativeComponentAttributes(name);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify) {
|
||||
const nativeViewConfig = native
|
||||
|
||||
-9
@@ -6,13 +6,4 @@ import {AppRegistry} from 'react-native';
|
||||
import App from './App';
|
||||
import {name as appName} from './app.json';
|
||||
|
||||
if (global.RN$Bridgeless) {
|
||||
require('react-native/Libraries/NativeComponent/NativeComponentRegistry').setRuntimeConfigProvider(
|
||||
name => {
|
||||
// In bridgeless mode, never load native ViewConfig.
|
||||
return {native: false, strict: false, verify: false};
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
AppRegistry.registerComponent(appName, () => App);
|
||||
|
||||
@@ -29,15 +29,6 @@ import {BackHandler, StyleSheet, View, useColorScheme} from 'react-native';
|
||||
|
||||
// RNTester App currently uses in memory storage for storing navigation state
|
||||
|
||||
if (global.RN$Bridgeless) {
|
||||
require('react-native/Libraries/NativeComponent/NativeComponentRegistry').setRuntimeConfigProvider(
|
||||
name => {
|
||||
// In bridgeless mode, never load native ViewConfig.
|
||||
return {native: false, strict: false, verify: false};
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const RNTesterApp = (): React.Node => {
|
||||
const [state, dispatch] = React.useReducer(
|
||||
RNTesterNavigationReducer,
|
||||
|
||||
Reference in New Issue
Block a user