refactor: 重构tabs栏
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import { Tabs } from 'expo-router';
|
||||
import Ionicons from "@expo/vector-icons/MaterialIcons"
|
||||
|
||||
export default function TabLayout() {
|
||||
return (
|
||||
<Tabs>
|
||||
<Tabs.Screen name="index" options={{ title: 'Home' }} />
|
||||
<Tabs.Screen name="about" options={{ title: 'About' }} />
|
||||
<Tabs.Screen name="index" options={{ title: '消息', tabBarIcon: ({ color }) => <Ionicons size={28} name="message" color={color} /> }} />
|
||||
<Tabs.Screen name="contacts" options={{ title: '通讯录', tabBarIcon: ({ color }) => <Ionicons size={28} name="assignment-ind" color={color} /> }} />
|
||||
<Tabs.Screen name="discover" options={{ title: '发现', tabBarIcon: ({ color }) => <Ionicons size={28} name="compass-calibration" color={color} /> }} />
|
||||
<Tabs.Screen name="profile" options={{ title: '我', tabBarIcon: ({ color }) => <Ionicons size={28} name="person" color={color} /> }} />
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { Text } from "react-native";
|
||||
|
||||
export default function AboutRoute() {
|
||||
return <Text>About Route</Text>;
|
||||
}
|
||||
3
app/(tabs)/contacts.tsx
Normal file
3
app/(tabs)/contacts.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function ContactsRoute() {
|
||||
return <></>;
|
||||
}
|
||||
3
app/(tabs)/discover.tsx
Normal file
3
app/(tabs)/discover.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function ContactsRoute() {
|
||||
return <></>;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Text } from "react-native";
|
||||
|
||||
export default function IndexRoute() {
|
||||
return <Text>Index Route</Text>;
|
||||
return <Text>Chat Route</Text>;
|
||||
}
|
||||
3
app/(tabs)/profile.tsx
Normal file
3
app/(tabs)/profile.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function ProfileRoute() {
|
||||
return <></>;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import { Link } from "expo-router";
|
||||
import { StyleSheet, Text, View } from "react-native";
|
||||
|
||||
export function HomeScreen() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>lamp</Text>
|
||||
<Text style={styles.subtitle}>OpenIM powered messaging workspace</Text>
|
||||
<Link href="/modal" style={styles.link}>
|
||||
Open modal preview
|
||||
</Link>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
gap: 10,
|
||||
padding: 24,
|
||||
},
|
||||
title: {
|
||||
fontSize: 32,
|
||||
fontWeight: "700",
|
||||
letterSpacing: 0.5,
|
||||
},
|
||||
subtitle: {
|
||||
fontSize: 15,
|
||||
color: "#5c6169",
|
||||
},
|
||||
link: {
|
||||
marginTop: 8,
|
||||
fontSize: 16,
|
||||
fontWeight: "600",
|
||||
},
|
||||
});
|
||||
@@ -1,38 +0,0 @@
|
||||
import { Link } from "expo-router";
|
||||
import { StyleSheet, Text, View } from "react-native";
|
||||
|
||||
export function ModalScreen() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>Modal Route</Text>
|
||||
<Text style={styles.subtitle}>This screen is presented with modal behavior on native.</Text>
|
||||
<Link href="/" dismissTo style={styles.link}>
|
||||
Back to home
|
||||
</Link>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
padding: 20,
|
||||
gap: 8,
|
||||
},
|
||||
title: {
|
||||
fontSize: 24,
|
||||
fontWeight: "700",
|
||||
},
|
||||
subtitle: {
|
||||
fontSize: 14,
|
||||
color: "#5c6169",
|
||||
textAlign: "center",
|
||||
},
|
||||
link: {
|
||||
marginTop: 8,
|
||||
fontSize: 16,
|
||||
fontWeight: "600",
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user