-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
71 lines (64 loc) · 1.92 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React from 'react';
import { StyleSheet, Text, View, Image } from 'react-native';
import MapView, { AnimatedRegion, Animated, PROVIDER_GOOGLE, Marker, Circle } from 'react-native-maps';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = this.getInitialState()
}
getInitialState() {
return {
region: new AnimatedRegion({
latitude: -6.2261,
longitude: 106.8400,
latitudeDelta: 0.03,
longitudeDelta: 0.045,
}),
};
}
onRegionChange(region) {
this.state.region.setValue(region);
}
render() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Test Map</Text>
<Animated
provider={PROVIDER_GOOGLE}
region={this.state.region}
style={styles.map}
onRegionChange={this.onRegionChange.bind(this)}
>
<Marker title={'Test'} description={'You are here'} coordinate={{
latitude: -6.2261,
longitude: 106.8400
}} >
<View><Image source={require('./personPin.png')} style={{ width: 40, height: 40, resizeMode: 'contain' }} /></View>
</Marker>
<Marker title={'Office'} description={'Office is here'} coordinate={{
latitude: -6.2264,
longitude: 106.8323
}} >
<View><Image source={require('./pinTrans.png')} style={{ width: 40, height: 40, resizeMode: 'contain' }} /></View>
</Marker>
<Circle center={{
latitude: -6.2264,
longitude: 106.8323
}} radius={700} strokeColor={'#1C86EE'} fillColor={'#1C86EE80'} />
</Animated>
</View>
);
}
}
const styles = StyleSheet.create({
map: {
height: 280,
width: 330
},
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});