Skip to content

Instantly share code, notes, and snippets.

@idiomatic
Created August 30, 2015 18:05
Show Gist options
  • Save idiomatic/23a83c014ba49e2255cd to your computer and use it in GitHub Desktop.
Save idiomatic/23a83c014ba49e2255cd to your computer and use it in GitHub Desktop.
###
# Sample React Native App
# https://github.com/facebook/react-native
###
'use strict'
React = require 'react-native'
{AppRegistry, StyleSheet, Text, View} = React
CoffeeProject = React.createClass
displayName: 'CoffeeProject'
render: ->
React.createElement View, style: styles.container,
React.createElement Text, style: styles.welcome, 'Welcome to React Native!'
React.createElement Text, style: styles.instructions, 'To get started, edit index.ios.coffee'
React.createElement Text, style: styles.instructions, 'Press Cmd+R to reload,', '\n', 'Cmd+D or shake for dev menu'
styles = StyleSheet.create
container:
flex: 1
justifyContent: 'center'
alignItems: 'center'
backgroundColor: '#6F4E37'
welcome:
fontSize: 20
textAlign: 'center'
margin: 10
color: '#cccccc'
instructions:
textAlign: 'center'
color: '#cccccc'
marginBottom: 5
AppRegistry.registerComponent 'CoffeeProject', ->
CoffeeProject
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;
var AwesomeProject = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.ios.js
</Text>
<Text style={styles.instructions}>
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
</Text>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment