Commit c7935084 authored by W.D.R.P. Sandeepa's avatar W.D.R.P. Sandeepa

Merge branch 'it18218640' into 'master'

change reusable code

See merge request !60
parents 3ed7368b 945c0634
......@@ -2,12 +2,13 @@ import { useNavigation } from "@react-navigation/native";
import React from "react";
import {Text, TouchableOpacity, StyleSheet} from 'react-native'
export default function ImageButton({ title}){
export default function ImageButton(props){
const navigation = useNavigation();
const {title, path} = props;
return(
<TouchableOpacity onPress={()=> {navigation.navigate("Color")}} style={styles.ImageButton}>
<TouchableOpacity onPress={()=> {navigation.navigate(path)}} style={styles.ImageButton}>
<Text style={styles.text}>{title}</Text>
</TouchableOpacity>
);
......
......@@ -15,7 +15,7 @@ const Stack = createNativeStackNavigator();
const AppRouter = () => {
return(
<NavigationContainer>
<Stack.Navigator initialRouteName="Color">
<Stack.Navigator initialRouteName="Splash">
<Stack.Screen options={{headerShown:false}} name="Home" component={Home} />
<Stack.Screen options={{headerShown:false}} name="Splash" component={Splash} />
<Stack.Screen options={{headerShown:false}} name="Register" component={Register} />
......
......@@ -15,7 +15,7 @@ export default function Home({ navigation }){
<View style={styles.imageView}>
<Image style={styles.image} source={require('../assets/color/background.png')} resizeMode="contain">
</Image>
<ImageButton title="Color Activity"/>
<ImageButton path="Color" title="Color Activity"/>
</View>
</View>
</ScrollView>
......
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