diff --git a/facemash.xcodeproj/project.pbxproj b/facemash.xcodeproj/project.pbxproj index 1318078..5f78b40 100644 --- a/facemash.xcodeproj/project.pbxproj +++ b/facemash.xcodeproj/project.pbxproj @@ -23,6 +23,7 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; + 94F4A2E11AF44C480015E266 /* email19.png in Resources */ = {isa = PBXBuildFile; fileRef = 94F4A2E01AF44C480015E266 /* email19.png */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -106,14 +107,14 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = node_modules/react-native/Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj; sourceTree = ""; }; + 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = "node_modules/react-native/Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj"; sourceTree = ""; }; 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = iOS/main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = ""; }; - 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = node_modules/react-native/Libraries/AdSupport/RCTAdSupport.xcodeproj; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = ""; }; + 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; + 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = "node_modules/react-native/Libraries/AdSupport/RCTAdSupport.xcodeproj"; sourceTree = ""; }; + 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; + 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; + 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; + 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; 00E356EE1AD99517003FC87E /* facemashTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = facemashTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 00E356F21AD99517003FC87E /* facemashTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = facemashTests.m; sourceTree = ""; }; @@ -124,9 +125,10 @@ 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = iOS/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = iOS/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iOS/main.m; sourceTree = ""; }; - 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = node_modules/react-native/React/React.xcodeproj; sourceTree = ""; }; - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = ""; }; - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = node_modules/react-native/Libraries/Text/RCTText.xcodeproj; sourceTree = ""; }; + 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; + 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; + 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; + 94F4A2E01AF44C480015E266 /* email19.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = email19.png; path = ../../Downloads/email19.png; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -288,6 +290,7 @@ 83CBB9F61A601CBA00E9B192 = { isa = PBXGroup; children = ( + 94F4A2E01AF44C480015E266 /* email19.png */, 13B07FAE1A68108700A75B9A /* facemash */, 832341AE1AAA6A7D00B99B32 /* Libraries */, 00E356EF1AD99517003FC87E /* facemashTests */, @@ -505,6 +508,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 94F4A2E11AF44C480015E266 /* email19.png in Resources */, 008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */, 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, diff --git a/iOS/Images.xcassets/facemash.imageset/Contents.json b/iOS/Images.xcassets/facemash.imageset/Contents.json new file mode 100644 index 0000000..bd3b193 --- /dev/null +++ b/iOS/Images.xcassets/facemash.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "filename" : "facemash@2x.png" + }, + { + "idiom" : "iphone", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iOS/Images.xcassets/facemash.imageset/facemash@2x.png b/iOS/Images.xcassets/facemash.imageset/facemash@2x.png new file mode 100644 index 0000000..ce17941 Binary files /dev/null and b/iOS/Images.xcassets/facemash.imageset/facemash@2x.png differ diff --git a/iOS/Images.xcassets/messages.imageset/Contents.json b/iOS/Images.xcassets/messages.imageset/Contents.json new file mode 100644 index 0000000..dbd9096 --- /dev/null +++ b/iOS/Images.xcassets/messages.imageset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "filename" : "messages@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iOS/Images.xcassets/messages.imageset/messages@2x.png b/iOS/Images.xcassets/messages.imageset/messages@2x.png new file mode 100644 index 0000000..54c962c Binary files /dev/null and b/iOS/Images.xcassets/messages.imageset/messages@2x.png differ diff --git a/iOS/Images.xcassets/settings.imageset/Contents.json b/iOS/Images.xcassets/settings.imageset/Contents.json new file mode 100644 index 0000000..d3a02da --- /dev/null +++ b/iOS/Images.xcassets/settings.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "filename" : "settings@2x.png" + }, + { + "idiom" : "iphone", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iOS/Images.xcassets/settings.imageset/settings@2x.png b/iOS/Images.xcassets/settings.imageset/settings@2x.png new file mode 100644 index 0000000..14949df Binary files /dev/null and b/iOS/Images.xcassets/settings.imageset/settings@2x.png differ diff --git a/index.ios.js b/index.ios.js index bfdeb59..c7610f6 100644 --- a/index.ios.js +++ b/index.ios.js @@ -1,7 +1,3 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - */ 'use strict'; var React = require('react-native'); @@ -10,44 +6,61 @@ var { StyleSheet, Text, View, + TabBarIOS, + StatusBarIOS } = React; +var FaceMashTab = require('./tabs/FaceMash'); + var facemash = React.createClass({ + getInitialState() { + return { + selectedTab: 'faceMash' + } + }, + changeTab(tabName) { + this.setState({ + selectedTab: tabName + }); + }, render: function() { return ( - - - Welcome to React Native! - - - To get started, edit index.ios.js - - - Press Cmd+R to reload,{'\n'} - Cmd+Control+Z for dev menu - - + + this.changeTab('faceMash') } + selected={ this.state.selectedTab === 'faceMash' }> + + + this.changeTab('messages') } + selected={ this.state.selectedTab === 'messages' }> + + Messages + + + this.changeTab('settings') } + selected={ this.state.selectedTab === 'settings' }> + + Settings + + + ); } }); 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, - }, + pageView: { + backgroundColor: '#fff', + flex: 1 + } }); AppRegistry.registerComponent('facemash', () => facemash); diff --git a/rest/config.yaml b/rest/config.yaml new file mode 100644 index 0000000..3586e89 --- /dev/null +++ b/rest/config.yaml @@ -0,0 +1,8 @@ +- request: + method: GET + url: ^/rest/mash?$ + response: + headers: + content-type: application/json + file: mash.json + latency : 300 \ No newline at end of file diff --git a/rest/mash.json b/rest/mash.json new file mode 100644 index 0000000..85e48d0 --- /dev/null +++ b/rest/mash.json @@ -0,0 +1,68 @@ +[ + { + "users": [ + { + "firstName": "Laurie", + "lastName": "Hunt", + "picture": "https://randomuser.me/api/portraits/women/9.jpg", + "score": "1549", + "won": "100", + "lost": "1", + "userID": 1 + }, + { + "firstName": "Sonia", + "lastName": "Alvarez", + "picture": "https://randomuser.me/api/portraits/women/15.jpg", + "score": "1234", + "won": "45", + "lost": "10", + "userID": 2 + } + ] + }, + { + "users": [ + { + "firstName": "Candice", + "lastName": "Chapman", + "picture": "https://randomuser.me/api/portraits/women/32.jpg", + "score": "1325", + "won": "59", + "lost": "20", + "userID": 3 + }, + { + "firstName": "Deann", + "lastName": "Hart", + "picture": "https://randomuser.me/api/portraits/women/19.jpg", + "score": "1452", + "won": "90", + "lost": "6", + "userID": 4 + } + ] + }, + { + "users": [ + { + "firstName": "Arlene", + "lastName": "Graham", + "picture": "https://randomuser.me/api/portraits/women/50.jpg", + "score": "1621", + "won": "105", + "lost": "9", + "userID": 5 + }, + { + "firstName": "Kathryn", + "lastName": "Martinez", + "picture": "https://randomuser.me/api/portraits/women/41.jpg", + "score": "1234", + "won": "45", + "lost": "10", + "userID": 6 + } + ] + } +] \ No newline at end of file diff --git a/tabs/.gitignore b/tabs/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tabs/FaceMash.js b/tabs/FaceMash.js new file mode 100644 index 0000000..8926d87 --- /dev/null +++ b/tabs/FaceMash.js @@ -0,0 +1,181 @@ +'use strict'; + +var React = require('react-native'); +var { + StyleSheet, + Text, + View, + Image, + StatusBarIOS, + ActivityIndicatorIOS + } = React; + +var Person = React.createClass({ + render: function() { + var person = this.props.person; + + return ( + + + + + { person.firstName } { person.lastName } + + + + WON + + + { person.won } + + + + + LOST + + + { person.lost } + + + + + SCORE + + + { person.score } + + + + + ) + } +}); + +var facemashTab = React.createClass({ + getInitialState: function() { + return { + list: [], + currentIndex: 0 + }; + }, + componentWillMount: function() { + StatusBarIOS.setStyle(1); + + console.log('mounted'); + + fetch('http://localhost:8882/rest/mash') + .then(res => res.json()) + .then(res => this.setState({ list: res })) + .catch(err => console.log(err)); + }, + render: function() { + var contents; + if (!this.state.list.length) { + contents = ( + + Loading + + + ) + } else { + var { list, currentIndex } = this.state; + + var record = list[currentIndex]; + + var people = record.users.map(person => ); + + contents = ( + + { people } + + ) + } + + return ( + + + FaceMash + + { contents } + + ); + } +}); + +var styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: '#fff' + }, + loading: { + flex: 1, + backgroundColor: '#fff', + justifyContent: 'center', + alignItems: 'center' + }, + loadingText: { + fontSize: 14, + marginBottom: 20 + }, + header: { + height: 50, + backgroundColor: '#760004', + paddingTop: 20, + alignItems: 'center' + }, + headerText: { + color: '#fff', + fontSize: 20, + fontWeight: 'bold' + }, + content: { + padding: 9 + }, + person: { + flex: 1, + margin: 10, + borderRadius: 3, + overflow: 'hidden' + }, + personInfo: { + borderLeftColor: 'rgba( 0, 0, 0, 0.1 )', + borderLeftWidth: 1, + borderRightColor: 'rgba( 0, 0, 0, 0.1 )', + borderRightWidth: 1, + borderBottomColor: 'rgba( 0, 0, 0, 0.1 )', + borderBottomWidth: 1, + padding: 10, + alignItems: 'center', + flexDirection: 'row' + }, + personImage: { + flex: 1, + height: 200 + }, + personName: { + fontSize: 18, + flex: 1, + paddingLeft: 5 + }, + personScore: { + flex: 0.25, + alignItems: 'center' + }, + personScoreHeader: { + color: 'rgba( 0, 0, 0, 0.3 )', + fontSize: 10, + fontWeight: 'bold' + }, + personScoreValue: { + color: 'rgba( 0, 0, 0, 0.6 )', + fontSize: 16 + }, + won: { + color: '#93C26D' + }, + lost: { + color: '#DD4B39' + } +}); + +module.exports = facemashTab; \ No newline at end of file