Fix update bug with work items and activities. Fix placement of item in AR view
This commit is contained in:
@@ -66,7 +66,6 @@ export class WorkItem extends React.Component {
|
||||
},
|
||||
photos: {
|
||||
isValid: (r, v) => v && v.length > 0,
|
||||
initValue: [],
|
||||
},
|
||||
details: {
|
||||
isValid: (r, v) => v !== "",
|
||||
@@ -84,7 +83,6 @@ export class WorkItem extends React.Component {
|
||||
binder: new FormBinder({}, WorkItem.bindings),
|
||||
messageModal: null,
|
||||
waitModal: null,
|
||||
region: config.initialRegion,
|
||||
}
|
||||
|
||||
const { search } = this.props.location
|
||||
@@ -104,10 +102,15 @@ export class WorkItem extends React.Component {
|
||||
longitudeDelta: 0.01,
|
||||
}
|
||||
|
||||
if (this.mapView) {
|
||||
this.mapView.animateToRegion(region)
|
||||
} else {
|
||||
this.goToRegion = region
|
||||
}
|
||||
|
||||
workItem.location = formatLatLng(lat, lng)
|
||||
this.setState({
|
||||
binder: new FormBinder(workItem, WorkItem.bindings),
|
||||
region,
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -209,6 +212,14 @@ export class WorkItem extends React.Component {
|
||||
)
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleOnMapReady() {
|
||||
if (this.goToRegion && this.mapView) {
|
||||
this.mapView.animateToRegion(this.goToRegion)
|
||||
this.goToRegion = null
|
||||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleStartAddressLookup(latLng) {
|
||||
api
|
||||
@@ -217,7 +228,6 @@ export class WorkItem extends React.Component {
|
||||
if (this.addressInput) {
|
||||
this.addressInput.handleChangeText(address)
|
||||
}
|
||||
this.setState({ region: this.mapView.region })
|
||||
})
|
||||
.catch(() => {
|
||||
if (this.addressInput) {
|
||||
@@ -237,7 +247,7 @@ export class WorkItem extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { binder, messageModal, waitModal, region } = this.state
|
||||
const { binder, messageModal, waitModal } = this.state
|
||||
|
||||
return (
|
||||
<View style={{ flex: 1 }}>
|
||||
@@ -284,8 +294,9 @@ export class WorkItem extends React.Component {
|
||||
showsIndoors={false}
|
||||
zoomControlEnabled={false}
|
||||
rotateEnabled={false}
|
||||
region={region}
|
||||
initialRegion={config.initialRegion}
|
||||
onRegionChange={this.handleRegionChange}
|
||||
onMapReady={this.handleOnMapReady}
|
||||
/>
|
||||
<Icon
|
||||
name="target"
|
||||
|
||||
Reference in New Issue
Block a user