Commit 089a2f8c authored by Gunasekara M.A.L.M's avatar Gunasekara M.A.L.M

implement routing

parent f6bf28f0
...@@ -6,112 +6,158 @@ ...@@ -6,112 +6,158 @@
* @flow strict-local * @flow strict-local
*/ */
import React from 'react'; import React from 'react';
import type {Node} from 'react'; import {
import { SafeAreaView,
SafeAreaView, ScrollView,
ScrollView, StatusBar,
StatusBar, StyleSheet,
StyleSheet, Text,
Text, useColorScheme,
useColorScheme, View,
View, } from 'react-native';
} from 'react-native';
import {
import { Colors,
Colors, DebugInstructions,
DebugInstructions, Header,
Header, LearnMoreLinks,
LearnMoreLinks, ReloadInstructions,
ReloadInstructions, } from 'react-native/Libraries/NewAppScreen';
} from 'react-native/Libraries/NewAppScreen';
import { Stack, Router, Scene, ActionConst } from 'react-native-router-flux';
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen';
* LTI update could not be added via codemod */
const Section = ({children, title}): Node => {
const isDarkMode = useColorScheme() === 'dark'; import SplashScreen from './src/screen/splash_screen/splashscreen';
return ( import HomeScreen from './src/screen/home_screen/homescreen';
<View style={styles.sectionContainer}> import BusListScreen from './src/screen/bus_list_screen/buslistscreen';
<Text import MapScreen from './src/screen/map_screen/mapscreen';
style={[ import BusRoteScreen from './src/screen/bus_route_screen/busroutescreen';
styles.sectionTitle,
{
color: isDarkMode ? Colors.white : Colors.black, const App = () => {
}, const isDarkMode = useColorScheme() === 'dark';
]}>
{title} const backgroundStyle = {
</Text> backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
<Text };
style={[
styles.sectionDescription, return (
{ <Router>
color: isDarkMode ? Colors.light : Colors.dark, <Stack key="root" headerLayoutPreset="center">
}, <Scene
]}> key="splash"
{children} type="replace"
</Text> component={SplashScreen}
</View> initial
); hideNavBar={true}
}; />
const App: () => Node = () => { <Scene
const isDarkMode = useColorScheme() === 'dark'; key="authenticated"
type="replace"
const backgroundStyle = { renderTitle={() => (
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, <View style={styles.navBarStyles}>
}; <View style={styles.app_logs_holder}>
{/* <Image source={{ uri: 'tabbar_icon' }} style={styles.app_logs} /> */}
return ( </View>
<SafeAreaView style={backgroundStyle}> </View>
<StatusBar )}
barStyle={isDarkMode ? 'light-content' : 'dark-content'} //hideNavBar={true}
backgroundColor={backgroundStyle.backgroundColor} panHandlers={null}
/> >
<ScrollView <Scene
contentInsetAdjustmentBehavior="automatic" key="dashbord"
style={backgroundStyle}> title="Select Route And Bus off"
<Header /> component={HomeScreen}
<View renderTitle={() => (
style={{ <View style={styles.navBarStyles}>
backgroundColor: isDarkMode ? Colors.black : Colors.white, <View style={styles.app_logs_holder}>
}}> {/* <Image source={{ uri: 'tabbar_icon' }} style={styles.app_logs} /> */}
<Section title="Step One"> <Text style={{ color: '#000' }}>Select Route And Bus off</Text>
Edit <Text style={styles.highlight}>App.js</Text> to change this </View>
screen and then come back to see your edits. </View>
</Section> )}
<Section title="See Your Changes"> hideNavBar={true}
<ReloadInstructions /> initial
</Section> />
<Section title="Debug"> <Scene
<DebugInstructions /> key="busRoute"
</Section> title="Bus Details"
<Section title="Learn More"> component={BusRoteScreen}
Read the docs to discover what to do next: // renderTitle={() => (
</Section> // <View style={styles.navBarStyles}>
<LearnMoreLinks /> // <View style={styles.app_logs_holder}>
</View> // {/* <Image source={{ uri: 'tabbar_icon' }} style={styles.app_logs} /> */}
</ScrollView> // </View>
</SafeAreaView> // </View>
); // )}
}; hideNavBar={true}
/>
const styles = StyleSheet.create({ <Scene
sectionContainer: { key="busList"
marginTop: 32, title="Bus Details"
paddingHorizontal: 24, component={BusListScreen}
}, // renderTitle={() => (
sectionTitle: { // <View style={styles.navBarStyles}>
fontSize: 24, // <View style={styles.app_logs_holder}>
fontWeight: '600', // {/* <Image source={{ uri: 'tabbar_icon' }} style={styles.app_logs} /> */}
}, // </View>
sectionDescription: { // </View>
marginTop: 8, // )}
fontSize: 18, hideNavBar={true}
fontWeight: '400', />
}, <Scene
highlight: { key="mapScreen"
fontWeight: '700', title="View On Map"
}, component={MapScreen}
}); // renderTitle={() => (
// <View style={styles.navBarStyles}>
export default App; // <View style={styles.app_logs_holder}>
// {/* <Image source={{ uri: 'tabbar_icon' }} style={styles.app_logs} /> */}
// </View>
// </View>
// )}
hideNavBar={true}
/>
</Scene>
</Stack>
</Router>
);
};
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
navBarStyles: {
width: "100%", //wp('100%')
height: hp('7.5%'),
alignItems: 'center',
justifyContent: 'center',
},
app_logs_holder: {
width: wp('10%'),
height: hp('5%'),
alignContent: 'center',
alignItems: 'center',
},
});
export default App;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment