This commit is contained in:
parent
4c1765b09a
commit
806f20482d
|
@ -31,6 +31,19 @@ export function ScreenInfo2() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ScreenInfo3() {
|
||||||
|
return (
|
||||||
|
<View style={styles.settingsContainer}>
|
||||||
|
<Text
|
||||||
|
style={styles.settingsText}
|
||||||
|
lightColor="rgba(0,0,0,0.8)"
|
||||||
|
darkColor="rgba(255,255,255,0.8)">
|
||||||
|
Green Travel Carbon Calculator v. 2
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
settingsContainer: {
|
settingsContainer: {
|
||||||
marginHorizontal: 50,
|
marginHorizontal: 50,
|
||||||
|
|
|
@ -10,9 +10,10 @@ import * as React from 'react';
|
||||||
|
|
||||||
import Colors from '../constants/Colors';
|
import Colors from '../constants/Colors';
|
||||||
import useColorScheme from '../hooks/useColorScheme';
|
import useColorScheme from '../hooks/useColorScheme';
|
||||||
|
import SplashScreen from '../screens/SplashScreen';
|
||||||
import TripScreen from '../screens/TripScreen';
|
import TripScreen from '../screens/TripScreen';
|
||||||
import SettingsScreen from '../screens/SettingsScreen';
|
import SettingsScreen from '../screens/SettingsScreen';
|
||||||
import { BottomTabParamList, TripParamList, SettingsParamList } from '../types';
|
import { SplashParamList, BottomTabParamList, TripParamList, SettingsParamList } from '../types';
|
||||||
|
|
||||||
const BottomTab = createBottomTabNavigator<BottomTabParamList>();
|
const BottomTab = createBottomTabNavigator<BottomTabParamList>();
|
||||||
|
|
||||||
|
@ -21,11 +22,11 @@ export default function BottomTabNavigator() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BottomTab.Navigator
|
<BottomTab.Navigator
|
||||||
initialRouteName="Trip"
|
initialRouteName="Splash"
|
||||||
tabBarOptions={{ activeTintColor: Colors[colorScheme].tint }}>
|
tabBarOptions={{ activeTintColor: Colors[colorScheme].tint }}>
|
||||||
<BottomTab.Screen
|
<BottomTab.Screen
|
||||||
name="Trip"
|
name="Home"
|
||||||
component={TripNavigator}
|
component={SplashNavigator}
|
||||||
options={{
|
options={{
|
||||||
tabBarIcon: ({ color }) => <TabBarIcon name="ios-code" color={color} />,
|
tabBarIcon: ({ color }) => <TabBarIcon name="ios-code" color={color} />,
|
||||||
}}
|
}}
|
||||||
|
@ -37,6 +38,13 @@ export default function BottomTabNavigator() {
|
||||||
tabBarIcon: ({ color }) => <TabBarIcon name="ios-code" color={color} />,
|
tabBarIcon: ({ color }) => <TabBarIcon name="ios-code" color={color} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<BottomTab.Screen
|
||||||
|
name="Trip"
|
||||||
|
component={TripNavigator}
|
||||||
|
options={{
|
||||||
|
tabBarIcon: ({ color }) => <TabBarIcon name="ios-code" color={color} />,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</BottomTab.Navigator>
|
</BottomTab.Navigator>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -49,8 +57,21 @@ function TabBarIcon(props: { name: React.ComponentProps<typeof Ionicons>['name']
|
||||||
|
|
||||||
// Each tab has its own navigation stack, you can read more about this pattern here:
|
// Each tab has its own navigation stack, you can read more about this pattern here:
|
||||||
// https://reactnavigation.org/docs/tab-based-navigation#a-stack-navigator-for-each-tab
|
// https://reactnavigation.org/docs/tab-based-navigation#a-stack-navigator-for-each-tab
|
||||||
|
const SplashStack = createStackNavigator<TripParamList>();
|
||||||
const TripStack = createStackNavigator<TripParamList>();
|
const TripStack = createStackNavigator<TripParamList>();
|
||||||
|
|
||||||
|
function SplashNavigator() {
|
||||||
|
return (
|
||||||
|
<SplashStack.Navigator>
|
||||||
|
<SplashStack.Screen
|
||||||
|
name="SplashScreen"
|
||||||
|
component={SplashScreen}
|
||||||
|
options={{ headerTitle: 'Green Travel' }}
|
||||||
|
/>
|
||||||
|
</SplashStack.Navigator>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function TripNavigator() {
|
function TripNavigator() {
|
||||||
return (
|
return (
|
||||||
<TripStack.Navigator>
|
<TripStack.Navigator>
|
||||||
|
|
|
@ -12,14 +12,19 @@ export default {
|
||||||
screens: {
|
screens: {
|
||||||
Root: {
|
Root: {
|
||||||
screens: {
|
screens: {
|
||||||
|
Splash: {
|
||||||
|
screens: {
|
||||||
|
SplashScreen: 'one',
|
||||||
|
},
|
||||||
|
},
|
||||||
Trip: {
|
Trip: {
|
||||||
screens: {
|
screens: {
|
||||||
TripScreen: 'one',
|
TripScreen: 'two',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Settings: {
|
Settings: {
|
||||||
screens: {
|
screens: {
|
||||||
SettingsScreen: 'two',
|
SettingsScreen: 'three',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,11 +26,11 @@ export default function SettingsScreen() {
|
||||||
<View style={styles.controls} >
|
<View style={styles.controls} >
|
||||||
<Button
|
<Button
|
||||||
title="Jet"
|
title="Jet"
|
||||||
onPress={() => Alert.alert('Jet Fuel Selected')}
|
onPress={() => Alert.alert('Jet Fuel Selected \n 285 g / passenger / km')}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
title="Gasoline"
|
title="Gasoline"
|
||||||
onPress={() => Alert.alert('Gasoline Selected')}
|
onPress={() => Alert.alert('Gasoline Selected \n 255 g for driver \n only passenger / km')}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
title="Food"
|
title="Food"
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import * as React from 'react';
|
||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
import { Text, View } from '../components/Themed';
|
||||||
|
import { ScreenInfo3 } from '../components/ScreenInfo';
|
||||||
|
|
||||||
|
export default function TripScreen() {
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<Text style={styles.title}>GT2</Text>
|
||||||
|
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
|
||||||
|
<ScreenInfo3 />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
fontSize: 40,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
|
separator: {
|
||||||
|
marginVertical: 10,
|
||||||
|
height: 1,
|
||||||
|
width: '80%',
|
||||||
|
},
|
||||||
|
});
|
|
@ -20,3 +20,7 @@ export type TripParamList = {
|
||||||
export type SettingsParamList = {
|
export type SettingsParamList = {
|
||||||
SettingsScreen: undefined;
|
SettingsScreen: undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type SplashParamList = {
|
||||||
|
SplashScreen: undefined;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue