Created
December 16, 2018 18:27
-
-
Save vovkasm/581acd1da1b2426f103d72ff147e807e to your computer and use it in GitHub Desktop.
Defer content of screen until screen will be shown.
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
const s = StyleSheet.create({ | |
content: { | |
flex: 1, | |
}, | |
screen: { | |
backgroundColor: theme.bgColor2, | |
}, | |
}) | |
@observer | |
export class MainScreen extends React.Component<IProps> { | |
@observable | |
private toolBarHeight: number = 0 | |
render() { | |
return ( | |
<Screen style={s.screen}> | |
<NavigationHeaderBase | |
border | |
centered | |
leftElement={this.renderAvatar()} | |
rightElement={<View />} | |
title={this.props.headerTitle} | |
/> | |
<View style={s.content}>{this.toolBarHeight > 0 ? this.props.children : null}</View> | |
<ToolBar activeItem={this.props.tabActive} onLayout={this.onToolBarLayout} /> | |
</Screen> | |
) | |
} | |
private onToolBarLayout = (layout: LayoutRectangle) => { | |
if (layout.height !== this.toolBarHeight) { | |
this.toolBarHeight = layout.height | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment