Created
January 12, 2016 06:42
-
-
Save jenbennings/c079863351420c4301d2 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
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
*/ | |
'use strict'; | |
var React = require('react-native'); | |
var { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
Image, | |
View, | |
} = React; | |
var Firebase = require('firebase'); | |
var tramsimulator = React.createClass({ | |
componentWillMount: function() { | |
this.firebaseRef = new Firebase("https://ReactFireTodoApp.firebaseio.com/items/"); | |
this.firebaseRef.on("child_changed", function(dataSnapshot) { | |
this.setState({ | |
dings: this.dings | |
}); | |
}.bind(this)); | |
}, | |
render: function() { | |
return ( | |
<View style={styles.container}> | |
<Image style={styles.header} source={require('./logo.png')} /> | |
<View style={{width: 100, height: 100, padding: 20, backgroundColor: 'red', borderRadius: 50}}> | |
</View> | |
<Text style={styles.instructions}> | |
{ this.state.items } dings have been dung so far | |
</Text> | |
</View> | |
); | |
} | |
}); | |
var styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'space-between', | |
alignItems: 'center', | |
backgroundColor: '#6BBE53', | |
}, | |
header: { | |
width: 200 | |
}, | |
welcome: { | |
fontSize: 20, | |
textAlign: 'center', | |
margin: 10, | |
}, | |
instructions: { | |
textAlign: 'center', | |
color: 'white', | |
marginBottom: 5, | |
}, | |
}); | |
AppRegistry.registerComponent('tramsimulator', () => tramsimulator); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment