-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
59 lines (52 loc) · 1.3 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
import React from 'react';
import MapView, { Marker } from 'react-native-maps';
import { StyleSheet, Text, View, Dimensions, Image } from 'react-native';
import injectionWells from './oilWells/injwells.json';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
injectionWells: [ ],
region: {
latitude: 36.9003240,
longitude: -98.2182600,
latitudeDelta: 30,
longitudeDelta: 40,
},
}
};
componentDidMount()
{this.setState({ injectionWells: injectionWells })
}
render() {
return (
<View style={styles.container}>
<MapView
initialRegion={this.state.region}
style={styles.mapStyle}
>
{this.state.injectionWells.map( (oilwell,index) => <Marker
key={index}
coordinate={{latitude: oilwell.LAT, longitude: oilwell.LONG}}
/>)}
</MapView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
mapStyle: {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
markerImage: {
width: 30,
height: 30,
},
});