Skip to content

Instantly share code, notes, and snippets.

@Burning-Chai
Last active September 23, 2015 10:57
Show Gist options
  • Save Burning-Chai/2e2ce5a312ee1d089418 to your computer and use it in GitHub Desktop.
Save Burning-Chai/2e2ce5a312ee1d089418 to your computer and use it in GitHub Desktop.
-- omission --
var Button = require('react-native-button');
var moment = require('moment');
var React = require('react-native');
-- omission --
var AwesomeProject = React.createClass({
render: function() {
return (
<View style={styles.container}>
-- omission --
<Button style={styles.btn} onPress={this._getDate}>
What Time Now??
</Button>
<Text style={styles.instructions}>
{this.state.dateText}
</Text>
</View>
);
},
_getDate: function(event) {
console.log('Pressed!');
this.setState({
dateText: moment().format('MMMM Do YYYY, h:mm:ss a')
});
},
getInitialState: function() {
return {
dateText: ''
}
}
});
var styles = StyleSheet.create({
-- omission --
btn: {
textAlign: 'center',
color: 'green'
}
});
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment