Coder Social home page Coder Social logo

Comments (14)

iddan avatar iddan commented on August 16, 2024 1

Can you provide the full code you were trying to execute?

from react-native-canvas.

itoon avatar itoon commented on August 16, 2024 1

I run from your example folder

from react-native-canvas.

itoon avatar itoon commented on August 16, 2024 1

I removed and ran to run it again.
It's work. sorry to create issue

from react-native-canvas.

benadamstyles avatar benadamstyles commented on August 16, 2024 1

@iddan Hey, thanks for all your work on this lib. Unfortunately I am also getting this error – I have tracked it down to the source prop you're passing to the WebView component – if I change source.baseUrl from / to /X, the error is then Error: Unable to open URL: file:///X. I don't really know how to proceed now though, since I don't know what baseUrl is referring to.

I would ignore this error, except that the canvas is just not displaying for me at all either!

from react-native-canvas.

benadamstyles avatar benadamstyles commented on August 16, 2024 1

Update: I had to rebuild the app to get the canvas to actually render. Can't imagine why – just restarting the packager wasn't enough. The warning still happens though.

Update 2: Really weird – the canvas has stopped rendering again – all I did was reload the app. I'm really confused! I've never seen react native be flaky like this before. I'd be really grateful for any help you can give.

from react-native-canvas.

benadamstyles avatar benadamstyles commented on August 16, 2024 1

Sorry for the delay. I tried to reproduce the error in an Expo Snack, but it worked fine there without errors. If you have a gitlab account I can add you to my repo, but I can't really post all my code here. My UI code is very simple (the timeout is simply to make sure the issue is not some weird race condition):

export default class Share extends PureComponent {
  onCanvasMount = canvas => {
    if (canvas) {
      canvas.height = 600
      const ctx = canvas.getContext('2d')
      setTimeout(() => {
        ctx.fillStyle = '#f00'
        ctx.fillRect(10, 10, 100, 100)
      }, 1000)
    }
  }

  render() {
    return (
      <View style={styles.container}>
        <Canvas ref={this.onCanvasMount} />
      </View>
    )
  }
}

The error I get is:

screen shot 2018-08-06 at 15 02 17

If I change the baseUrl passed to the WebView to '', I get a different error:

screen shot 2018-08-06 at 15 03 32

And if I remove baseUrl altogether, I get:

screen shot 2018-08-06 at 15 04 52

I can't work out what the WebView is trying to load, but I guess it's some files in node_modules/react-native-canvas? Is the problem just that these files are not being bundled?

from react-native-canvas.

iddan avatar iddan commented on August 16, 2024 1

Our approach is bundeling all the required assets in the HTML to avoid accessing the file system. But I'm not sure what specifically goes wrong in your scenarios. @Leeds-eBooks I'll get back to you with a username ASAP

from react-native-canvas.

SergeyBazhanov avatar SergeyBazhanov commented on August 16, 2024 1

Here is a solution for this problem: facebook/react-native#20835 (comment)

from react-native-canvas.

iddan avatar iddan commented on August 16, 2024

How did you run it?

from react-native-canvas.

iddan avatar iddan commented on August 16, 2024

Do you use a custom setup of React Native?

from react-native-canvas.

benadamstyles avatar benadamstyles commented on August 16, 2024

No, just the standard. Not using create-react-native-app, just the basic installation like this: https://facebook.github.io/react-native/docs/getting-started#creating-a-new-application

from react-native-canvas.

iddan avatar iddan commented on August 16, 2024

Can you provide your code please? I'd like to get a full look

from react-native-canvas.

HengCC avatar HengCC commented on August 16, 2024

i'm get the same question , is there any solution?

from react-native-canvas.

HengCC avatar HengCC commented on August 16, 2024

i have try to remove baseUrl from source code, but the problem still exist, The difference is that the library seems to read the app system file.

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.