Last active
August 24, 2017 05:14
-
-
Save mspvirajpatel/14e93076e5b822760a41987c66657be1 to your computer and use it in GitHub Desktop.
This file contains 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
**First Create BottomBar.js** | |
import React, { Component, PropTypes } from 'react'; | |
import { | |
View, | |
Text, | |
StyleSheet, | |
Button, | |
Dimensions | |
} from 'react-native'; | |
import { Actions } from 'react-native-router-flux'; | |
const win = Dimensions.get('window'); | |
export default class BottomBar extends Component { | |
static defaultProps = { | |
showTopBar:0 | |
}; | |
static propTypes = { | |
showTopBar: PropTypes.number, | |
}; | |
constructor(props) { | |
super(props); | |
} | |
onPressAbout=() => { | |
Actions.about() | |
}; | |
render() { | |
return ( | |
<View style={styles.mainview}> | |
<View style={styles.mainview}> | |
<Button /> | |
</View> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
mainview: { | |
justifyContent: 'space-between', | |
width: win.width, | |
} | |
}); | |
**Second Create BaseView.js** | |
import React, { Component, PropTypes } from 'react'; | |
import { Image ,StatusBar ,Platform ,View} from 'react-native'; | |
export default class BaseView extends Component { | |
static defaultProps = { | |
background: 'black', | |
}; | |
render() { | |
return ( | |
<View style={[styles.container,{backgroundColor:this.props.background}]}> | |
{this.props.children} | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
} | |
}); | |
**Third Create YourView.js** | |
import React from 'react'; | |
import BaseView from "./BaseView"; | |
import BottomBar from "./BottomBar"; | |
export default class YourView extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<BaseView> | |
..your layout | |
<BottomBar/> | |
</BaseView> | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment