Skip to content

Commit

Permalink
Added GEO, Pull-to-update
Browse files Browse the repository at this point in the history
  • Loading branch information
sallar committed May 30, 2015
1 parent 2f86e85 commit e67d814
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 74 deletions.
1 change: 0 additions & 1 deletion index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var {
* Main App
*/
class Lunchify extends Component {

render() {
return(
<Navigator
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"start": "node_modules/react-native/packager/packager.sh"
},
"dependencies": {
"react-native": "^0.4.4",
"react-native-refreshable-listview": "^1.2.0",
"react-native-router": "^0.1.3"
"react-native": "latest",
"react-native-router": "^0.1.3",
"react-refresh-control": "^2.0.3"
}
}
52 changes: 41 additions & 11 deletions reactClient.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,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 */; };
99C6E2E71B19B9CD00384371 /* libRCTRefreshControl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 99C6E2E61B19B9B900384371 /* libRCTRefreshControl.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -111,31 +112,39 @@
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
99C6E2E51B19B9B900384371 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 99C6E2E11B19B9B900384371 /* RCTRefreshControl.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RCTRefreshControl;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = iOS/main.jsbundle; sourceTree = "<group>"; };
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = "<group>"; };
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = node_modules/react-native/Libraries/AdSupport/RCTAdSupport.xcodeproj; sourceTree = "<group>"; };
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = "<group>"; };
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = "<group>"; };
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = "<group>"; };
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = "node_modules/react-native/Libraries/AdSupport/RCTAdSupport.xcodeproj"; sourceTree = "<group>"; };
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = "<group>"; };
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
00E356EE1AD99517003FC87E /* reactClientTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = reactClientTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* reactClientTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = reactClientTests.m; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* reactClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = reactClient.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iOS/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = iOS/AppDelegate.m; sourceTree = "<group>"; };
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = iOS/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = iOS/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iOS/main.m; sourceTree = "<group>"; };
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = node_modules/react-native/React/React.xcodeproj; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = node_modules/react-native/Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
99C6E2E11B19B9B900384371 /* RCTRefreshControl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTRefreshControl.xcodeproj; path = vendor/RCTRefreshControl/RCTRefreshControl.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -161,6 +170,7 @@
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
99C6E2E71B19B9CD00384371 /* libRCTRefreshControl.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -307,6 +317,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
99C6E2E11B19B9B900384371 /* RCTRefreshControl.xcodeproj */,
13B07FAE1A68108700A75B9A /* reactClient */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* reactClientTests */,
Expand All @@ -325,6 +336,14 @@
name = Products;
sourceTree = "<group>";
};
99C6E2E21B19B9B900384371 /* Products */ = {
isa = PBXGroup;
children = (
99C6E2E61B19B9B900384371 /* libRCTRefreshControl.a */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -414,6 +433,10 @@
ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
},
{
ProductGroup = 99C6E2E21B19B9B900384371 /* Products */;
ProjectRef = 99C6E2E11B19B9B900384371 /* RCTRefreshControl.xcodeproj */;
},
{
ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
Expand Down Expand Up @@ -521,6 +544,13 @@
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
99C6E2E61B19B9B900384371 /* libRCTRefreshControl.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRCTRefreshControl.a;
remoteRef = 99C6E2E51B19B9B900384371 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
Expand Down
28 changes: 28 additions & 0 deletions utils/Helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,34 @@ class Helpers {
isStatic: true
}
}

calcDistance(startPoint, endPoint) {
var RADIANS = Math.PI/180;
var EARTH_RADIUS = 6371;

var lat1, lat2, lng1, lng2;
var x, y, a, c;

lat1 = parseFloat(startPoint.lat) * RADIANS;
lat2 = parseFloat(endPoint.lat) * RADIANS;

lng1 = parseFloat(startPoint.lng) * RADIANS;
lng2 = parseFloat(endPoint.lng) * RADIANS;

x = Math.sin((lat2-lat1)/2);
y = Math.sin((lng2-lng1)/2);

// Harvesine formula
a = x * x + Math.cos(lat1) * Math.cos(lat2) *y * y;
c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));

// distance
return EARTH_RADIUS * c;
}

formatDistance(value) {
return (value < 1) ? parseInt(value * 1000) + ' m' : value.toPrecision(2) + ' km';
}
}

module.exports = new Helpers;
52 changes: 37 additions & 15 deletions utils/Styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ module.exports = {
margin: {
marginBottom: 10,
},
white: {
backgroundColor: 'white'
},
textContainer: {
flex: 1,
backgroundColor: 'white',
},
}),
/**
* Navigator
*/
NavigatorStyle: StyleSheet.create({
container: {
flex: 1,
},
header: {
backgroundColor: variables.brandColor
},
scene: {
backgroundColor: '#E6E9ED'
},
navbarText: {
color: 'white',
fontSize: 17,
Expand All @@ -33,17 +54,7 @@ module.exports = {
fontWeight: '600',
textAlign: 'center',
alignItems: 'center',
},
headerStyle: {
backgroundColor: variables.brandColor
},
white: {
backgroundColor: 'white'
},
textContainer: {
flex: 1,
backgroundColor: 'white',
},
}
}),
/**
* Venues
Expand Down Expand Up @@ -127,16 +138,27 @@ module.exports = {
badge: {
margin: 0,
padding: 0,
backgroundColor: '#dddddd',
borderColor: '#dddddd',
backgroundColor: '#E6E9ED',
borderColor: '#E6E9ED',
borderRadius: 10,
borderWidth: 4,
},
badgeText: {
margin: 0,
padding: 0,
paddingLeft: 3,
paddingRight: 3,
fontSize: 9,
backgroundColor: '#dddddd',
backgroundColor: '#E6E9ED',
},
}),
/**
* Indicator
*/
IndicatorStyles: StyleSheet.create({
wrapper: {
backgroundColor: '#ffffff',
height: 60,
marginTop: 10,
},
})
};
1 change: 1 addition & 0 deletions vendor/RCTRefreshControl
Submodule RCTRefreshControl added at 065367
24 changes: 7 additions & 17 deletions views/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var React = require('react-native'),
Router = require('react-native-router'),
{Stylesheet, Variables} = require('../utils/Styles');
{Stylesheet, NavigatorStyle} = require('../utils/Styles');

var {
StyleSheet,
Expand All @@ -23,11 +23,11 @@ class Navigator extends Component {
super(props);
}

returnTitle(title: string) {
renderTitle(title: string) {
return React.createClass({
render: function() {
return(
<Text style={[Stylesheet.text, Stylesheet.navbarText]}>{title}</Text>
<Text style={[Stylesheet.text, NavigatorStyle.navbarText]}>{title}</Text>
);
}
});
Expand All @@ -38,24 +38,14 @@ class Navigator extends Component {
<Router
firstRoute={{
name: this.props.title,
component: this.props.component
component: this.props.component,
titleComponent: this.renderTitle(this.props.title)
}}
headerStyle={Stylesheet.headerStyle}
headerStyle={NavigatorStyle.header}
bgStyle={NavigatorStyle.scene}
/>
);
}
}

/**
* Styles
*/
var styles = StyleSheet.create({
container: {
flex: 1,
},
header: {
backgroundColor: '#1D4E89'
}
});

module.exports = Navigator;
Loading

0 comments on commit e67d814

Please sign in to comment.