SectionList on home screen with API

This commit is contained in:
John Lyon-Smith
2018-04-08 18:33:21 -07:00
parent 5634acb967
commit 7891bb71c9
19 changed files with 1278 additions and 1201 deletions

View File

@@ -76,6 +76,12 @@ export class WorkItem extends React.Component {
this.state = {
binder: new FormBinder({}, WorkItem.bindings),
messageModal: null,
region: {
latitude: 43.653908,
longitude: -79.384293,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
}
const { search } = this.props.location
@@ -92,6 +98,12 @@ export class WorkItem extends React.Component {
workItem.location = formatLatLng(lat, lng)
this.setState({
binder: new FormBinder(workItem, WorkItem.bindings),
region: {
latitude: lat,
longitude: lng,
latitudeDelta: 0.01,
longitudeDelta: 0.01,
},
})
}
})
@@ -179,7 +191,7 @@ export class WorkItem extends React.Component {
}
render() {
const { binder, messageModal } = this.state
const { binder, messageModal, region } = this.state
return (
<View style={{ flex: 1 }}>
@@ -223,12 +235,7 @@ export class WorkItem extends React.Component {
showsTraffic={false}
showsIndoors={false}
zoomControlEnabled
initialRegion={{
latitude: 43.653908,
longitude: -79.384293,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
region={region}
onRegionChange={this.handleRegionChange}
/>
<Icon

View File

@@ -13,7 +13,13 @@ import { MessageModal } from "../Modal"
import autobind from "autobind-decorator"
import { SwipeListView } from "react-native-swipe-list-view"
import { api } from "../API"
import { workItemTypeEnum, formatLatLng, parseLatLng, pad } from "../util"
import {
workItemTypeEnum,
workItemTypeText,
formatLatLng,
parseLatLng,
pad,
} from "../util"
const styles = StyleSheet.create({
container: {
@@ -24,11 +30,6 @@ const styles = StyleSheet.create({
},
})
const workItemTypeText = workItemTypeEnum.reduce((result, item) => {
result[item.value] = item.text
return result
}, {})
export class WorkItemList extends React.Component {
constructor(props) {
super(props)