From c37a2e9aa86fce292d587675bd586199e8167c27 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Mon, 10 Feb 2025 14:32:26 -0800 Subject: [PATCH] Disable warnings for mismatched SVC processor when `enableNativeCSSParsing()` (#49313) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49313 When the flag is enabled, we expect legacy native viewconfigs to add processor, where SVCs do not, and instead parse in native. Don't emit warnings in this case. Changelog: [Internal] Reviewed By: rshest Differential Revision: D69337802 fbshipit-source-id: f4c354c3b7b6ecbe4a8a72a37ea6d60dcc336b67 --- .../Libraries/NativeComponent/StaticViewConfigValidator.js | 6 +++++- .../__tests__/StaticViewConfigValidator-test.js | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/NativeComponent/StaticViewConfigValidator.js b/packages/react-native/Libraries/NativeComponent/StaticViewConfigValidator.js index ef34238fdb6..53fe4304288 100644 --- a/packages/react-native/Libraries/NativeComponent/StaticViewConfigValidator.js +++ b/packages/react-native/Libraries/NativeComponent/StaticViewConfigValidator.js @@ -8,6 +8,7 @@ * @format */ +import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; import {type ViewConfig} from '../Renderer/shims/ReactNativeTypes'; export type Difference = @@ -128,7 +129,10 @@ function accumulateDifferences( } } - if (nativeValue !== staticValue) { + if ( + nativeValue !== staticValue && + !ReactNativeFeatureFlags.enableNativeCSSParsing() + ) { differences.push({ path: [...path, nativeKey], type: 'unequal', diff --git a/packages/react-native/Libraries/NativeComponent/__tests__/StaticViewConfigValidator-test.js b/packages/react-native/Libraries/NativeComponent/__tests__/StaticViewConfigValidator-test.js index ac45da507b5..c7b8fa6c131 100644 --- a/packages/react-native/Libraries/NativeComponent/__tests__/StaticViewConfigValidator-test.js +++ b/packages/react-native/Libraries/NativeComponent/__tests__/StaticViewConfigValidator-test.js @@ -9,8 +9,14 @@ * @oncall react_native */ +import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags'; import * as StaticViewConfigValidator from '../StaticViewConfigValidator'; +beforeAll(() => { + // $FlowExpectedError[cannot-write] + ReactNativeFeatureFlags.enableNativeCSSParsing = () => false; +}); + test('passes for identical configs', () => { const name = 'RCTView'; const nativeViewConfig = {