Skip to content

Commit 6998519

Browse files
Willa KongShevO27
authored andcommitted
Revert D49413562: Static view configs take precedence over native view configs
Differential Revision: D49413562 Original commit changeset: d65776cd43ea Original Phabricator Diff: D49413562 fbshipit-source-id: e0f8670f0725412740142fd2c41e1eaeb9ca4c8a
1 parent 9638bb0 commit 6998519

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

packages/react-native/Libraries/NativeComponent/NativeComponentRegistry.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,15 @@ export function get<Config>(
5454
viewConfigProvider: () => PartialViewConfig,
5555
): HostComponent<Config> {
5656
ReactNativeViewConfigRegistry.register(name, () => {
57-
let {native, strict, verify} = getRuntimeConfig?.(name) ?? {
58-
native: false,
57+
const {native, strict, verify} = getRuntimeConfig?.(name) ?? {
58+
native: true,
5959
strict: false,
6060
verify: false,
6161
};
6262

63-
let viewConfig = createViewConfig(viewConfigProvider());
64-
if (viewConfig == null) {
65-
// Fallback to native view config.
66-
native = true;
67-
viewConfig = getNativeComponentAttributes(name);
68-
}
63+
const viewConfig = native
64+
? getNativeComponentAttributes(name)
65+
: createViewConfig(viewConfigProvider());
6966

7067
if (verify) {
7168
const nativeViewConfig = native

packages/rn-tester/js/RNTesterAppShared.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ import {BackHandler, StyleSheet, View, useColorScheme} from 'react-native';
2929

3030
// RNTester App currently uses in memory storage for storing navigation state
3131

32+
if (global.RN$Bridgeless) {
33+
require('react-native/Libraries/NativeComponent/NativeComponentRegistry').setRuntimeConfigProvider(
34+
name => {
35+
// In bridgeless mode, never load native ViewConfig.
36+
return {native: false, strict: false, verify: false};
37+
},
38+
);
39+
}
40+
3241
const RNTesterApp = (): React.Node => {
3342
const [state, dispatch] = React.useReducer(
3443
RNTesterNavigationReducer,

0 commit comments

Comments
 (0)