Reputation: 2828
I am trying to evaluate react-fabricjs package but it seems doesn't work with current React 16.12.0 version. The error I am getting is : TypeError: Cannot read property 'bool' of undefined in /./src/StaticCanvas.jsx?:414:40
followed by bunch of other errors. Any idea on how to use the Fabricjs or perhaps suggest another library?
To replicate the issue I simply create blank React app by npx create-react-app demo
and add the package yarn add react-fabricjs --save
import logo from './logo.svg';
import './App.css';
import { Canvas, Text } from 'react-fabricjs';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<Canvas
width="900"
height="900">
<Text
text="Hello World!"
left={300}
top={300}
fill="#000000"
fontFamily="Arial"
/>
</Canvas>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;
Upvotes: 1
Views: 443
Reputation: 2930
Taking a look at the error on a sandbox I've created using just this package, I can see that it's trying to access PropTypes from react's object.
Based on react docs:
React.PropTypes has moved into a different package since React v15.5
So, my assumption is that this module was built using a React version that still had PropTypes under its object.
You might consider looking for a different module as it seems that this one is no longer maintained.
Upvotes: 2