Fix mixBlendMode not updating on Image state updates (#46680)

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

Since the parent of a view with mixBlendMode prop set is the one responsible for setting the compositing of the child, when updating mixBlendMode on a child we need to also invalidate the parent.

Changelog: [Android] [Fixed] - mixBlendMode now properly does state updates

Reviewed By: joevilches

Differential Revision: D63424394

fbshipit-source-id: 0eb15520f1087e25683853632943e64a66344481
This commit is contained in:
Jorge Cabiedes Acosta
2024-09-29 22:59:28 -07:00
committed by Facebook GitHub Bot
parent d2c48f3b1a
commit fae572d815
@@ -213,6 +213,11 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
public void setMixBlendMode(@NonNull T view, @Nullable String mixBlendMode) {
if (ViewUtil.getUIManagerType(view) == UIManagerType.FABRIC) {
view.setTag(R.id.mix_blend_mode, BlendModeHelper.parseMixBlendMode(mixBlendMode));
// We need to trigger drawChild for the parent ViewGroup which will set the
// mixBlendMode compositing on the child
if (view.getParent() instanceof View) {
((View) view.getParent()).invalidate();
}
}
}