Skip to content
This repository has been archived by the owner on Sep 13, 2020. It is now read-only.

Commit

Permalink
Ensure that menu takes all available space
Browse files Browse the repository at this point in the history
Without this it was not possible to use {flex:1}
in the menu component
  • Loading branch information
esamattis committed Mar 22, 2016
1 parent aae3664 commit 1711896
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -211,7 +211,7 @@ class SideMenu extends Component {
* @return {React.Component}
*/
render() {
const menu = <View style={styles.menu}>{this.props.menu}</View>;
const menu = <View style={[styles.menu, {right: deviceScreen.width - this.props.openMenuOffset}]}>{this.props.menu}</View>;

return (
<View style={styles.container} onLayout={this.onLayoutChange.bind(this)}>
Expand Down
23 changes: 11 additions & 12 deletions styles.js
Expand Up @@ -4,18 +4,21 @@ const {
StyleSheet,
} = React;

const absoluteStretch = {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
};

module.exports = StyleSheet.create({
container: {
flex: 1,
...absoluteStretch,
justifyContent: 'center',
alignItems: 'center',
},
menu: {
flex: 1,
backgroundColor: 'transparent',
position: 'absolute',
top: 0,
left: 0,
...absoluteStretch,
},
frontView: {
flex: 1,
Expand All @@ -25,11 +28,7 @@ module.exports = StyleSheet.create({
backgroundColor: 'transparent',
},
overlay: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
...absoluteStretch,
backgroundColor: 'transparent',
},
});

0 comments on commit 1711896

Please sign in to comment.