Compare commits
2 Commits
2cac03a681
...
7268a93b02
Author | SHA1 | Date | |
---|---|---|---|
7268a93b02 | |||
e6c5783d62 |
41
App.tsx
41
App.tsx
@ -1,20 +1,31 @@
|
|||||||
import { StatusBar } from 'expo-status-bar';
|
import * as React from "react";
|
||||||
import { StyleSheet, Text, View } from 'react-native';
|
import { NavigationContainer } from "@react-navigation/native";
|
||||||
|
import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
||||||
|
import HomeScreen from "@/screens/Home";
|
||||||
|
import ProfileScreen from "@/screens/Profile";
|
||||||
|
|
||||||
export default function App() {
|
export type RootStackParamList = {
|
||||||
|
Home: undefined;
|
||||||
|
Profile: undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
const Stack = createNativeStackNavigator<RootStackParamList>();
|
||||||
|
|
||||||
|
function App() {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<NavigationContainer>
|
||||||
<Text>Open up App.tsx to start working on your app!</Text>
|
<Stack.Navigator screenOptions={{ headerLargeTitle: true }}>
|
||||||
<StatusBar style="auto" />
|
<Stack.Screen name="Home" component={HomeScreen} />
|
||||||
</View>
|
<Stack.Screen name="Profile" component={ProfileScreen} />
|
||||||
|
</Stack.Navigator>
|
||||||
|
</NavigationContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
declare global {
|
||||||
container: {
|
namespace ReactNavigation {
|
||||||
flex: 1,
|
interface RootParamList extends RootStackParamList {}
|
||||||
backgroundColor: '#fff',
|
}
|
||||||
alignItems: 'center',
|
}
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
export default App;
|
||||||
});
|
|
||||||
|
26
src/screens/Home.tsx
Normal file
26
src/screens/Home.tsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { useNavigation } from "@react-navigation/native";
|
||||||
|
import { type RootStackParamList } from "App";
|
||||||
|
import { StatusBar } from "expo-status-bar";
|
||||||
|
import { Button, StyleSheet, Text, View } from "react-native";
|
||||||
|
|
||||||
|
export default function HomeScreen() {
|
||||||
|
const navigation = useNavigation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<Text>Open up App.tsx to start working on your app!</Text>
|
||||||
|
|
||||||
|
<Button title="profile" onPress={() => navigation.navigate("Profile")} />
|
||||||
|
<StatusBar style="auto" />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "#fff",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
},
|
||||||
|
});
|
20
src/screens/Profile.tsx
Normal file
20
src/screens/Profile.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { StatusBar } from "expo-status-bar";
|
||||||
|
import { StyleSheet, Text, View } from "react-native";
|
||||||
|
|
||||||
|
export default function ProfileScreen() {
|
||||||
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
|
<Text>This is a profile screen</Text>
|
||||||
|
<StatusBar style="auto" />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "#fff",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
},
|
||||||
|
});
|
@ -1,6 +1,10 @@
|
|||||||
{
|
{
|
||||||
"extends": "expo/tsconfig.base",
|
"extends": "expo/tsconfig.base",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"strict": true
|
"strict": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user