Pre release tweaks

This commit is contained in:
John Lyon-Smith
2018-05-14 18:50:08 -07:00
parent 82f2828441
commit 5d67cb69b0
6 changed files with 38 additions and 40 deletions

View File

@@ -90,6 +90,7 @@ export class Activity extends React.Component {
waitModal: null,
messageModal: null,
progressModal: null,
uploadPercent: 0,
}
const { search } = this.props.location
@@ -261,10 +262,12 @@ export class Activity extends React.Component {
const {
binder,
messageModal,
progressModal,
waitModal,
region,
dateTime,
location,
uploadPercent,
} = this.state
return (

View File

@@ -65,7 +65,7 @@ export default class App extends React.Component {
path="/workItemList"
component={WorkItemList}
/>
<DefaultRoute redirect="/workItem" />
<DefaultRoute redirect="/home" />
</Switch>
</View>
</NativeRouter>

View File

@@ -80,6 +80,10 @@ export class WorkItem extends React.Component {
isValid: (r, v) => v !== "",
alwaysGet: true,
},
addActivity: {
noValue: true,
isDisabled: (r, v) => r.anyModified,
},
}
constructor(props) {
@@ -277,8 +281,8 @@ export class WorkItem extends React.Component {
@autobind
handleAddActivity() {
if (this.history) {
this.history.push(`/activity?workItemId=${this.binder._id}`)
if (this.props.history) {
this.props.history.push(`/activity?workItemId=${this.state.binder._id}`)
}
}
@@ -375,21 +379,12 @@ export class WorkItem extends React.Component {
{api.loggedInUser.administrator &&
binder._id && (
<View style={styles.panel}>
<TouchableOpacity
<BoundButton
name="addActivity"
title="Add Activity"
binder={binder}
onPress={this.handleAddActivity}
style={{
alignSelf: "center",
backgroundColor: "blue",
justifyContent: "center",
paddingHorizontal: 10,
height: 40,
width: "100%",
backgroundColor: "#3BB0FD",
}}>
<Text style={{ alignSelf: "center", color: "black" }}>
Add Activity
</Text>
</TouchableOpacity>
/>
</View>
)}
{isIphoneX ? <View style={{ height: 30, width: "100%" }} /> : null}

View File

@@ -2,31 +2,31 @@ import React from "react"
import { Platform } from "react-native"
export const config = {
localIPAddr: "192.168.1.175",
//localIPAddr: "192.168.1.14",
//localIPAddr: "192.168.1.175",
localIPAddr: "192.168.1.14",
viroAPIKey: "06F37B6A-74DA-4A83-965A-7DE2209A5C46",
googleGeocodeAPIKey: "AIzaSyCs4JVT6gysnY5dAJ7KjVJYeykLv_xz1GI",
googleGeocodeURL: "https://maps.googleapis.com/maps/api/geocode/json",
refererURL: "https://dar.kss.us.com",
defaultUser: "john@lyon-smith.org",
//defaultUser: "",
minGPSAccuracy: 50,
//minGPSAccuracy: 20,
//defaultUser: "john@lyon-smith.org",
defaultUser: "",
//minGPSAccuracy: 50,
minGPSAccuracy: 20,
minDistanceToItem: 10,
geocodeDelayMilliseconds: 500,
// This region is downtown Toronto
// initialRegion: {
// latitude: 43.653908,
// longitude: -79.384293,
// latitudeDelta: 0.0922,
// longitudeDelta: 0.0421,
// },
// This region is Bainbridge Island
initialRegion: {
latitude: 47.629536,
longitude: -122.524162,
latitude: 43.653908,
longitude: -79.384293,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
alwaysShowWorkItemInAR: true,
// This region is Bainbridge Island
// initialRegion: {
// latitude: 47.629536,
// longitude: -122.524162,
// latitudeDelta: 0.0922,
// longitudeDelta: 0.0421,
// },
// alwaysShowWorkItemInAR: true,
}

View File

@@ -34,7 +34,7 @@ export class BoundInput extends React.Component {
@autobind
handleChangeText(newText) {
if (this.props.binder) {
if (this && this.props && this.props.binder) {
this.setState(
this.props.binder.updateFieldValue(this.props.name, newText)
)

View File

@@ -11,6 +11,7 @@ import {
} from "react-native"
import { Icon } from "."
import ImagePicker from "react-native-image-picker"
import ImageResizer from "react-native-image-resizer"
import autobind from "autobind-decorator"
import { api } from "../API"
@@ -48,7 +49,7 @@ export class BoundPhotoPanel extends Component {
@autobind
handlePhotoPress(index) {
const { onUploadStarted, onUploadEnded } = this.props
const { onUploadStarted, onUploadEnded, onUploadProgress } = this.props
ImagePicker.showImagePicker(
{
@@ -67,11 +68,10 @@ export class BoundPhotoPanel extends Component {
const uri = response.path || response.uri
createResizedImage(uri, 800, 600, "JPEG", 80)
.then((newUri) => {
return
api.upload(newUri, this.props.onUploadProgress)
})
ImageResizer.createResizedImage(uri, 1024, 1024, "JPEG", 80)
.then((result) =>
api.upload(result.path || result.uri, onUploadProgress)
)
.then((uploadData) => {
if (onUploadEnded) {
onUploadEnded(true, uploadData)