Fix SVC Validator for Box Shadow and filter (#46454)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46454

The SVC Validator have no idea on how to process a simple NSArray *.

With this change, we are creating two named types for the NSArray:
* BoxShadowArray
* FilterArray
To create unique types that we can reference in JS.

We are then enhancing the `getProcessor` function to return the proper processor when those types are found in the NativeViewConfig

## Changelog:
[iOS][Fixed] - Fixed warnings when validating SVC

## Facebook:
This change is OTA safe: even when we ship the JS before the native code, the new cases in the switch will be never hit, similarly to the situation we have right now.

As soon as the native code is shipped, the new cases will start get hit and the wrning will disappear

Reviewed By: NickGerleman

Differential Revision: D62574612

fbshipit-source-id: d173bf5534ee5e436f23a4bc6e2fb25e72a4b06d
This commit is contained in:
Riccardo Cipolleschi
2024-09-13 08:10:10 -07:00
committed by Facebook GitHub Bot
parent fad4a0783b
commit de39a204c3
2 changed files with 14 additions and 9 deletions
@@ -188,6 +188,10 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any {
case 'UIImage':
case 'RCTImageSource':
return resolveAssetSource;
case 'BoxShadowArray':
return processBoxShadow;
case 'FilterArray':
return processFilter;
// Android Types
case 'Color':
return processColor;
@@ -431,18 +431,19 @@ RCT_CUSTOM_VIEW_PROPERTY(experimental_layoutConformance, NSString *, RCTView)
// filtered by view configs.
}
RCT_CUSTOM_VIEW_PROPERTY(filter, NSArray *, RCTView)
typedef NSArray *FilterArray; // Custom type to make the StaticViewConfigValidator Happy
RCT_CUSTOM_VIEW_PROPERTY(filter, FilterArray, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}
RCT_CUSTOM_VIEW_PROPERTY(boxShadow, NSArray *, RCTView)
typedef NSArray *BoxShadowArray; // Custom type to make the StaticViewConfigValidator Happy
RCT_CUSTOM_VIEW_PROPERTY(boxShadow, BoxShadowArray, RCTView)
{
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
// Property is only to be used in the new renderer.
// It is necessary to add it here, otherwise it gets
// filtered by view configs.
}
RCT_CUSTOM_VIEW_PROPERTY(experimental_mixBlendMode, NSString *, RCTView)