Skip to content

Commit

Permalink
Unify SetProps for View and ShadowView in the InteropLayer (#41941)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Dec 14, 2023
1 parent 8183afe commit 201d2d1
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/react-native/React/Views/RCTComponentData.m
Original file line number Diff line number Diff line change
Expand Up @@ -366,23 +366,22 @@ - (RCTPropBlock)propBlockForKey:(NSString *)name isShadowView:(BOOL)isShadowView

- (void)setProps:(NSDictionary<NSString *, id> *)props forView:(id<RCTComponent>)view
{
if (!view) {
return;
}

[props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) {
[self propBlockForKey:key isShadowView:NO](view, json);
}];
[self setProps:props forView:view isShadowView:NO];
}

- (void)setProps:(NSDictionary<NSString *, id> *)props forShadowView:(RCTShadowView *)shadowView
{
if (!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:YES](shadowView, json);
[self propBlockForKey:key isShadowView:isShadowView](view, json);
}];
}

Expand Down

0 comments on commit 201d2d1

Please sign in to comment.