From 786edafe48f37b5f36912f5ad6e04c0d895545af Mon Sep 17 00:00:00 2001 From: William Swanson Date: Fri, 21 Jun 2024 15:54:25 -0700 Subject: [PATCH] Fix color interpolation not to crash See https://github.com/software-mansion/react-native-reanimated/pull/6153 for details. --- patches/react-native-reanimated+3.13.0-rc.2.patch | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/patches/react-native-reanimated+3.13.0-rc.2.patch b/patches/react-native-reanimated+3.13.0-rc.2.patch index ffbb0c665c1..b1815fa2302 100644 --- a/patches/react-native-reanimated+3.13.0-rc.2.patch +++ b/patches/react-native-reanimated+3.13.0-rc.2.patch @@ -1,13 +1,17 @@ diff --git a/node_modules/react-native-reanimated/src/Colors.ts b/node_modules/react-native-reanimated/src/Colors.ts -index 2b01b32..40a571e 100644 +index 2b01b32..db146a3 100644 --- a/node_modules/react-native-reanimated/src/Colors.ts +++ b/node_modules/react-native-reanimated/src/Colors.ts -@@ -521,7 +521,7 @@ export const rgbaColor = ( +@@ -521,8 +521,10 @@ export const rgbaColor = ( alpha = 1 ): number | string => { 'worklet'; - if (IS_WEB || !_WORKLET) { +- return `rgba(${r}, ${g}, ${b}, ${alpha})`; + if (!IS_ANDROID || !_WORKLET) { - return `rgba(${r}, ${g}, ${b}, ${alpha})`; ++ // Replace tiny values like 1.234e-11 with 0: ++ const safeAlpha = alpha < 0.001 ? 0 : alpha; ++ return `rgba(${r}, ${g}, ${b}, ${safeAlpha})`; } + const c =