Skip to content

Error Loading Local PNG for drawImage [help] #206

@James-Firth

Description

@James-Firth

I am trying to get a basic example working. This currently works using Expo's development server, but breaks when I attempt to build the iOS app to an iPad (I am using the Expo Bare Workflow).

The canvas allows me to draw simple shapes, so I know the canvas loads properly. I also tried calling drawImage on a remote url to ensure that worked.

However, when I try to load a local image the error event is fired.

  1. The error callback seems to simply receive the entire Canvas object as a parameter. Is there a specific property within that object that can provide more details on the error? Right now I can't determine what's wrong just that something has gone wrong

  2. Does anyone have experience loading local images with Expo if it is an error specific to this?

More context for what I have tried:

  • My canvas object is currently using originWhitelist={["file://"]}.
  • Remote images via https load fine (I used the same url as in the examples folder in this repo)
  • I have viewed the filesystem and the path it specifies appears to be correct (and url-encoded)
  • I have tried using Image.resolveAssetSource
  • I have tried using Expo's Asset.fromModule
  • I have tried changing the baseUrl to "/"
  • I have moving the assignment to after defining the load
  • I have tried simply drawing the image after creating it instead of waiting for the load event.

Please let me know if any more details would be useful, or if I'm simply missing something silly.

Thanks in advance!

Versions

  • expo: ^40.0.1
  • react-native: ~0.4.1
  • react-native-canvas: ^0.1.37

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions