Skip to content

Commit

Permalink
Check nullability of native view config before validation (facebook#4…
Browse files Browse the repository at this point in the history
…5420)

Summary:
Pull Request resolved: facebook#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]

Differential Revision: D59702501
  • Loading branch information
Abbondanzo authored and facebook-github-bot committed Jul 13, 2024
1 parent 65a3259 commit a83e535
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import type {
HostComponent,
PartialViewConfig,
ViewConfig,
} from '../Renderer/shims/ReactNativeTypes';

import getNativeComponentAttributes from '../ReactNative/getNativeComponentAttributes';
Expand Down Expand Up @@ -60,7 +61,7 @@ export function get<Config>(
verify: false,
};

let viewConfig;
let viewConfig: ViewConfig;
if (native) {
viewConfig =
getNativeComponentAttributes(name) ??
Expand All @@ -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;

Expand Down

0 comments on commit a83e535

Please sign in to comment.