Upgrade to new form binder
This commit is contained in:
@@ -64,6 +64,10 @@ export class WorkItem extends React.Component {
|
||||
isValid: (r, v) => v !== "",
|
||||
isReadOnly: true,
|
||||
alwaysGet: true,
|
||||
initValue: null,
|
||||
pre: (v) =>
|
||||
v !== null && formatLatLng(v.coordinates[1], v.coordinates[0]),
|
||||
post: (v) => parseLatLng(v),
|
||||
},
|
||||
address: {
|
||||
isValid: true,
|
||||
@@ -105,10 +109,10 @@ export class WorkItem extends React.Component {
|
||||
.getWorkItem(id)
|
||||
.then((workItem) => {
|
||||
if (workItem) {
|
||||
const [lng, lat] = workItem.location.coordinates
|
||||
const [longitude, latitude] = workItem.location.coordinates
|
||||
const region = {
|
||||
latitude: lat,
|
||||
longitude: lng,
|
||||
latitude,
|
||||
longitude,
|
||||
latitudeDelta: 0.01,
|
||||
longitudeDelta: 0.01,
|
||||
}
|
||||
@@ -119,7 +123,6 @@ export class WorkItem extends React.Component {
|
||||
this.goToRegion = region
|
||||
}
|
||||
|
||||
workItem.location = formatLatLng(lat, lng)
|
||||
this.setState({
|
||||
binder: new FormBinder(workItem, WorkItem.bindings),
|
||||
})
|
||||
@@ -158,9 +161,7 @@ export class WorkItem extends React.Component {
|
||||
@autobind
|
||||
handleDonePress() {
|
||||
const { binder } = this.state
|
||||
let obj = binder.getModifiedFieldValues()
|
||||
|
||||
obj.location = parseLatLng(obj.location)
|
||||
let obj = binder.getmodifiedBindingValues()
|
||||
|
||||
if (!obj._id) {
|
||||
api
|
||||
|
||||
Reference in New Issue
Block a user