-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
326 lines (308 loc) · 9.38 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
import React, { useState, useEffect } from 'react';
import StoreProvider from './src/context/Context';
import { NavigationContainer } from '@react-navigation/native';
import BottomTabBar from './src/components/BottomTabBar';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import Journaling from './src/screens/journaling/Journaling';
import JournalCategory from './src/screens/journaling/JournalCategory';
import JournalSuccess from './src/screens/journaling/JournalSuccess';
import { MMKV } from 'react-native-mmkv';
import JournalEmotions from './src/screens/journaling/JournalEmotions';
import JournalThoughts from './src/screens/journaling/JournalThoughts';
import BlurredEllipsesBackground from './src/components/BlurredEllipsesBackground';
import { View } from 'react-native';
import Learn from './src/screens/learn/Learn';
import LearnDetail from './src/screens/learn/LearnDetail';
import CognitiveRestructuing from './src/screens/thoughts/CognitiveRestructuring';
import CognitiveDetail from './src/screens/thoughts/CognitiveDetail';
import CognitiveAnotherWay from './src/screens/thoughts/CognitiveAnotherWay';
import SuccessDetail from './src/screens/thoughts/SuccessScreen';
import { sendMessage, watchEvents } from 'react-native-watch-connectivity';
import {
Alert,
SafeAreaView,
Text,
TextInput,
TouchableOpacity,
} from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import ManageRecoveryPreferences from './src/screens/dashboard/ManageRecoveryPreferences';
import Settings from './src/screens/dashboard/Settings';
import ManageEmergencyContacts from './src/screens/dashboard/ManageEmergencyContacts';
import JournalDetail from './src/screens/journaling/JournalDetail';
import {
SafeAreaInsetsContext,
SafeAreaProvider,
} from 'react-native-safe-area-context';
import CreateGoal from './src/screens/goal/CreateGoal';
import GroundingJourney from './src/screens/grounding/GroundingJourney';
import GroundingSteps from './src/screens/grounding/GroundingSteps';
import OnboardingScreen from './src/screens/onboarding/Onboarding';
import OnboardingDetailOne from './src/screens/onboarding/OnboardingDetailOne';
import OnboardingDetailTwo from './src/screens/onboarding/OnboardingDetailTwo';
import ThoughtsReframingMain from './src/screens/thoughts/ThoughtsReframingMain';
import LearnCategory from './src/screens/learn/LearnCategory';
const Stack = createNativeStackNavigator();
const nestedHeaderOptions = {
headerTitle: '',
headerTransparent: true,
headerBlurEffect: 'dark',
};
export const storage = new MMKV();
const MyTheme = {
dark: false,
colors: {
primary: 'rgb(255, 45, 85)',
background: 'rgb(242, 242, 242)',
card: 'rgb(255, 255, 255)',
text: 'white',
border: 'rgb(199, 199, 204)',
notification: 'rgb(255, 69, 58)',
},
};
function App() {
const [messageFromWatch, setMessageFromWatch] = useState('Waiting...');
const [message, setMessage] = useState('');
const [isOnboard, setIsOnboard] = useState(false);
const [loading, setLoading] = useState(true);
// Listener when receive message
const messageListener = () =>
watchEvents.on('message', message => {
setMessageFromWatch(message.watchMessage);
});
useEffect(() => {
messageListener();
}, []);
useEffect(() => {
let temp = storage.getString('isOnboarded');
if (temp) {
setIsOnboard(true);
setLoading(false);
return;
}
setLoading(false);
}, [isOnboard]);
return (
<SafeAreaProvider>
<StoreProvider>
{/* <BlurredEllipsesBackground> */}
<GestureHandlerRootView style={{ flex: 1 }}>
<NavigationContainer theme={MyTheme}>
{/* <View style={{ flex: 1, backgroundColor: '#0F1720' }}> */}
<Stack.Navigator
screenOptions={{
headerShown: false,
contentStyle: {
// backgroundColor: 'black'
},
}}>
{!isOnboard && <Stack.Group screenOptions={{ headerShown: false }}>
<Stack.Screen
name="Onboarding"
component={OnboardingScreen}
options={{
...nestedHeaderOptions,
headerBackTitle: '',
}}
/>
<Stack.Screen
name="Onboarding Detail One"
component={OnboardingDetailOne}
options={{
...nestedHeaderOptions,
headerBackTitle: '',
}}
/>
<Stack.Screen
name="Onboarding Detail Two"
component={OnboardingDetailTwo}
options={{
...nestedHeaderOptions,
headerBackTitle: '',
}}
/>
</Stack.Group>
}
<Stack.Screen name="Root" component={BottomTabBar} />
{/* Settings */}
<Stack.Group screenOptions={{ headerShown: true }}>
<Stack.Screen
name="Settings"
component={Settings}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Dashboard',
}}
/>
<Stack.Screen
name="Manage Emergency Contact"
component={ManageEmergencyContacts}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Settings',
}}
/>
<Stack.Screen
name="Manage Recovery Preferences"
component={ManageRecoveryPreferences}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Settings',
}}
/>
</Stack.Group>
{/* Recovery Screens */}
<Stack.Group screenOptions={{ headerShown: true }}>
<Stack.Screen
name="Journaling"
component={Journaling}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Recovery',
}}
/>
<Stack.Screen
name="Journal Category"
component={JournalCategory}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Journaling',
}}
/>
<Stack.Screen
name="Journal Emotions"
component={JournalEmotions}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Category',
}}
/>
<Stack.Screen
name="Journal Thoughts"
component={JournalThoughts}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Emotions',
}}
/>
<Stack.Screen
name="Journal Success"
component={JournalSuccess}
options={{
...nestedHeaderOptions,
headerShown: false,
gestureEnabled: false
}}
/>
<Stack.Screen
name="Journal Detail"
component={JournalDetail}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Journaling',
}}
/>
</Stack.Group>
{/* Grounding Technique */}
<Stack.Group screenOptions={{ headerShown: true }}>
<Stack.Screen
name="Five Senses"
component={GroundingJourney}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Recovery',
}}
/>
<Stack.Screen
name="Grounding Steps"
component={GroundingSteps}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Five Senses',
}}
/>
</Stack.Group>
{/* Learn Screens */}
<Stack.Group screenOptions={{ headerShown: true }}>
<Stack.Screen
name="Learn"
component={Learn}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Recovery',
}}
/>
<Stack.Screen
name="Learn Detail"
component={LearnDetail}
options={{ ...nestedHeaderOptions, headerBackTitle: 'Learn' }}
/>
<Stack.Screen
name="Learn Category"
component={LearnCategory}
options={{ ...nestedHeaderOptions, headerBackTitle: 'Learn' }}
/>
</Stack.Group>
{/* Thoughts Reframing Screens */}
<Stack.Group screenOptions={{ headerShown: true }}>
<Stack.Screen
name="Thoughts Reframing"
component={ThoughtsReframingMain}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Recovery',
}}
/>
<Stack.Screen
name="Cognitive Restructuring"
component={CognitiveRestructuing}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Recovery',
}}
/>
<Stack.Screen
name="Cognitive Detail"
component={CognitiveDetail}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Recovery',
}}
/>
<Stack.Screen
name="Cognitive Another Way"
component={CognitiveAnotherWay}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Recovery',
}}
/>
<Stack.Screen
name="Success Screen"
component={SuccessDetail}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Recovery',
gestureEnabled: false
}}
/>
</Stack.Group>
<Stack.Screen
name="Create a Goal"
component={CreateGoal}
options={{
...nestedHeaderOptions,
headerBackTitle: 'Details',
gestureEnabled: false
}}
/>
</Stack.Navigator>
{/* </View> */}
</NavigationContainer>
</GestureHandlerRootView>
{/* </BlurredEllipsesBackground> */}
</StoreProvider>
</SafeAreaProvider>
);
}
export default App;