-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
50 lines (45 loc) · 1.25 KB
/
App.js
File metadata and controls
50 lines (45 loc) · 1.25 KB
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
import React from 'react';
import { StyleSheet, Text, View , TextInput} from 'react-native';
import MapView, {Marker, PROVIDER_GOOGLE, PROVIDER_DEFAULT} from 'react-native-maps';
export default class App extends React.Component {
onRegionChange(region) {
console.log(region);
}
render() {
return (
<View style={styles.map}>
<MapView
onRegionChangeComplete={this.onRegionChange}
showsUserLocation={true}
// Replace PROVIDER_GOOGLE with PROVIDER_DEFAULT for Apple Maps on iOS
provider={PROVIDER_GOOGLE}
style={styles.mapReg}
initialRegion={{
latitude: 20.5937,
longitude: 78.9629,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
ref={c => this.mapView = c}>
<Marker coordinate={{
latitude: 20.5937,
longitude: 78.9629,
}}/>
</MapView>
</View>
);
}
}
const styles = StyleSheet.create({
map: {
position: "absolute",
height: '100%',
width: '100%',
flex: 1,
alignItems: "center",
backgroundColor: 'white',
},
mapReg: {
...StyleSheet.absoluteFillObject,
},
});