osamaqarem/react-native-image-colors

Work with Data URIs on Android

Closed this issue · 1 comments

There is an issue when we provide a base64 Data URI in android. On iOS it works fine.

On android it ends in error:

code:"Error"
message:"ImageColors: Invalid URL"
nativeStackAndroid:Array(0) []
stack:"Error: ImageColors: Invalid URL
    at Object.promiseMethodWrapper [as getColors] (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:4597:36)
    at updateColor$ (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:288053:83)
    at tryCatch (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:25312:19)
    at Generator.invoke [as _invoke] (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:25485:24)
    at Generator.next (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:25355:23)
    at tryCatch (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:25312:19)
    at invoke (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:25385:22)
    at /Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:25415:13
    at tryCallTwo (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:27376:7)
    at doResolve (/Users/shashwatjain/Repos/iconnect_rn/.vscode/.react/index.bundle:27540:15)"

I never accounted for base64. the fact that it works for iOS is a coincidence 😆
I went ahead and made a fix for android! Please try v1.2.4 and let me know if it still doesn't work.

https://github.com/osamaq/react-native-image-colors/releases/tag/v1.2.4

Example valid base64:
"data:image/jpeg;base64,/9j/4Ri..."