SectionList on home screen with API
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user