Created
July 8, 2015 00:36
-
-
Save morukutsu/c3b01e7946104f4d87af 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
var React = require('react-native'); | |
var tweenState = require('react-tween-state'); | |
var { | |
View, | |
Text | |
} = React; | |
var Test = React.createClass({ | |
mixins: [tweenState.Mixin], | |
getInitialState: function() { | |
return {counter: 0}; | |
}, | |
componentDidMount: function() { | |
this.count(); | |
}, | |
count: function() { | |
// This is the API you'll probably use 90% of the time. | |
this.tweenState('counter', { | |
duration: 500, | |
beginValue: 0, | |
endValue: this.state.counter + 500, | |
onEnd: this.count | |
}); | |
console.log("Called"); | |
}, | |
render: function() { | |
return ( | |
<View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}> | |
<Text>easeOutQuad on a counter! {Math.round(this.getTweeningValue('counter'))}</Text> | |
</View> | |
); | |
} | |
}); | |
module.exports = Test; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment