Open Devendra7409 opened 2 days ago
async ConfirmLocation(type) { this.setState({ selectedImageBase4: '', avatarSource: '', remarksNote: '', }); Geolocation.getCurrentPosition( async (position) => { const { latitude, longitude, accuracy } = position.coords; this.setState({ newLatLong: position }); if (this.state.flag == '0') { this.setState({ isLoading: true, latitude, longitude }); } else { this.setState({ isLoading: true, CheckOutLat: latitude, CheckOutLong: longitude }); }
if (this.state.flag == '0') { const val = await CommonFunctions.A1(latitude, longitude, '', 'ATTN', this.state.userId); this.setState({ GetPreInChecksMobPolicyData: val, CheckInDeviation: val.DeviationMsg, CheckInAddress: JSON.stringify(val.Address).slice(1, -1).replace(/[']/g, "") }); } else { const timeOutVal = await CommonFunctions.CheckOut(latitude, longitude, this.state.latitude, this.state.longitude, '', 'ATTN', this.state.userId); this.setState({ GetPreInChecksMobPolicyData: timeOutVal, CheckOutDeviation: timeOutVal?.DeviationMsg, CheckOutAddress: JSON.stringify(timeOutVal?.Address).slice(1, -1).replace(/[']/g, "") }); } if (type == 'timeinout') { this.setState({ timeinout: true }); } this.setState({ isLoading: false, showAlert: true }); }, (error) => { console.log("Error getting location:", error); this.setState({ isLoading: false, showAlert: true, error: error.message }); }, { enableHighAccuracy: true, timeout: 200000, maximumAge: 1000, distanceFilter: 0, }, );
}
same issue here.
async ConfirmLocation(type) { this.setState({ selectedImageBase4: '', avatarSource: '', remarksNote: '', }); Geolocation.getCurrentPosition( async (position) => { const { latitude, longitude, accuracy } = position.coords; this.setState({ newLatLong: position }); if (this.state.flag == '0') { this.setState({ isLoading: true, latitude, longitude }); } else { this.setState({ isLoading: true, CheckOutLat: latitude, CheckOutLong: longitude }); }
}