Closed kisin closed 4 years ago
Hi,
What do you use to run react? create-react-app?
Same error here using create-react-app
Could you provide a repo with the issue?
I tried on my side and did:
npx create-react-app my-app
cd my-app
yarn add gsap-tools
yarn start
then I added gsap-tools on App.js and it worked, and the tools is displayed.
To continue, I also added a simple GSAP timeline and it worked fine, http://b.ueno.is/c053a4e6ec42:
import React from 'react';
import GsapTools, { add } from 'gsap-tools';
import { TimelineLite } from 'gsap';
import logo from './logo.svg';
import './App.css';
function App() {
const myDiv = React.createRef(null);
const onAnimate = () => {
const timeline = new TimelineLite();
timeline.to(
myDiv.current,
0.6,
{
x: 200,
rotation: 5,
},
);
add(timeline);
};
React.useEffect(() => {
onAnimate();
});
return (
<div className="App">
<GsapTools />
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<div ref={myDiv} className="App-div" />
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;
Hi @jeremybarbet, it seems that when you load for first time, IS_VISIBLE
is undefined
on localStorage
and then JSON.parse
fails here: https://github.com/ueno-llc/gsap-tools/blob/master/src/app/GsapTools.js#L271
@ismamz Thank you for pointing me the issue, I forgot about local storage. Fix landed here: https://github.com/ueno-llc/gsap-tools/commit/f8bafe46d4eb2659f2bd342da6701751e30990c8 and version 1.0.11
published.
I'll try it ASAP and inform you if some other bug is showing up :)
after adding the gsaptools to page i get error: SyntaxError: Unexpected token u in JSON