greensock / react

Tools for using GSAP in React, like useGSAP() which is a drop-in replacement for useLayoutEffect()/useEffect()
251 stars 7 forks source link

Use latest gsap version? #5

Closed Twansparant closed 9 months ago

Twansparant commented 9 months ago

Hi there,

I'm using this package as well as the normal gsap package and have installed it following the instructions here.

"dependencies": {
    "@gsap/react": "^2.1.0",
    "gsap": "npm:@gsap/shockingly@^3.12.5"
}

Using the above package.json, gsap version always returns 3.12.4: I see the latest @gsap/react version has a dependency of "gsap": "^3.12.4";

Is there no way to use the latest version in pair with this package? I cleared the npm cache, deleted node_modules, package-lock etc and even rebuild my whole docker images, but it still uses version 3.12.4.

Thanks!

jackdoyle commented 9 months ago

I'm not an expert on that, but it sounds strange because "^3.12.4" should indeed resolve to the latest 3.12.5. Your build system should recognize that, but I wonder if you're using something that doesn't resolve things that way? I mean gsap is just a dependency of the @gsap/react package, so it should resolve those dependencies according to the way I mentioned above (but again, I'm not an expert). I wonder if anyone else has any insights to share here.

@Twansparant did you try registering your useGSAP hook like this?:

gsap.registerPlugin(useGSAP);

And does that make any difference?

Twansparant commented 9 months ago

@Twansparant did you try registering your useGSAP hook like this?:

I didn't, but I just added that to my files without any difference I'm afraid... However, I did a fresh install of the repo with a clean install of the node_modules and that did the trick in the end. Sorry for the confusion!