Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var NavigationBar = React.createClass({
- render: function(title, titleColor, NavBarColor) {
- var titleConfig = {
- title: title,
- tintColor: titleColor,
- };
- return (
- <NavBar
- title={titleConfig}
- tintColor={NavBarColor}
- leftButton={<Button style={styles.menuButton}></Button>}
- rightButton={<Button style={styles.menuButton}></Button>} />
- );
- }
- });
- <NavigationBar title="Categories" titleColor="#ffffff" NavBarColor="#f0b210"/>
- render: function () {
- var titleConfig = {
- title: this.props.title,
- tintColor: this.props.titleColor
- };
- // Rest of code
- }
- var NavBar = React.createClass({
- render: function () {
- return <div id="navbar" style={{backgroundColor: this.props.tintColor}}>
- <h1 style={{color: this.props.title.tintColor}}>{this.props.title.title}</h1>
- </div>;
- }
- });
- var NavigationBar = React.createClass({
- render: function() {
- var titleConfig = {
- title: this.props.title,
- tintColor: this.props.titleColor,
- };
- return (
- <NavBar
- title={titleConfig}
- tintColor={this.props.NavBarColor}
- />
- );
- }
- });
- React.render(<NavigationBar title="Categories" titleColor="#ff0" NavBarColor="#f0b210" />, document.body);
- <NavigationBar title="Hello World" tintColor= "blue" />
- class NavigationBar extends React.Component{
- constructor(props){
- super(props)
- }
- componentDidMount(){
- this.setState({
- NavTitle: this.props.title,
- NavColor:this.props.tintColor
- });
- }
- componentWillRecieveProps(nextProps,nextState){
- this.setState({
- NavTitle:nextProps["title"],
- NavColor:nextProps["tintColor"]
- });
- }
- render() {
- return (
- <NavBar
- title=this.state.NavTitle
- tintColor=this.state.NavColor
- leftButton={<Button style={styles.menuButton}></Button>}
- rightButton={<Button style={styles.menuButton}></Button>} />
- );
- }
- };
Add Comment
Please, Sign In to add comment