Fix bugs and issues before first production build

This commit is contained in:
John Lyon-Smith
2018-04-09 08:37:07 -07:00
parent ee836def93
commit 094c9ba25c
5 changed files with 56 additions and 34 deletions

View File

@@ -12,6 +12,7 @@
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"android:release": "cd android; rm -rf ./app/build && ./gradlew assembleRelease",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js",
"postinstall": "sed -i '' 's/#import <RCTAnimation\\/RCTValueAnimatedNode.h>/#import \"RCTValueAnimatedNode.h\"/' ./node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h; sed -i '' 's/#import <fishhook\\/fishhook.h>/#import \"fishhook.h\"/' ./node_modules/react-native/Libraries/WebSocket/RCTReconnectingWebSocket.m"

View File

@@ -1,5 +1,5 @@
import React from 'react'
import { StyleSheet, View, TouchableHighlight, Image } from 'react-native'
import React from "react"
import { StyleSheet, View, TouchableHighlight, Image } from "react-native"
import {
ViroARSceneNavigator,
ViroARScene,
@@ -10,62 +10,75 @@ import {
ViroSpotLight,
Viro3DObject,
ViroSurface,
} from 'react-viro'
import autobind from 'autobind-decorator'
import backImage from './images/back.png'
} from "react-viro"
import autobind from "autobind-decorator"
import backImage from "./images/back.png"
const styles = {
buttons : {
buttons: {
height: 80,
width: 80,
},
}
const shapes = {
hardhat: { shape: require('./models/hardhat.obj'), materials: [ require('./models/hardhat.mtl') ] },
question: { shape: require('./models/question.obj'), materials: [ require('./models/question.mtl') ] },
clipboard: { shape: require('./models/question.obj'), materials: [ require('./models/clipboard.mtl') ] },
// hardhat: {
// shape: require("./models/hardhat.obj"),
// materials: [require("./models/hardhat.mtl")],
// },
// question: {
// shape: require("./models/question.obj"),
// materials: [require("./models/question.mtl")],
// },
// clipboard: {
// shape: require("./models/clipboard.obj"),
// materials: [require("./models/clipboard.mtl")],
// },
}
class WorkItemSceneAR extends React.Component {
constructor(props) {
super(props)
this.state = {
position: [0, .2, 0],
scale: [.2, .2, .2],
position: [0, 0.2, 0],
scale: [0.2, 0.2, 0.2],
}
}
render() {
return (
<ViroARScene>
<ViroAmbientLight color="#ffffff" intensity={200}/>
<ViroAmbientLight color="#ffffff" intensity={200} />
<ViroARPlane>
<ViroNode
visible={true}
position={this.state.position}
scale={this.state.scale}
key='hardhat'>
key="hardhat">
<ViroSpotLight
innerAngle={5}
outerAngle={20}
direction={[0, -1 ,0]}
direction={[0, -1, 0]}
position={[0, 4, 0]}
color="#ffffff"
castsShadow={true}
shadowNearZ={.1}
shadowNearZ={0.1}
shadowFarZ={6}
shadowOpacity={.9} />
shadowOpacity={0.9}
/>
<Viro3DObject
position={[0, 0, 0]}
source={shapes['hardhat'].shape}
type = "OBJ" />
source={shapes["hardhat"].shape}
type="OBJ"
/>
<ViroSurface
rotation={[-90, 0, 0]}
position={[0, -.001, 0]}
width={2.5} height={2.5}
position={[0, -0.001, 0]}
width={2.5}
height={2.5}
arShadowReceiver={true}
ignoreEventHandling={true} />
ignoreEventHandling={true}
/>
</ViroNode>
</ViroARPlane>
</ViroARScene>
@@ -76,23 +89,27 @@ class WorkItemSceneAR extends React.Component {
export class ARViewer extends React.Component {
constructor(props) {
super(props)
}
}
@autobind
_handlePress() {
this.props.history.replace('/')
this.props.history.replace("/")
}
render() {
return (
<View style={{ width: '100%', height: '100%' }} >
<View style={{ width: "100%", height: "100%" }}>
<ViroARSceneNavigator
style={{ width: '100%', height: '100%' }}
apiKey='06F37B6A-74DA-4A83-965A-7DE2209A5C46'
initialScene={{ scene: WorkItemSceneAR }} />
style={{ width: "100%", height: "100%" }}
apiKey="06F37B6A-74DA-4A83-965A-7DE2209A5C46"
initialScene={{ scene: WorkItemSceneAR }}
/>
<View style={{position: 'absolute', left: 30, right: 0, top: 50}}>
<TouchableHighlight style={styles.buttons} onPress={this._handlePress} underlayColor={'#00000000'} >
<View style={{ position: "absolute", left: 30, right: 0, top: 50 }}>
<TouchableHighlight
style={styles.buttons}
onPress={this._handlePress}
underlayColor={"#00000000"}>
<Image source={backImage} />
</TouchableHighlight>
</View>

View File

@@ -12,7 +12,6 @@ import MapView, { Marker } from "react-native-maps"
import { Icon, Header } from "../ui"
import { api } from "../API"
import autobind from "autobind-decorator"
import pinImage from "./images/pin.png"
import { ifIphoneX } from "react-native-iphone-x-helper"
import { workItemTypeText, pad } from "../util"
@@ -107,6 +106,7 @@ export class Home extends React.Component {
title="Work Item Map"
leftButton={{ icon: "logout", onPress: this.handleLogoutPress }}
rightButton={{ icon: "glasses", onPress: this.handleGlassesPress }}
disabled
/>
<MapView
ref={(ref) => {
@@ -137,7 +137,7 @@ export class Home extends React.Component {
workItemTypeText[workItem.workItemType]
}
description={workItem.address}
image={pinImage}
image={require("./images/pin.png")}
anchor={{ x: 0.5, y: 1.0 }}
onPress={(e) => this.handleMarkerPress(e, index)}
/>

View File

@@ -59,7 +59,7 @@ export class WorkItem extends React.Component {
isDisabled: (r) => !(r.anyModified && r.allValid),
},
location: {
isValid: true,
isValid: (r, v) => v !== "",
isReadOnly: true,
},
details: {

View File

@@ -35,9 +35,13 @@ export class BoundInput extends React.Component {
@autobind
handleChangeText(newText) {
const { binder, name } = this.props
const state = binder.getFieldState(name)
this.setState(binder.updateFieldValue(name, newText))
// TODO: Sometimes this is undefined and causes a crash?!
if (binder) {
const state = binder.getFieldState(name)
this.setState(binder.updateFieldValue(name, newText))
}
}
render() {