Coder Social home page Coder Social logo

Comments (11)

conor-kelleher avatar conor-kelleher commented on July 17, 2024

And just for extra clarity, this is tested using the latest version of your repo and the example project inside

from react-native-canvas.

conor-kelleher avatar conor-kelleher commented on July 17, 2024

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.

conor-kelleher avatar conor-kelleher commented on July 17, 2024

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.

conor-kelleher avatar conor-kelleher commented on July 17, 2024

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.

iddan avatar iddan commented on July 17, 2024

Sorry, missed that will look into it ASAP

from react-native-canvas.

conor-kelleher avatar conor-kelleher commented on July 17, 2024

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.

iddan avatar iddan commented on July 17, 2024

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.

hu9osaez avatar hu9osaez commented on July 17, 2024

Any updates about this? A temporary fix? @ConorKelleher

from react-native-canvas.

conor-kelleher avatar conor-kelleher commented on July 17, 2024

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.

iddan avatar iddan commented on July 17, 2024

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.

iddan avatar iddan commented on July 17, 2024

We'll keep track on this at #41

from react-native-canvas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.