Comments (4)
Hey guys, I was searching about how I could fix that and I got a solution to us. 🔥
Firstly I created a function to handle the photo URL and replace all spaces code in a string index 40. So the index 40 is a space code in a string. Look the function below:
export const URLEncoder = (path = '') => {
if (isAndroid()) {
return String(path).replace(/\s+/g, '%20');
}
return path;
};
So with this function you can import where the ImageColors is beeing used and put as parameter the photo url path, look it below:
ImageColors.getColors(URLEncoder(uri), { fallback: Theme.colors.primary, }) .then(res => { ... })
In short, I'm using regex to remove all space to %20 in a string. Hope I've helped.
from react-native-image-colors.
Hey guys, I was searching about how I could fix that and I got a solution to us. 🔥
Firstly I created a function to handle the photo URL and replace all spaces code in a string index 40. So the index 40 is a space code in a string. Look the function below:
export const URLEncoder = (path = '') => { if (isAndroid()) { return String(path).replace(/\s+/g, '%20'); } return path; };
So with this function you can import where the ImageColors is beeing used and put as parameter the photo url path, look it below:
ImageColors.getColors(URLEncoder(uri), { fallback: Theme.colors.primary, }) .then(res => { ... })
In short, I'm using regex to remove all space to %20 in a string. Hope I've helped.
I guess you should be able to use the standard encodeURI(uri)
function instead of a custom one.
from react-native-image-colors.
any solution?
from react-native-image-colors.
I've been having the same error, any solution until now?
from react-native-image-colors.
Related Issues (20)
- expo compatibility HOT 5
- [Web] different color detection on mobile browser vs desktop HOT 4
- build android error Plugin with id 'maven' not found. HOT 3
- pod install error HOT 3
- Expo "Possible Unhandled Promise Rejection: TypeError: Cannot read property 'getColors' of undefined" issue HOT 7
- Not working with locally cached images HOT 1
- TypeError: null is not an object (evaluating '_module.RNImageColors.getColors') HOT 15
- This is not working in Apple tv . HOT 8
- Need to update kotlin-gradle-plugin to 1.6.20 as kotlin-android-extensions needs gradle plugin version >= 1.6.20 HOT 1
- [Error: ImageColors: Invalid image URI – failed to get image]
- can get same color both ios and android? HOT 1
- Android always gives unknown color error when fallback color is #000 HOT 6
- Error when building for Android with Expo SDK 49 and React Native 0.72.1 HOT 2
- this package is not working HOT 2
- Error in react native CLI HOT 7
- Pod install not working after installing react-native-image-colors HOT 3
- Cannot find native module 'ImageColors' HOT 9
- [iOS] Doesn't build with RN 0.73
- [Android] build failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-image-colors.