Jump to content
Search Community

Invalid property: [xyz] set to "abc" / Missing plugin? gasp.registerPlugin()

iamsebastn test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hey GSAP-Folks! 
gsap in combination with React is a fairly new topic for me. And I'm encountering warnings, that I've never saw before. (Attached below)
Can somebody may explain me, what those mean? I just try to animate the yPercentage & width of an element
And yeah, at the top of the file, I imported gsap like 

import { gsap } from 'gsap'

Although when I put ...from 'gsap/all' it doesn't work. 

Here's a nearly similar animation in comparison to what I want to achieve with HTML, CSS & JS: 
https://codesandbox.io/s/ancient-framework-bqb7gw?file=/src/index.js

This works fine..

Hope, somebody can may explain me that weird warning. Thank you in advance!

Bildschirmfoto 2023-04-09 um 10.18.29.png

Bildschirmfoto 2023-04-09 um 10.18.37.png

Link to comment
Share on other sites

Hi,

 

Do you have an example where this doesn’t work? As you mentioned the sandbox you provided does work as expected.

 

You also mention that you’re using react, when using GSAP in a react environment we strongly recommend using GSAP Context

https://greensock.com/docs/v3/GSAP/gsap.context()

 

You should take a look at the resources in this page as well


Finally we have some starter templates for using GSAP in react, you can fork this one in order to create a minimal demo 

https://stackblitz.com/edit/gsap-react-basic-f48716
 

Hopefully this helps.

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

  • Solution

Yeah, without a minimal demo it's tough to diagnose but my best guess is that you're literally trying to animate a React Ref object itself rather than a DOM element. Like:

// bad
gsap.to(ref, {...});
              
// good
gsap.to(ref.current, {...});

So when GSAP tries to find the "height" property, for example, it doesn't exist.

 

If you still need help, please provide a minimal demo (CodePen, Stackblitz, or CodeSandbox) 👍

Link to comment
Share on other sites

14 hours ago, GreenSock said:

Yeah, without a minimal demo it's tough to diagnose but my best guess is that you're literally trying to animate a React Ref object itself rather than a DOM element. Like:

// bad
gsap.to(ref, {...});
              
// good
gsap.to(ref.current, {...});

So when GSAP tries to find the "height" property, for example, it doesn't exist.

Yep! That's it. I forgot about the .current. Dayum! Thank you very much!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...