Unify SetProps for View and ShadowView in the InteropLayer (#41941)

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

While working on the interop layer, I realized that htis code is duplicated.

## Changelog
[Internal] - Use the same method for View And ShadowView in the Interop layer

Reviewed By: sammy-SC

Differential Revision: D51752171

fbshipit-source-id: 579652de262fea7edb13a1329cb07683eab78124
This commit is contained in:
Riccardo Cipolleschi
2023-12-14 08:52:54 -08:00
committed by Facebook GitHub Bot
parent 8183afeb81
commit 201d2d1fde
@@ -365,24 +365,23 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
}
- (void)setProps:(NSDictionary<NSString *, id> *)props forView:(id<RCTComponent>)view
{
[self setProps:props forView:view isShadowView:NO];
}
- (void)setProps:(NSDictionary<NSString *, id> *)props forShadowView:(RCTShadowView *)shadowView
{
[self setProps:props forView:shadowView isShadowView:YES];
}
- (void)setProps:(NSDictionary<NSString *, id> *)props forView:(id<RCTComponent>)view isShadowView:(BOOL)isShadowView
{
if (!view) {
return;
}
[props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) {
[self propBlockForKey:key isShadowView:NO](view, json);
}];
}
- (void)setProps:(NSDictionary<NSString *, id> *)props forShadowView:(RCTShadowView *)shadowView
{
if (!shadowView) {
return;
}
[props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) {
[self propBlockForKey:key isShadowView:YES](shadowView, json);
[self propBlockForKey:key isShadowView:isShadowView](view, json);
}];
}