Created
July 8, 2018 21:14
-
-
Save bogoslavskiy/c8cc3a1df41a6d5c2da4918e3df8af2a to your computer and use it in GitHub Desktop.
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
export default class SearchBarProvider extends React.Component { | |
constructor(props) { | |
super(props); | |
[...] | |
this.state = { | |
currentTab: null, | |
canJumpToTab: true, | |
contextProvider: { | |
animation: this.searchBarAnimation.animationProps, | |
addHandlerScroll: this._addHandlerScroll, | |
_canJumpToTab: this._canJumpToTab | |
} | |
}; | |
} | |
[...] | |
_canJumpToTab = (canJumpToTab) => this.setState({canJumpToTab}); | |
render() { | |
return ( | |
<SearchBarContext.Provider value={this.state.contextProvider}> | |
{this.props.children(this.searchBarAnimation, { | |
canJumpToTab: this.state.canJumpToTab | |
})} | |
</SearchBarContext.Provider> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment