Comments (14)
Can you provide the full code you were trying to execute?
from react-native-canvas.
I run from your example folder
from react-native-canvas.
I removed and ran to run it again.
It's work. sorry to create issue
from react-native-canvas.
@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.
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.
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:
If I change the baseUrl
passed to the WebView to ''
, I get a different error:
And if I remove baseUrl
altogether, I get:
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.
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.
Here is a solution for this problem: facebook/react-native#20835 (comment)
from react-native-canvas.
How did you run it?
from react-native-canvas.
Do you use a custom setup of React Native?
from react-native-canvas.
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.
Can you provide your code please? I'd like to get a full look
from react-native-canvas.
i'm get the same question , is there any solution?
from react-native-canvas.
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)
- 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
- Error: Unable to resolve module `react/jsx-runtime` from `node_modules/react-native-canvas/dist/Canvas.js HOT 2
- The text truncates and doesn't show in multiline HOT 1
- getting an Object instead of Boolean by using isPointInStroke HOT 3
- getting an Object instead of Boolean by using isPointInStroke
- The return value has a large deviation by using isPointInStroke 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-canvas.