Created
July 29, 2018 16:54
-
-
Save shokimble/8d4a174b068a382a465514c77d4dc240 to your computer and use it in GitHub Desktop.
observable
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
import {View} from 'react-native'; | |
import React, { Component } from 'react'; | |
function randomColor() { | |
return '#'+Math.floor(Math.random()*16777215).toString(16); | |
} | |
export default class HelloWorld extends Component { | |
constructor() { | |
super(); | |
// Set initial state here | |
this.state = { | |
bg: randomColor(), | |
}; | |
this.setTimeout(()=> { this.setState({bg: randomColor()})}, 5000); | |
} | |
render() { | |
<View style={{flex:1, backgroundColor: this.state.bg}}/ > | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment