Created
April 9, 2018 16:51
-
-
Save dbismut/eb6133f09a7bf0be08327149c1d2a671 to your computer and use it in GitHub Desktop.
Part 3 - Modifying the onScroll method for handling the closeInvert state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state = { | |
dragProgress: 0, | |
closeInverted: false, | |
}; | |
onScroll = () => { | |
/* same code */ | |
// handling close icon color | |
const threshold = scrollTop / CLOSE_INVERTED_THRESHOLD; | |
if (!this.state.closeInverted && threshold > window.innerHeight - 54) { | |
this.setState({ closeInverted: true }); | |
} else if ( | |
this.state.closeInverted && | |
threshold <= window.innerHeight - 54 | |
) { | |
this.setState({ closeInverted: false }); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment