This file contains hidden or 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
| // Open the file in Xcode and modify this line with the next one | |
| jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; | |
| // Your Mac needs to be in the same network as your device | |
| jsCodeLocation = [NSURL URLWithString:@"http://ip-address-mac:8081/index.ios.bundle"]; |
This file contains hidden or 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
| TouchableHighlight, | |
| AlertIOS, | |
| } = React; | |
| ... | |
| onPress: function() { | |
| AlertIOS.alert('hello'); | |
| }, |
This file contains hidden or 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 MyProject = React.createClass({ | |
| onPress: function() { | |
| console.log('hello'); | |
| }, | |
| ... | |
| <TouchableHighlight onPress={this.onPress}> | |
| <Text style={styles.instructions}> | |
| Touch |
This file contains hidden or 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
| 'use strict'; | |
| var React = require('react-native'); | |
| var { | |
| AppRegistry, | |
| StyleSheet, | |
| Text, | |
| View, | |
| TouchableHighlight, | |
| // If you're not used to this synxtax (ES6), you can still write ES5 code |
This file contains hidden or 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
| render: function() { | |
| return ( | |
| <View style={styles.container}> | |
| <Text style={styles.welcome}> | |
| Welcome to React Native! | |
| </Text> | |
| <TouchableHighlight> | |
| <Text style={styles.instructions}> | |
| Touch | |
| </Text> |
This file contains hidden or 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
| nvm install iojs && nvm alias default iojs | |
| brew install watchman | |
| npm install -g react-native-cli | |
| react-native init myproject |
This file contains hidden or 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 co = require('co'); | |
| var i = 0 | |
| function getPromiseTime() { | |
| var t = ++i; | |
| return new Promise(function (resolve, reject) { | |
| setTimeout(function() { | |
| console.log(t + ' released'); |
This file contains hidden or 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
| // First version | |
| async function main() { | |
| var result1 = await request( "http://some.url.1" ); | |
| var data = JSON.parse( result1 ); | |
| var result2 = await request( "http://some.url.2?id=" + data.id ); | |
| var resp = JSON.parse( result2 ); | |
| console.log( "The value you asked for: " + resp.value ); | |
| } |
This file contains hidden or 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
| mkdir icon.iconset | |
| sips -z 16 16 icon.png --out icon.iconset/icon_16x16.png | |
| sips -z 32 32 icon.png --out icon.iconset/[email protected] | |
| sips -z 32 32 icon.png --out icon.iconset/icon_32x32.png | |
| sips -z 64 64 icon.png --out icon.iconset/[email protected] | |
| sips -z 128 128 icon.png --out icon.iconset/icon_128x128.png | |
| sips -z 256 256 icon.png --out icon.iconset/[email protected] | |
| sips -z 256 256 icon.png --out icon.iconset/icon_256x256.png | |
| sips -z 512 512 icon.png --out icon.iconset/[email protected] |
This file contains hidden or 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
| <link rel="import" href="../core-icon-button/core-icon-button.html"> | |
| <link rel="import" href="../core-toolbar/core-toolbar.html"> | |
| <link rel="import" href="../core-header-panel/core-header-panel.html"> | |
| <polymer-element name="my-element"> | |
| <template> | |
| <style> | |
| :host { | |
| position: absolute; |