PC端的部分适配

This commit is contained in:
2026-03-16 17:47:10 +08:00
parent 798dd7c9a0
commit cb2087f779
30 changed files with 4242 additions and 438 deletions

View File

@@ -31,8 +31,14 @@ const TABS = ['帖子', '用户'];
type SearchType = 'posts' | 'users';
export const SearchScreen: React.FC = () => {
const navigation = useNavigation<NavigationProp>();
interface SearchScreenProps {
onBack?: () => void;
navigation?: NavigationProp;
}
export const SearchScreen: React.FC<SearchScreenProps> = ({ onBack, navigation: propNavigation }) => {
// 如果传入了 navigation 则使用传入的,否则使用 hook 获取的
const navigation = propNavigation || useNavigation<NavigationProp>();
const insets = useSafeAreaInsets();
const { searchHistory: history, addSearchHistory, clearSearchHistory } = useUserStore();
@@ -422,9 +428,9 @@ export const SearchScreen: React.FC = () => {
autoFocus
/>
</View>
<TouchableOpacity
style={[styles.cancelButton, { marginLeft: responsiveGap }]}
onPress={() => navigation.goBack()}
<TouchableOpacity
style={[styles.cancelButton, { marginLeft: responsiveGap }]}
onPress={() => onBack ? onBack() : navigation.goBack()}
activeOpacity={0.85}
>
<Text
@@ -476,6 +482,12 @@ const styles = StyleSheet.create({
backgroundColor: `${colors.primary.main}08`,
paddingHorizontal: spacing.xs,
paddingVertical: spacing.xs,
// 移除阴影效果
shadowColor: 'transparent',
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0,
shadowRadius: 0,
elevation: 0,
},
cancelButton: {
backgroundColor: `${colors.primary.main}14`,