-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
140 lines (134 loc) · 4.2 KB
/
App.js
File metadata and controls
140 lines (134 loc) · 4.2 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
import React from 'react';
import { View, Text, StyleSheet, Platform } from 'react-native';
import { createStackNavigator } from '@react-navigation/stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';
import { ChatProvider } from './screens/ChatContext';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import Chat from './screens/Chat';
import MeteorScreen from './screens/Meteors';
import HomeScreen from './screens/Home';
import LaunchScreen from './screens/Launch';
import StarMapScreen from './screens/StarMap';
import SpaceCraftsScreen from './screens/SpaceCraft';
import AstroRunner from './screens/games/AstroRun';
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
const TabIcon = ({ emoji, label, focused }) => (
<View style={[tabStyles.iconWrapper, focused && tabStyles.iconWrapperActive]}>
{focused && <View style={tabStyles.glow} />}
<Text style={tabStyles.emoji}>{emoji}</Text>
{focused && <View style={tabStyles.activeDot} />}
</View>
);
const tabStyles = StyleSheet.create({
iconWrapper: {
alignItems: 'center',
justifyContent: 'center',
width: 52,
height: 44,
borderRadius: 14,
position: 'relative',
},
iconWrapperActive: {
backgroundColor: '#7B61FF18',
borderWidth: 1,
borderColor: '#7B61FF35',
},
glow: {
position: 'absolute',
width: 52,
height: 44,
borderRadius: 14,
backgroundColor: '#7B61FF',
opacity: 0.08,
},
emoji: {
fontSize: 20,
},
activeDot: {
position: 'absolute',
bottom: 3,
width: 4,
height: 4,
borderRadius: 2,
backgroundColor: '#7B61FF',
shadowColor: '#7B61FF',
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 1,
shadowRadius: 4,
},
});
function HomeStack() {
return (
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Meteors" component={MeteorScreen} />
<Stack.Screen name="StarMap" component={StarMapScreen} />
<Stack.Screen name="SpaceCraft" component={SpaceCraftsScreen} />
<Stack.Screen name="Launch" component={LaunchScreen} />
<Stack.Screen name="AstroGame" component={AstroRunner} />
</Stack.Navigator>
);
}
function App() {
return (
<ChatProvider>
<SafeAreaProvider>
<NavigationContainer>
<Tab.Navigator
screenOptions={({ route }) => ({
headerShown: false,
tabBarShowLabel: true,
tabBarStyle: {
backgroundColor: '#07061A',
borderTopWidth: 1,
borderTopColor: '#FFFFFF0A',
// height: Platform.OS === 'ios' ? 82 : 64,
// paddingBottom: Platform.OS === 'ios' ? 22 : 10,
paddingTop: 8,
paddingHorizontal: 20,
// Subtle top shadow / glow line
shadowColor: '#7B61FF',
shadowOffset: { width: 0, height: -2 },
shadowOpacity: 0.12,
shadowRadius: 12,
elevation: 20,
},
tabBarLabelStyle: {
fontSize: 10,
fontWeight: '700',
letterSpacing: 1.5,
marginTop: 10,
},
tabBarActiveTintColor: '#7B61FF',
tabBarInactiveTintColor: '#FFFFFF30',
tabBarIcon: ({ focused }) => {
const icons = { Home: '🌍', Chat: '🚀' };
return (
<TabIcon
emoji={icons[route.name]}
label={route.name}
focused={focused}
/>
);
},
})}
>
<Tab.Screen
name="Home"
component={HomeStack}
options={{ tabBarLabel: 'EXPLORE' }}
/>
<Tab.Screen
name="Chat"
component={Chat}
options={{ tabBarLabel: 'ASTRO AI' }}
/>
</Tab.Navigator>
</NavigationContainer>
</SafeAreaProvider>
</ChatProvider>
);
}
export default App;