Created
August 3, 2017 00:46
-
-
Save creationix/6211c57b23bfd5475fbbc2e5b973907c to your computer and use it in GitHub Desktop.
React Native Test
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
import React, { Component } from 'react' | |
import { View } from 'react-native' | |
export default class FlexDimensionsBasics extends Component { | |
constructor (props) { | |
super(props) | |
this.state = {time: Date.now()} | |
// Toggle the state every second | |
setInterval(() => { | |
this.setState(previousState => { | |
return {time: Date.now()} | |
}) | |
}, 16) | |
} | |
render () { | |
return ( | |
<View style={{flex: 1}}> | |
<View style={{flex: Math.sin(this.state.time / 1100) + 2, backgroundColor: 'red'}} /> | |
<View style={{flex: Math.sin(this.state.time / 990) + 2, backgroundColor: 'orange'}} /> | |
<View style={{flex: Math.sin(this.state.time / 880) + 2, backgroundColor: 'yellow'}} /> | |
<View style={{flex: Math.sin(this.state.time / 770) + 2, backgroundColor: 'green'}} /> | |
<View style={{flex: Math.sin(this.state.time / 660) + 2, backgroundColor: 'blue'}} /> | |
<View style={{flex: Math.sin(this.state.time / 550) + 2, backgroundColor: 'violet'}} /> | |
</View> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment