From aa7701d3fdd6c7e2ee0bb8a0aca95c3139ba95e0 Mon Sep 17 00:00:00 2001 From: Jakub Grzywacz Date: Fri, 27 Sep 2024 11:49:23 +0200 Subject: [PATCH] fix: currentColor dimming (#2465) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Summary Fixes #2455. When the shared modal was triggered, the `currentColor` (which is `tintColor` under the hood) was being greyscaled because the default value of `tintAdjustmentMode` was set to `UIViewTintAdjustmentModeDimmed`. Changing it to `UIViewTintAdjustmentModeNormal` resolves the issue. ## Test Plan Example apps -> `Test2455` ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | --- apple/Elements/RNSVGSvgView.mm | 2 ++ apps/test-examples/index.tsx | 1 + apps/test-examples/src/Test2455.tsx | 37 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 apps/test-examples/src/Test2455.tsx diff --git a/apple/Elements/RNSVGSvgView.mm b/apple/Elements/RNSVGSvgView.mm index 3e36dc16d..bbe74e741 100644 --- a/apple/Elements/RNSVGSvgView.mm +++ b/apple/Elements/RNSVGSvgView.mm @@ -47,6 +47,8 @@ - (instancetype)initWithFrame:(CGRect)frame // This is necessary to ensure that [self setNeedsDisplay] actually triggers // a redraw when our parent transitions between hidden and visible. self.contentMode = UIViewContentModeRedraw; + // We don't want the dimming effect on tint as it's used as currentColor + self.tintAdjustmentMode = UIViewTintAdjustmentModeNormal; #endif // TARGET_OS_OSX rendered = false; #ifdef RCT_NEW_ARCH_ENABLED diff --git a/apps/test-examples/index.tsx b/apps/test-examples/index.tsx index 740e5ddd0..d9afb126b 100644 --- a/apps/test-examples/index.tsx +++ b/apps/test-examples/index.tsx @@ -31,6 +31,7 @@ import Test2397 from './src/Test2397'; import Test2403 from './src/Test2403'; import Test2407 from './src/Test2407'; import Test2417 from './src/Test2417'; +import Test2455 from './src/Test2455'; export default function App() { return ; diff --git a/apps/test-examples/src/Test2455.tsx b/apps/test-examples/src/Test2455.tsx new file mode 100644 index 000000000..20cc06cc1 --- /dev/null +++ b/apps/test-examples/src/Test2455.tsx @@ -0,0 +1,37 @@ +import React from 'react'; +import {Button, Share, Text, TouchableOpacity, View} from 'react-native'; +import {G, Path, Rect, Svg} from 'react-native-svg'; + +const Favorite = ({color}: {color: string}): JSX.Element => { + return ( + + + + + + + + + + ); +}; + +export default () => { + const [color, setColor] = React.useState('green'); + return ( + + +