Created
July 8, 2018 21:12
-
-
Save bogoslavskiy/fcb618ecd1f4e52beeeaeaff07231192 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
[...] | |
_renderHeader = (animation, canJumpToTab) => props => ( | |
<SearchBar | |
animation={animation} | |
changeInputFocus={suggestionFocus => | |
this.setState({suggestionFocus}) | |
} | |
renderTabBar={() => ( | |
<TabBar | |
onTabPress={({route}) => { | |
if(route.key != this.state.currentTab && canJumpToTab) { | |
animation.onTabPress(route); | |
} | |
}} | |
getLabelText={this._getLabelText} | |
indicatorStyle={styles.indicator} | |
style={styles.tabbar} | |
labelStyle={styles.label} | |
{...props} | |
/> | |
)} | |
/> | |
); | |
[...] | |
render() { | |
return ( | |
<SearchBarProvider currentTab={this.state.currentTab}> | |
{(animation, { canJumpToTab }) => | |
<View style={initialLayout}> | |
<TabView | |
style={styles.container} | |
navigationState={this.state} | |
renderScene={this._renderScene} | |
renderTabBar={this._renderHeader(animation, canJumpToTab)} | |
onIndexChange={this._handleIndexChange} | |
initialLayout={initialLayout} | |
swipeEnabled={false} // TODO ... | |
canJumpToTab={() => canJumpToTab} | |
useNativeDriver | |
/> | |
{this._renderSuggestion(animation)} | |
</View> | |
} | |
</SearchBarProvider> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment