mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Check nullability of native view config before validation (#45420)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45420 Devex improvement to skip validation when no native view config exists. Redbox is still hit, showing the true error. See test plan below before/after Changelog: [Internal] Reviewed By: javache Differential Revision: D59702501 fbshipit-source-id: 9aada9813c2930ee2b4bb23e5ba8a3e546c4e9af
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7ff1e447fd
commit
1ca63e3e3d
@@ -11,6 +11,7 @@
|
||||
import type {
|
||||
HostComponent,
|
||||
PartialViewConfig,
|
||||
ViewConfig,
|
||||
} from '../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
import getNativeComponentAttributes from '../ReactNative/getNativeComponentAttributes';
|
||||
@@ -60,7 +61,7 @@ export function get<Config>(
|
||||
verify: false,
|
||||
};
|
||||
|
||||
let viewConfig;
|
||||
let viewConfig: ViewConfig;
|
||||
if (native) {
|
||||
viewConfig =
|
||||
getNativeComponentAttributes(name) ??
|
||||
@@ -81,7 +82,13 @@ export function get<Config>(
|
||||
const nativeViewConfig = native
|
||||
? viewConfig
|
||||
: getNativeComponentAttributes(name);
|
||||
const staticViewConfig = native
|
||||
|
||||
if (nativeViewConfig == null) {
|
||||
// Defer to static view config if native view config is missing.
|
||||
return viewConfig;
|
||||
}
|
||||
|
||||
const staticViewConfig: ViewConfig = native
|
||||
? createViewConfig(viewConfigProvider())
|
||||
: viewConfig;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user