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": { "scripts": {
"start": "react-native start", "start": "react-native start",
"android": "react-native run-android", "android": "react-native run-android",
"android:release": "cd android; rm -rf ./app/build && ./gradlew assembleRelease",
"ios": "react-native run-ios", "ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js", "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" "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 React from "react"
import { StyleSheet, View, TouchableHighlight, Image } from 'react-native' import { StyleSheet, View, TouchableHighlight, Image } from "react-native"
import { import {
ViroARSceneNavigator, ViroARSceneNavigator,
ViroARScene, ViroARScene,
@@ -10,9 +10,9 @@ import {
ViroSpotLight, ViroSpotLight,
Viro3DObject, Viro3DObject,
ViroSurface, ViroSurface,
} from 'react-viro' } from "react-viro"
import autobind from 'autobind-decorator' import autobind from "autobind-decorator"
import backImage from './images/back.png' import backImage from "./images/back.png"
const styles = { const styles = {
buttons: { buttons: {
@@ -22,17 +22,26 @@ const styles = {
} }
const shapes = { const shapes = {
hardhat: { shape: require('./models/hardhat.obj'), materials: [ require('./models/hardhat.mtl') ] }, // hardhat: {
question: { shape: require('./models/question.obj'), materials: [ require('./models/question.mtl') ] }, // shape: require("./models/hardhat.obj"),
clipboard: { shape: require('./models/question.obj'), materials: [ require('./models/clipboard.mtl') ] }, // 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 { class WorkItemSceneAR extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
position: [0, .2, 0], position: [0, 0.2, 0],
scale: [.2, .2, .2], scale: [0.2, 0.2, 0.2],
} }
} }
@@ -45,7 +54,7 @@ class WorkItemSceneAR extends React.Component {
visible={true} visible={true}
position={this.state.position} position={this.state.position}
scale={this.state.scale} scale={this.state.scale}
key='hardhat'> key="hardhat">
<ViroSpotLight <ViroSpotLight
innerAngle={5} innerAngle={5}
outerAngle={20} outerAngle={20}
@@ -53,19 +62,23 @@ class WorkItemSceneAR extends React.Component {
position={[0, 4, 0]} position={[0, 4, 0]}
color="#ffffff" color="#ffffff"
castsShadow={true} castsShadow={true}
shadowNearZ={.1} shadowNearZ={0.1}
shadowFarZ={6} shadowFarZ={6}
shadowOpacity={.9} /> shadowOpacity={0.9}
/>
<Viro3DObject <Viro3DObject
position={[0, 0, 0]} position={[0, 0, 0]}
source={shapes['hardhat'].shape} source={shapes["hardhat"].shape}
type = "OBJ" /> type="OBJ"
/>
<ViroSurface <ViroSurface
rotation={[-90, 0, 0]} rotation={[-90, 0, 0]}
position={[0, -.001, 0]} position={[0, -0.001, 0]}
width={2.5} height={2.5} width={2.5}
height={2.5}
arShadowReceiver={true} arShadowReceiver={true}
ignoreEventHandling={true} /> ignoreEventHandling={true}
/>
</ViroNode> </ViroNode>
</ViroARPlane> </ViroARPlane>
</ViroARScene> </ViroARScene>
@@ -80,19 +93,23 @@ export class ARViewer extends React.Component {
@autobind @autobind
_handlePress() { _handlePress() {
this.props.history.replace('/') this.props.history.replace("/")
} }
render() { render() {
return ( return (
<View style={{ width: '100%', height: '100%' }} > <View style={{ width: "100%", height: "100%" }}>
<ViroARSceneNavigator <ViroARSceneNavigator
style={{ width: '100%', height: '100%' }} style={{ width: "100%", height: "100%" }}
apiKey='06F37B6A-74DA-4A83-965A-7DE2209A5C46' apiKey="06F37B6A-74DA-4A83-965A-7DE2209A5C46"
initialScene={{ scene: WorkItemSceneAR }} /> initialScene={{ scene: WorkItemSceneAR }}
/>
<View style={{position: 'absolute', left: 30, right: 0, top: 50}}> <View style={{ position: "absolute", left: 30, right: 0, top: 50 }}>
<TouchableHighlight style={styles.buttons} onPress={this._handlePress} underlayColor={'#00000000'} > <TouchableHighlight
style={styles.buttons}
onPress={this._handlePress}
underlayColor={"#00000000"}>
<Image source={backImage} /> <Image source={backImage} />
</TouchableHighlight> </TouchableHighlight>
</View> </View>

View File

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

View File

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

View File

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