Get Android build working

This commit is contained in:
John Lyon-Smith
2018-03-31 17:58:02 -07:00
parent 06e9ec527c
commit aa622012cd
24 changed files with 531 additions and 4288 deletions

View File

@@ -1,17 +1,37 @@
import { Platform } from 'react-native'
import { Navigation } from 'react-native-navigation'
import { registerScreens } from './screens'
import React from 'react'
import { View, StyleSheet, Text, TouchableHighlight, Image } from 'react-native'
import {
ViroARSceneNavigator, ViroARScene, ViroARPlane, ViroBox
} from 'react-viro'
import { NativeRouter, Route, Link } from 'react-router-native'
import MapView from 'react-native-maps'
import { Home, Viewer, WorkItem, Admin, Login, Activity } from './screens'
// See https://github.com/facebook/react-native/issues/12981
console.ignoredYellowBox = [
'Setting a timer'
]
registerScreens()
Navigation.startSingleScreenApp({
screen: {
screen: 'app.Home',
title: 'Work Item Map',
export default class App extends React.Component {
render() {
return (
<NativeRouter>
<View style={styles.container}>
<Route exact path="/" component={Home}/>
<Route path="/viewer" component={Viewer}/>
<Route path="/workitem" component={WorkItem}/>
<Route path="/admin" component={Admin}/>
<Route path="/login" component={Login}/>
<Route path="/activity" component={Activity}/>
</View>
</NativeRouter>
)
}
}
const styles = StyleSheet.create({
container: {
width: '100%',
height: '100%',
},
})

View File

@@ -3,7 +3,7 @@ import { StyleSheet, View } from 'react-native'
import {
ViroARSceneNavigator, ViroARScene, ViroARPlane, ViroBox, ViroText, ViroAmbientLight
} from 'react-viro'
import createReactClass from 'create-react-class'
import autobind from 'autobind-decorator'
const styles = {
helloWorldTextStyle: {
@@ -13,16 +13,21 @@ const styles = {
textAlignVertical: 'center',
textAlign: 'center',
},
buttons : {
height: 80,
width: 80,
},
}
const WorkItemSceneAR = createReactClass({
getInitialState: function() {
return {
class WorkItemSceneAR extends React.Component {
constructor(props) {
super(props)
this.state = {
text : "Initializing AR..."
}
},
}
render: function() {
render() {
return (
<ViroARScene onTrackingInitialized={()=>{this.setState({text : "Hello World!"})}}>
<ViroAmbientLight color="#ffffff" intensity={200}/>
@@ -34,33 +39,35 @@ const WorkItemSceneAR = createReactClass({
</ViroARScene>
)
}
})
}
export class Viewer extends React.Component {
static navigatorStyle = {
navBarHidden: true,
}
static styles = StyleSheet.create({
container: {
flex: 1,
},
arScene: {
flex: 1,
},
})
constructor(props) {
super(props)
}
@autobind
_handlePress() {
this.props.history.replace('/')
}
render() {
return (
<View style={Viewer.styles.arScene}>
<View style={{ width: '100%', height: '100%' }} >
<ViroARSceneNavigator
style={{ width: '100%', height: '100%' }}
apiKey='06F37B6A-74DA-4A83-965A-7DE2209A5C46'
style={Viewer.styles.arScene}
initialScene={{ scene: WorkItemSceneAR }} debug={true} />
<View style={{position: 'absolute', left: 50, right: 0, top: 50}}>
<TouchableHighlight style={styles.buttons} onPress={this._handlePress} underlayColor={'#00000000'} >
<Image source={require("./images/back_arrow.png")} />
</TouchableHighlight>
</View>
</View>
)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB