Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ classToggle | string or string[2] | yes | undefined | [link](http://scrollmagic.
pin | boolean or string | yes | undefined | [link](http://scrollmagic.io/docs/ScrollMagic.Scene.html#setPin)
pinSettings | PinSettings | yes | undefined | See Types and [link](http://scrollmagic.io/docs/ScrollMagic.Scene.html#setPin)
enabled | boolean | yes | true | Can be changed on-the-fly
progressEvents | boolean | yes | true | Ability to silence progress events reducing redraws

## Types

Expand Down
13 changes: 8 additions & 5 deletions src/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type SceneProps = {
loglevel?: number,
indicators?: boolean,
enabled?: boolean,
progressEvents?: boolean,

/* setClassToggle */
classToggle?: string | Array<string>,
Expand Down Expand Up @@ -197,7 +198,7 @@ class SceneBase extends React.PureComponent<SceneBaseProps, SceneBaseState> {
}

initEventHandlers() {
let { children } = this.props;
let { children, progressEvents = true } = this.props;

if (typeof children !== 'function' && !isGSAP(callChildFunction(children, 0, 'init'))) {
return;
Expand All @@ -209,11 +210,13 @@ class SceneBase extends React.PureComponent<SceneBaseProps, SceneBaseState> {
});
});

this.scene.on('progress', (event) => {
this.setState({
progress: event.progress
if(progressEvents){
this.scene.on('progress', (event) => {
this.setState({
progress: event.progress
});
});
});
}
}

render() {
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ declare module 'react-scrollmagic' {
loglevel?: number,
indicators?: boolean,
enabled?: boolean,
progressEvents?: boolean,

/* setClassToggle */
classToggle?: string | string[],
Expand Down