From ec97646fe4a6d8cf002c3670e0444371e67edf9f Mon Sep 17 00:00:00 2001 From: James Maxell Eroy Date: Thu, 6 Jul 2023 21:34:06 -0700 Subject: [PATCH] Only ignore AnimatedProps that use vectorized animation on iOS (#38118) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38118 https://github.com/facebook/react-native/pull/37925 mitigated an issue where vectorized animations (e.g. AnimatedColor) would flicker. This issue was nearly not as present in Android (flickering rarely happens). In fact, it greatly increased the flickering issues on Android. This will make it so that AnimatedProps that use vectorized animation are only ignored on iOS until a more robust fix is available. ## Changelog [General][Fixed] - AnimatedColor flickering on Android Reviewed By: javache Differential Revision: D47114536 fbshipit-source-id: a61bb11a316594d12c070a3149863fe5973745c5 --- .../react-native/Libraries/Animated/animations/Animation.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Animated/animations/Animation.js b/packages/react-native/Libraries/Animated/animations/Animation.js index 29dda1c4e8e..d8e955f9fda 100644 --- a/packages/react-native/Libraries/Animated/animations/Animation.js +++ b/packages/react-native/Libraries/Animated/animations/Animation.js @@ -14,6 +14,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type AnimatedNode from '../nodes/AnimatedNode'; import type AnimatedValue from '../nodes/AnimatedValue'; +import Platform from '../../Utilities/Platform'; import NativeAnimatedHelper from '../NativeAnimatedHelper'; import AnimatedColor from '../nodes/AnimatedColor'; import AnimatedProps from '../nodes/AnimatedProps'; @@ -84,7 +85,10 @@ export default class Animation { // may not have completed yet. For example, only the animation for the red channel of // an animating color may have been completed, resulting in a temporary red color // being rendered. So, for now, ignore AnimatedProps that use a vectorized animation. - if (node instanceof AnimatedValueXY || node instanceof AnimatedColor) { + if ( + Platform.OS === 'ios' && + (node instanceof AnimatedValueXY || node instanceof AnimatedColor) + ) { return result; }