mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Try static view config if native view config is not available (#44065)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44065 React Native will try to use static view config if native view config is not available. This will allow Fabric-only native components in Bridge mode. Changelog: [General][Added] - Add support for Fabric-only native components in Bridge mode. Reviewed By: cortinico Differential Revision: D56062759 fbshipit-source-id: e562700695c14c88d11056aec1e66f8aa10a3957
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3426591bbe
commit
2f1cd04073
+12
-5
@@ -62,14 +62,21 @@ export function get<Config>(
|
||||
|
||||
let viewConfig;
|
||||
if (native) {
|
||||
viewConfig = getNativeComponentAttributes(name);
|
||||
viewConfig =
|
||||
getNativeComponentAttributes(name) ??
|
||||
createViewConfig(viewConfigProvider());
|
||||
} else {
|
||||
viewConfig = createViewConfig(viewConfigProvider());
|
||||
if (viewConfig == null) {
|
||||
viewConfig = getNativeComponentAttributes(name);
|
||||
}
|
||||
viewConfig =
|
||||
createViewConfig(viewConfigProvider()) ??
|
||||
getNativeComponentAttributes(name);
|
||||
}
|
||||
|
||||
invariant(
|
||||
viewConfig != null,
|
||||
'NativeComponentRegistry.get: both static and native view config are missing for native component "%s".',
|
||||
name,
|
||||
);
|
||||
|
||||
if (verify) {
|
||||
const nativeViewConfig = native
|
||||
? viewConfig
|
||||
|
||||
+3
-6
@@ -19,17 +19,14 @@ const matricesDiffer = require('../Utilities/differ/matricesDiffer');
|
||||
const pointsDiffer = require('../Utilities/differ/pointsDiffer');
|
||||
const sizesDiffer = require('../Utilities/differ/sizesDiffer');
|
||||
const UIManager = require('./UIManager');
|
||||
const invariant = require('invariant');
|
||||
const nullthrows = require('nullthrows');
|
||||
|
||||
function getNativeComponentAttributes(uiViewClassName: string): any {
|
||||
const viewConfig = UIManager.getViewManagerConfig(uiViewClassName);
|
||||
|
||||
invariant(
|
||||
viewConfig != null && viewConfig.NativeProps != null,
|
||||
'requireNativeComponent: "%s" was not found in the UIManager.',
|
||||
uiViewClassName,
|
||||
);
|
||||
if (viewConfig == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO: This seems like a whole lot of runtime initialization for every
|
||||
// native component that can be either avoided or simplified.
|
||||
|
||||
Reference in New Issue
Block a user