Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

React 16: Toolbar is not loading correctly #529

Open
furiousxk opened this issue Oct 7, 2018 · 1 comment
Open

React 16: Toolbar is not loading correctly #529

furiousxk opened this issue Oct 7, 2018 · 1 comment

Comments

@furiousxk
Copy link

furiousxk commented Oct 7, 2018

Hello,

Trying to integrate literallycanvas in to my react application.
I have created the following component based on the documentation.

import React, { Component } from 'react';
import LC from "literallycanvas";
import LiterallyCanvas from "literallycanvas/lib/js/core/LiterallyCanvas";
import defaultOptions from "literallycanvas/lib/js/core/defaultOptions";

export class DrawCanvas extends Component {
    constructor(props) {
      super(props);
      ....
      defaultOptions.tools = [LC.tools.Pencil, LC.tools.Eraser]
      defaultOptions.imageURLPrefix = "/lib/img";

      this.lc = new LiterallyCanvas(defaultOptions);
   }
   save() {
        localStorage.setItem('drawing', JSON.stringify(this.lc.getSnapshot()));
        this.setState({svgText: this.lc.getSVGString()});
   }
   render() {
       return (
               <LC.LiterallyCanvasReactComponent lc={this.lc}/>
       )
   }

export default DrawCanvas;

When the component loads the toolbar is shown but the icons of the available tools are not.
I'm assuming an import is missing but I can't seem to figure out which it is.

I have the same behavior when not defining the array of tools but keeping the standard.
Attached is a png wich shows the results of the code above.
2018-10-07-110536_59x402_scrot

Question: What have I forgotten to import so that the icons are correctly displayed?

Edit: The buttons and it's functionality all work, its simply the icons that are not displayed correctly.

@TRomesh
Copy link

TRomesh commented Jan 26, 2019

Do you have the images under /lib/img ?. if you are using create-react-app add them under public/ directory.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants