Skip to content

Commit

Permalink
Fix color interpolation not to crash
Browse files Browse the repository at this point in the history
  • Loading branch information
swansontec committed Jun 22, 2024
1 parent 4c076ff commit c68aded
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions patches/react-native-reanimated+3.13.0-rc.2.patch
Original file line number Diff line number Diff line change
@@ -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 =

0 comments on commit c68aded

Please sign in to comment.