forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpo-image+1.10.1+002+TintFix.patch
38 lines (35 loc) · 1.96 KB
/
expo-image+1.10.1+002+TintFix.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/node_modules/expo-image/android/src/main/java/com/caverock/androidsvg/SVGStyler.kt b/node_modules/expo-image/android/src/main/java/com/caverock/androidsvg/SVGStyler.kt
index b58a0df..6b8da3c 100644
--- a/node_modules/expo-image/android/src/main/java/com/caverock/androidsvg/SVGStyler.kt
+++ b/node_modules/expo-image/android/src/main/java/com/caverock/androidsvg/SVGStyler.kt
@@ -107,6 +107,7 @@ internal fun applyTintColor(element: SVG.SvgObject, newColor: Int, parentDefines
fun applyTintColor(svg: SVG, newColor: Int) {
val root = svg.rootElement
+ replaceStyles(root.baseStyle, newColor)
replaceStyles(root.style, newColor)
val hasStyle = hasStyle(root)
diff --git a/node_modules/expo-image/android/src/main/java/expo/modules/image/ExpoImageViewWrapper.kt b/node_modules/expo-image/android/src/main/java/expo/modules/image/ExpoImageViewWrapper.kt
index 602b570..8becf72 100644
--- a/node_modules/expo-image/android/src/main/java/expo/modules/image/ExpoImageViewWrapper.kt
+++ b/node_modules/expo-image/android/src/main/java/expo/modules/image/ExpoImageViewWrapper.kt
@@ -31,6 +31,7 @@ import expo.modules.image.records.ImageLoadEvent
import expo.modules.image.records.ImageProgressEvent
import expo.modules.image.records.ImageTransition
import expo.modules.image.records.SourceMap
+import expo.modules.image.svg.SVGPictureDrawable
import expo.modules.kotlin.AppContext
import expo.modules.kotlin.tracing.beginAsyncTraceBlock
import expo.modules.kotlin.tracing.trace
@@ -127,7 +128,12 @@ class ExpoImageViewWrapper(context: Context, appContext: AppContext) : ExpoView(
internal var tintColor: Int? = null
set(value) {
field = value
- activeView.setTintColor(value)
+ // To apply the tint color to the SVG, we need to recreate the drawable.
+ if (activeView.drawable is SVGPictureDrawable) {
+ shouldRerender = true
+ } else {
+ activeView.setTintColor(value)
+ }
}
internal var isFocusableProp: Boolean = false