-
Notifications
You must be signed in to change notification settings - Fork 170
Closed
Labels
Description
Hello,
I am constantly getting this error when moving back from a page to another:
Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string.
I noticed that this is an error coming from the webview: react-native-webview/react-native-webview#341
Is there anything we can do to fix it?
Here is my code:
initCanvas = (canvas) => {
// making sure this is called only once
if(!this.hasCanvasInited) {
this.hasCanvasInited = true;
var deltaTime = 100;
// These are switched because of landscape mode
canvas.width = this.window_size.height;
canvas.height = this.window_size.width + 50;
var context = canvas.getContext('2d');
context.fillStyle = '#DDA0DD';
context.fillRect(0, 0, canvas.width, canvas.height);
context.save();
// Wait few seconds before starting to avoid issues with canvas not being loaded yet
setTimeout(() => {
this.drawLoop(canvas, context, deltaTime);
}, 1000);
}
}
drawLoop = (canvas, context, deltaTime) => {
if(canvas !== null) {
context.restore();
this.plotSine(context, 0, canvas.height / 2);
setTimeout(() => {
this.canvasTimer += deltaTime / 1000;
this.drawLoop(canvas, context, deltaTime);
}, deltaTime);
}
}
plotSine = (ctx, x_offset, y_offset) => {
var height = -125;
var width = 100;
this.drawCircle(ctx, x_offset + (this.canvasTimer * width), y_offset + (height * Math.sin(this.canvasTimer * (Math.PI / 2) - Math.PI * 0.5)), 30, 'purple', 'purple', 2);
}
drawCircle = (ctx, x, y, radius, fill, stroke, strokeWidth) => {
console.log(x,y);
ctx.beginPath()
ctx.arc(x, y, radius, 0, 2 * Math.PI, false)
if (fill) {
ctx.fillStyle = fill
ctx.fill()
}
if (stroke) {
ctx.lineWidth = strokeWidth
ctx.strokeStyle = stroke
ctx.stroke()
}
}
render() {
return (
<Canvas ref={this.initCanvas}/>
)
}Reactions are currently unavailable