-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.js
64 lines (55 loc) · 1.45 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
import React from 'react'
import { StyleSheet, Modal, View } from 'react-native'
import { Container } from './elements'
import FireMap from './modules/Fire/components/FireMap'
import GeolocationForm from './modules/Fire/containers/GeolocationFormContainer'
export default class App extends React.Component {
state = {
isModalVisible: false
}
constructor(props) {
super(props)
this.openModal = this.openModal.bind(this)
this.closeModal = this.closeModal.bind(this)
this.changeMapLocation = this.changeMapLocation.bind(this)
this.changeFireMarker = this.changeFireMarker.bind(this)
}
openModal() {
this.setState({
isModalVisible: true
})
}
closeModal () {
this.setState({
isModalVisible: false
})
}
changeMapLocation(location) {
this.setState({ location })
}
changeFireMarker(e) {
this.setState({
fireMarker: e.nativeEvent.coordinate
})
}
render() {
const { location, fireMarker } = this.state
return (
<Container>
<FireMap
onButtonPress={this.openModal}
changeLocation={this.changeMapLocation}
changeFireMarker={this.changeFireMarker}
location={location}
fireMarker={fireMarker}
/>
<GeolocationForm
location={location}
fireMarker={fireMarker}
isVisible={this.state.isModalVisible}
close={this.closeModal}
/>
</Container>
);
}
}