Skip to content

Instantly share code, notes, and snippets.

@shokimble
Created July 29, 2018 16:54
Show Gist options
  • Save shokimble/8d4a174b068a382a465514c77d4dc240 to your computer and use it in GitHub Desktop.
Save shokimble/8d4a174b068a382a465514c77d4dc240 to your computer and use it in GitHub Desktop.
observable
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