bitworking / react-scrollmagic

React components for ScrollMagic
https://bitworking.github.io/react-scrollmagic/
372 stars 64 forks source link

Duration does not update on State change unless the page is refreshed #15

Closed anraiki closed 5 years ago

anraiki commented 5 years ago

I have a event listening for when the browser resizes to change the state of the app.

        window.addEventListener("resize", _.debounce(() => {
            if(window.innerWidth > 1920) {
                let scale_height = window.innerWidth * 0.565;
                this.setState({scale_height: scale_height});
            } else {
                this.setState({scale_height: "100vh"});
            }
        },500));

This updates the height for elements in the page and in turn also updates the duration.

The duration updates on the new state but doesn't refreshes unless you actually refresh the page.

From what I understand, I may need to update the duration from the event listener.

Related issue: https://github.com/janpaepke/ScrollMagic/issues/105

Is it possible to update the duration on a new state change?

samuelg0rd0n commented 5 years ago

+1 Doesn't work for me either. Any ideas how to solve this?

melpers commented 5 years ago

+1 Running into the same issue.

bitworking commented 5 years ago

The duration now can be changed on-the-fly. Means it now reacts to an prop update.