forked from ReactVision/starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
55 lines (50 loc) · 1.17 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, {useState} from 'react';
import {StyleSheet} from 'react-native';
import {
ViroARScene,
ViroText,
ViroConstants,
ViroARSceneNavigator,
} from '@viro-community/react-viro';
const HelloWorldSceneAR = () => {
const [text, setText] = useState('Initializing AR...');
function onInitialized(state, reason) {
console.log('guncelleme', state, reason);
if (state === ViroConstants.TRACKING_NORMAL) {
setText('Hello World!');
} else if (state === ViroConstants.TRACKING_NONE) {
// Handle loss of tracking
}
}
return (
<ViroARScene onTrackingUpdated={onInitialized}>
<ViroText
text={text}
scale={[0.5, 0.5, 0.5]}
position={[0, 0, -1]}
style={styles.helloWorldTextStyle}
/>
</ViroARScene>
);
};
export default () => {
return (
<ViroARSceneNavigator
autofocus={true}
initialScene={{
scene: HelloWorldSceneAR,
}}
style={styles.f1}
/>
);
};
var styles = StyleSheet.create({
f1: {flex: 1},
helloWorldTextStyle: {
fontFamily: 'Arial',
fontSize: 30,
color: '#ffffff',
textAlignVertical: 'center',
textAlign: 'center',
},
});