PC端的部分适配
This commit is contained in:
@@ -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`,
|
||||
|
||||
Reference in New Issue
Block a user