refactor(ImageGallery, HomeScreen, PostService, UserStore): streamline post type handling and improve tab navigation
Some checks failed
Frontend CI / build-and-push-web (push) Successful in 2m37s
Frontend CI / ota-android (push) Has been cancelled
Frontend CI / build-android-apk (push) Has been cancelled

- Updated ImageGallery to manage loading states more effectively and prevent unnecessary updates.
- Refactored HomeScreen to remove the 'recommend' post type, simplifying the post type options.
- Adjusted PostService and UserStore to eliminate references to 'recommend', ensuring consistency across the application.
- Enhanced tab navigation in SimpleMobileTabNavigator to optimize rendering and manage mounted tabs more efficiently.
- Improved error handling and loading states in various components for better user experience.
This commit is contained in:
lafay
2026-03-24 05:18:22 +08:00
parent 357c1d4995
commit 48339384d2
9 changed files with 72 additions and 34 deletions

View File

@@ -41,8 +41,8 @@ import { navigationService } from '../../infrastructure/navigation/navigationSer
type NavigationProp = NativeStackNavigationProp<HomeStackParamList, 'Home'> & NativeStackNavigationProp<RootStackParamList>;
const TABS = ['推荐', '关注', '热门', '最新'];
const TAB_ICONS = ['compass-outline', 'account-heart-outline', 'fire', 'clock-outline'];
const TABS = ['最新', '关注', '热门'];
const TAB_ICONS = ['clock-outline', 'account-heart-outline', 'fire'];
const DEFAULT_PAGE_SIZE = 20;
const SWIPE_TRANSLATION_THRESHOLD = 40;
const SWIPE_COOLDOWN_MS = 300;
@@ -51,7 +51,7 @@ const MOBILE_TAB_FLOATING_MARGIN = 12;
const MOBILE_FAB_GAP = 12;
type ViewMode = 'list' | 'grid';
type PostType = 'recommend' | 'follow' | 'hot' | 'latest';
type PostType = 'follow' | 'hot' | 'latest';
export const HomeScreen: React.FC = () => {
const navigation = useNavigation<NavigationProp>();
@@ -106,11 +106,10 @@ export const HomeScreen: React.FC = () => {
// 获取当前 tab 对应的帖子类型
const getPostType = useCallback((): PostType => {
switch (activeIndex) {
case 0: return 'recommend';
case 0: return 'latest';
case 1: return 'follow';
case 2: return 'hot';
case 3: return 'latest';
default: return 'recommend';
default: return 'latest';
}
}, [activeIndex]);