map working

This commit is contained in:
Ramon Gebben
2016-01-16 11:12:01 +01:00
parent 63c4f8905d
commit 719eb2540c
2 changed files with 70 additions and 47 deletions

View File

@@ -12,12 +12,10 @@
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
@@ -65,18 +63,25 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/debug" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.facebook.react/react-native/0.17.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
@@ -87,14 +92,14 @@
<orderEntry type="library" exported="" name="react-native-0.17.1" level="project" />
<orderEntry type="library" exported="" name="imagepipeline-okhttp-0.8.1" level="project" />
<orderEntry type="library" exported="" name="imagepipeline-0.8.1" level="project" />
<orderEntry type="library" exported="" name="jsr305-3.0.0" level="project" />
<orderEntry type="library" exported="" name="stetho-1.2.0" level="project" />
<orderEntry type="library" exported="" name="jsr305-3.0.0" level="project" />
<orderEntry type="library" exported="" name="jackson-core-2.2.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.5.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.6.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.5.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.6.0" level="project" />
<orderEntry type="library" exported="" name="fbcore-0.8.1" level="project" />
<orderEntry type="library" exported="" name="drawee-0.8.1" level="project" />
<orderEntry type="library" exported="" name="android-jsc-r174650" level="project" />

View File

@@ -6,6 +6,7 @@
var React = require('react-native');
var RNGMap = require('react-native-gmaps');
var Polyline = require('react-native-gmaps/Polyline');
var {
AppRegistry,
StyleSheet,
@@ -74,45 +75,54 @@ var getMeHighMobile = React.createClass({
});
if(holaback) holaback(theOne);
},
onMapChange: function(e){
console.log(e);
},
onMapError: function(e){
console.log('map error -->', e);
},
render: function() {
var shops = this.state.shops.map((shop, i) => {
return(<Text key={shop.id} style={styles.instructions}>{shop.name}</Text>)
});
var gmhButton;
if( this.state.lastPosition !== 'unknown' && this.state.shops.length > 1 ){
gmhButton = <TouchableHighlight style={styles.button} onPress={this._getMeHigh}><Text style={styles.buttonText}>Get Me High</Text></TouchableHighlight>
if( this.state.theOne !== 'unknown') {
return this._renderMap();
}else {
return this._renderStart();
}
return (
<View style={styles.container}>
<Text>location: {JSON.stringify(this.state.lastPosition)}</Text>
<Text>TheOne: {JSON.stringify(this.state.theOne)}</Text>
{gmhButton}
<RNGMap
ref={'gmap'}
style={ { height: 500, width: 500 } }
markers={ [
{ coordinates: {lng: 0.1, lat: 51.0} },
{
coordinates: {lng: -0.1, lat: 51.0},
title: "Click marker to see this title!",
snippet: "Subtitle",
id: 0,
color: 120,
}
] }
zoomLevel={10}
onMapChange={(e) => console.log(e)}
onMapError={(e) => console.log('Map error --> ', e)}
center={ { lng: 52.3521678, lat: 4.8587894 } }
/*
* clickMarker shows Info Window of Marker with id: 0,
* hides Info Window if given null
*/
clickMarker={0}/>
</View>
);
},
_renderStart: function(){
if( this.state.lastPosition !== 'unknown' && this.state.shops.length > 1 ){
return(
<View style={styles.container}>
<TouchableHighlight style={styles.button} onPress={this._getMeHigh}>
<Text style={styles.buttonText}>Get Me High</Text>
</TouchableHighlight>
</View>);
}else {
return(<View style={styles.container}>
<Text style={styles.text}>Getting your location</Text>
</View>);
}
},
_renderMap: function(){
return (<RNGMap
ref={'gmap'}
style={ styles.map }
markers={ [
{
coordinates: this.state.theOne.location,
title: this.state.theOne.name,
snippet: "Subtitle",
id: 0,
color: 120,
}
] }
zoomLevel={ 13 }
onMapChange={(e) => console.log(e)}
onMapError={(e) => console.log('Map error --> ', e)}
center={ this.state.lastPosition }
clickMarker={0} />);
}
});
var styles = StyleSheet.create({
@@ -123,18 +133,26 @@ var styles = StyleSheet.create({
backgroundColor: '#F5FCFF',
padding: 20
},
welcome: {
text: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
map: {
flex: 1
},
button: {
padding: 10,
padding: 60,
margin: 20,
backgroundColor: '#7A1496'
width: 300,
height: 300,
backgroundColor: '#7A1496',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 300
},
buttonText: {
fontSize: 20,
fontSize: 60,
color: '#F5FCFF',
textAlign: 'center'
},