Adding Android ViroAR stuff
This commit is contained in:
@@ -5,7 +5,7 @@ import { AsyncStorage } from 'react-native'
|
||||
const authTokenName = 'AuthToken'
|
||||
let baseURL = null
|
||||
let apiPath = null
|
||||
|
||||
//
|
||||
if (__DEV__) {
|
||||
const localIPAddr = process.env.LOCAL_IP_ADDR
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@ import { Platform } from 'react-native'
|
||||
import { Navigation } from 'react-native-navigation'
|
||||
import { registerScreens } from './screens'
|
||||
|
||||
// See https://github.com/facebook/react-native/issues/12981
|
||||
console.ignoredYellowBox = [
|
||||
'Setting a timer'
|
||||
]
|
||||
|
||||
registerScreens()
|
||||
|
||||
Navigation.startSingleScreenApp({
|
||||
|
||||
@@ -100,7 +100,9 @@ export class Home extends React.Component {
|
||||
return (
|
||||
<View style={Home.styles.container}>
|
||||
<MapView
|
||||
style={{ width: '100%', height: '50%' }}
|
||||
style={{
|
||||
width: '100%', height: '50%',
|
||||
}}
|
||||
zoomControlEnabled
|
||||
initialRegion={{
|
||||
latitude: 43.653908,
|
||||
|
||||
@@ -69,7 +69,7 @@ export class Login extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
binder: new FormBinder({email: 'john@lyon-smith.org', password: 'Skunkay'}, Login.bindings)
|
||||
binder: new FormBinder({email: 'john@lyon-smith.org'}, Login.bindings)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export class Login extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<KeyboardAvoidingView style={Login.styles.page} behavior='padding'
|
||||
keyboardVerticalOffset={Platform.select({ios: 0, android: 200})}>
|
||||
keyboardVerticalOffset={Platform.select({ios: 0, android: -220})}>
|
||||
<Image style={Login.styles.logo} source={logoImage} resizeMode='contain' />
|
||||
<View style={Login.styles.inputRow}>
|
||||
<BoundInput name='email' label='Email:' placeholder='name@xyz.com' message='Must enter a valid email' binder={this.state.binder} />
|
||||
|
||||
@@ -1,6 +1,40 @@
|
||||
import React from 'react'
|
||||
import { StyleSheet, View, TouchableOpacity, Image } from 'react-native'
|
||||
import backImage from './images/back.png'
|
||||
import { StyleSheet, View } from 'react-native'
|
||||
import {
|
||||
ViroARSceneNavigator, ViroARScene, ViroARPlane, ViroBox, ViroText, ViroAmbientLight
|
||||
} from 'react-viro'
|
||||
import createReactClass from 'create-react-class'
|
||||
|
||||
const styles = {
|
||||
helloWorldTextStyle: {
|
||||
fontFamily: 'Arial',
|
||||
fontSize: 30,
|
||||
color: '#ffffff',
|
||||
textAlignVertical: 'center',
|
||||
textAlign: 'center',
|
||||
},
|
||||
}
|
||||
|
||||
const WorkItemSceneAR = createReactClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
text : "Initializing AR..."
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<ViroARScene onTrackingInitialized={()=>{this.setState({text : "Hello World!"})}}>
|
||||
<ViroAmbientLight color="#ffffff" intensity={200}/>
|
||||
<ViroText text={this.state.text} scale={[.5, .5, .5]} position={[0, 0, -1]}
|
||||
style={styles.helloWorldTextStyle} />
|
||||
<ViroARPlane>
|
||||
<ViroBox position={[0, .5, 0]} />
|
||||
</ViroARPlane>
|
||||
</ViroARScene>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
export class Viewer extends React.Component {
|
||||
static navigatorStyle = {
|
||||
@@ -9,35 +43,25 @@ export class Viewer extends React.Component {
|
||||
|
||||
static styles = StyleSheet.create({
|
||||
container: {
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
justifyContent: 'flex-start',
|
||||
backgroundColor: '#AAAAAA',
|
||||
},
|
||||
button: {
|
||||
marginTop: 40,
|
||||
marginLeft: 20,
|
||||
width: 45,
|
||||
height: 45,
|
||||
}
|
||||
flex: 1,
|
||||
},
|
||||
arScene: {
|
||||
flex: 1,
|
||||
},
|
||||
})
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this._handlePressButton = this._handlePressButton.bind(this)
|
||||
}
|
||||
|
||||
_handlePressButton() {
|
||||
this.props.navigator.pop()
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={Viewer.styles.container}>
|
||||
<TouchableOpacity onPress={this._handlePressButton}>
|
||||
<Image style={Viewer.styles.button} source={backImage} />
|
||||
</TouchableOpacity>
|
||||
<View style={Viewer.styles.arScene}>
|
||||
<ViroARSceneNavigator
|
||||
apiKey='06F37B6A-74DA-4A83-965A-7DE2209A5C46'
|
||||
style={Viewer.styles.arScene}
|
||||
initialScene={{ scene: WorkItemSceneAR }} debug={true} />
|
||||
</View>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user