-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.tsx
More file actions
204 lines (196 loc) · 5.78 KB
/
settings.tsx
File metadata and controls
204 lines (196 loc) · 5.78 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import Constants from 'expo-constants';
import * as Device from 'expo-device';
import * as React from 'react';
import { Linking, Pressable, StyleSheet, Switch, Text, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { setShowLogs, useShowLogs } from '@/components/settings-store';
import viroPkg from '@reactvision/react-viro/package.json';
const APP_VERSION =
Constants.expoConfig?.version ?? Constants.nativeAppVersion ?? 'unknown';
const VIRO_VERSION = (viroPkg as { version?: string }).version ?? 'unknown';
const DEVICE_MODEL = Device.modelName ?? 'unknown';
const DEVICE_OS = Device.osName ?? 'unknown';
const DEVICE_OS_VERSION = Device.osVersion ?? 'unknown';
function openLink(url: string): void {
Linking.openURL(url).catch(() => {});
}
export default function SettingsScreen() {
const showLogs = useShowLogs();
const insets = useSafeAreaInsets();
return (
<View style={[styles.container, { paddingBottom: insets.bottom + 16 }]}>
<View style={styles.section}>
<Pressable
onPress={() => setShowLogs(!showLogs)}
style={styles.row}
accessibilityRole="switch"
accessibilityState={{ checked: showLogs }}
>
<View style={styles.rowText}>
<Text style={styles.rowTitle}>Show logs</Text>
<Text style={styles.rowSubtitle}>
Display the on-screen debug log overlay inside scenes.
</Text>
</View>
<Switch
value={showLogs}
onValueChange={setShowLogs}
trackColor={{ false: '#3a3a44', true: '#4ea1ff' }}
thumbColor="#ffffff"
/>
</Pressable>
<View style={styles.versionBlock}>
<View style={styles.versionRow}>
<Text style={styles.versionLabel}>App version</Text>
<Text style={styles.versionValue}>{APP_VERSION}</Text>
</View>
<View style={styles.versionRow}>
<Text style={styles.versionLabel}>ViroReact version</Text>
<Text style={styles.versionValue}>{VIRO_VERSION}</Text>
</View>
<View style={styles.versionRow}>
<Text style={styles.versionLabel}>Device</Text>
<Text style={styles.versionValue}>{DEVICE_MODEL}</Text>
</View>
<View style={styles.versionRow}>
<Text style={styles.versionLabel}>OS</Text>
<Text style={styles.versionValue}>{DEVICE_OS}</Text>
</View>
<View style={styles.versionRow}>
<Text style={styles.versionLabel}>OS version</Text>
<Text style={styles.versionValue}>{DEVICE_OS_VERSION}</Text>
</View>
<Pressable
onPress={() => openLink('https://reactvision.xyz/quest-demo')}
style={({ pressed }) => [
styles.updateButton,
pressed && styles.updateButtonPressed,
]}
accessibilityRole="button"
>
<Text style={styles.updateButtonText}>Check For App Update</Text>
</Pressable>
</View>
</View>
<Text style={styles.footer}>
This demo app is built by{' '}
<Text
style={styles.footerLink}
onPress={() => openLink('https://x.com/oliedis')}
>
Oli Edis
</Text>
, the founder and CEO of{' '}
<Text
style={styles.footerLink}
onPress={() => openLink('https://reactvision.xyz')}
>
ReactVision
</Text>
. You can find the source code for this app on{' '}
<Text
style={styles.footerLink}
onPress={() =>
openLink(
'https://github.com/oliedis/reactvision-studio-integration-test'
)
}
>
GitHub
</Text>
.
</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#000000',
paddingHorizontal: 16,
paddingTop: 24,
},
section: {
backgroundColor: 'rgba(20, 10, 40, 0.55)',
borderRadius: 14,
borderWidth: 1,
borderColor: 'rgba(255, 255, 255, 0.18)',
overflow: 'hidden',
},
row: {
flexDirection: 'row',
alignItems: 'center',
paddingVertical: 16,
paddingHorizontal: 16,
gap: 16,
},
rowText: {
flex: 1,
},
rowTitle: {
color: '#ffffff',
fontFamily: 'Inter_600SemiBold',
fontSize: 16,
},
rowSubtitle: {
color: 'rgba(255, 255, 255, 0.65)',
fontFamily: 'Inter_400Regular',
fontSize: 13,
marginTop: 2,
},
versionBlock: {
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: 'rgba(255, 255, 255, 0.15)',
paddingHorizontal: 16,
paddingVertical: 12,
gap: 8,
},
versionRow: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
versionLabel: {
color: 'rgba(255, 255, 255, 0.7)',
fontFamily: 'Inter_400Regular',
fontSize: 13,
},
versionValue: {
color: '#ffffff',
fontSize: 13,
fontFamily: 'Courier',
},
footer: {
color: 'rgba(255, 255, 255, 0.55)',
fontFamily: 'Inter_400Regular',
fontSize: 12,
lineHeight: 18,
marginTop: 16,
paddingHorizontal: 4,
textAlign: 'center',
},
footerLink: {
color: '#ffffff',
fontFamily: 'Inter_600SemiBold',
textDecorationLine: 'underline',
},
updateButton: {
marginTop: 12,
paddingVertical: 12,
paddingHorizontal: 16,
borderRadius: 10,
backgroundColor: 'rgba(78, 161, 255, 0.18)',
borderWidth: 1,
borderColor: 'rgba(78, 161, 255, 0.5)',
alignItems: 'center',
justifyContent: 'center',
},
updateButtonPressed: {
backgroundColor: 'rgba(78, 161, 255, 0.32)',
},
updateButtonText: {
color: '#ffffff',
fontFamily: 'Inter_600SemiBold',
fontSize: 14,
},
});