Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to native view configs in bridged mode and to static view configs in bridgeless mode #39704

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions packages/react-native/template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
9 changes: 0 additions & 9 deletions packages/rn-tester/js/RNTesterAppShared.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down