Comments (11)
And just for extra clarity, this is tested using the latest version of your repo and the example project inside
from react-native-canvas.
By throwing a few console.logs into Canvas.js, I found that the problem is that sometimes the data variable that is returned can be an error message and this isn't being checked. The full JSON of the erroneous parsed data I got is as follows:
{
"id":0.022208261900120263,
"type":"error",
"payload":{
"message": "Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data."
}
}
So the Canvas.js file has the issue that, while it's checking that data has a payload property, it never checks whether or not that payload property contains an error message.
Regardless, the real issue is this whole "cross-origin data" tainting the canvas. Any idea how to remedy this?
from react-native-canvas.
One last thing, sorry about my inconsistent line numberings. I just realised I was quoting the src version of app.js and the minimised version of Canvas.js. The line in the src version of Canvas.js that throws the error is 80
from react-native-canvas.
Anything? I've looked into the issue a bit since I posted this and I really think it's a bug in the Android code. I know some images have CORS permissions in place stopping cross-origin use of images from stealing IP but I can't find a single image that works on Android, meanwhile every image I've tried has worked fine on iOS. The getImageData function works fine on iOS but on Android, it refuses to complete because of the canvas being "tainted by cross-origin data". It's preventing any progress with my release
from react-native-canvas.
Sorry, missed that will look into it ASAP
from react-native-canvas.
Were you ever able to reproduce the issue? We're looking to release our app in the next few days. iOS is fully functional but we're just delaying the android release indefinitely...
from react-native-canvas.
Haven't got to it. Pretty busy and don't use feature at work so can't find time for it in the near future
from react-native-canvas.
Any updates about this? A temporary fix? @ConorKelleher
from react-native-canvas.
None at all. I had to adopt a completely different approach for Android since this component was unusable for my purpose. I needed the function to get the pixel data of an image to manipulate it so I had to adapt the answer given here https://stackoverflow.com/questions/38098217/how-to-access-image-pixel-data-in-react-native to achieve that on Android. It's much slower and gives much less control over the quality of data to be read but it's a passable workaround.
from react-native-canvas.
Pull requests are very welcome and this feature shouldn't be a hassle to implement as the infra is available. Unfortunately I can't develop it myself right now but I can help contributors
from react-native-canvas.
We'll keep track on this at #41
from react-native-canvas.
Related Issues (20)
- why Why did I use getImageData() for more than 1 minute? HOT 2
- Canvas remain black on windows
- How do you get fillRect to occupy full dimensions? HOT 4
- ImageData/getImageData/putImageData strange behaviour HOT 2
- error HOT 2
- New architecture support for fabric HOT 1
- require cycle node_modules\react-native-canvas HOT 1
- canvas.loadFromJSON missing in react-native-canvas
- Error: Unable to resolve module ./CanvasRenderingContext2D HOT 1
- Not able to add fontFamily with font
- Application gets hang after 10 mins due to drawing on canvas continuously
- Can't draw image greater than 2048x2048 HOT 1
- Virtual/In-Memory Canvas HOT 1
- Can't draw Image on release HOT 1
- Doesn't work at all with Expo HOT 5
- Does not work with Expo 50 HOT 1
- `clearRect()` crashes in Expo 49 HOT 1
- does not work in react-native-windows
- How to draw local image on canvas using react-native-canvas HOT 1
- Setting width/height of canvas doesn't work HOT 2
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-canvas.