diff --git a/app/_layout.tsx b/app/_layout.tsx index 04d4571..5675332 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -65,12 +65,13 @@ export default function RootLayout() { }, [loaded, lastCheckTime, checkForUpdate]); useEffect(() => { - if (remoteInputEnabled) { + // 只有在非手机端才启动远程控制服务器 + if (remoteInputEnabled && responsiveConfig.deviceType !== "mobile") { startServer(); } else { stopServer(); } - }, [remoteInputEnabled, startServer, stopServer]); + }, [remoteInputEnabled, startServer, stopServer, responsiveConfig.deviceType]); if (!loaded && !error) { return null; diff --git a/app/settings.tsx b/app/settings.tsx index 145a53e..8a0eace 100644 --- a/app/settings.tsx +++ b/app/settings.tsx @@ -86,7 +86,8 @@ export default function SettingsScreen() { }; const sections = [ - { + // 远程输入配置 - 仅在非手机端显示 + deviceType !== "mobile" && { component: ( { setCurrentFocusIndex(1); setCurrentSection("api"); @@ -111,7 +113,8 @@ export default function SettingsScreen() { ), key: "api", }, - { + // 直播源配置 - 仅在非手机端显示 + deviceType !== "mobile" && { component: ( = ({ return null; } + // 在手机端过滤掉直播 tab + const filteredNavigationItems = navigationItems.filter(item => + responsiveConfig.deviceType !== 'mobile' || item.name !== 'live' + ); + const handleNavigation = (route: string) => { if (route === '/') { router.push('/'); @@ -90,7 +95,7 @@ export const MobileBottomNavigation: React.FC = ({ return ( - {navigationItems.map((item) => { + {filteredNavigationItems.map((item) => { const isActive = isActiveRoute(item.route); const IconComponent = item.icon; diff --git a/components/navigation/MobileBottomTabNavigator.tsx b/components/navigation/MobileBottomTabNavigator.tsx index 2fc68f9..4598efe 100644 --- a/components/navigation/MobileBottomTabNavigator.tsx +++ b/components/navigation/MobileBottomTabNavigator.tsx @@ -24,7 +24,12 @@ const tabs: TabItem[] = [ const MobileBottomTabNavigator: React.FC = () => { const router = useRouter(); const pathname = usePathname(); - const { spacing } = useResponsiveLayout(); + const { spacing, deviceType } = useResponsiveLayout(); + + // 在手机端过滤掉直播 tab + const filteredTabs = tabs.filter(tab => + deviceType !== 'mobile' || tab.key !== 'live' + ); const handleTabPress = (route: string) => { if (route === '/') { @@ -44,7 +49,7 @@ const MobileBottomTabNavigator: React.FC = () => { return ( - {tabs.map((tab) => { + {filteredTabs.map((tab) => { const isActive = isTabActive(tab.route); const IconComponent = tab.icon; diff --git a/components/navigation/MobileTabContainer.tsx b/components/navigation/MobileTabContainer.tsx index a09ef8d..20e822b 100644 --- a/components/navigation/MobileTabContainer.tsx +++ b/components/navigation/MobileTabContainer.tsx @@ -28,7 +28,12 @@ interface MobileTabContainerProps { const MobileTabContainer: React.FC = ({ children }) => { const router = useRouter(); const pathname = usePathname(); - const { spacing } = useResponsiveLayout(); + const { spacing, deviceType } = useResponsiveLayout(); + + // 在手机端过滤掉直播 tab + const filteredTabs = tabs.filter(tab => + deviceType !== 'mobile' || tab.key !== 'live' + ); const handleTabPress = (route: string) => { if (route === '/') { @@ -55,7 +60,7 @@ const MobileTabContainer: React.FC = ({ children }) => {/* 底部导航栏 */} - {tabs.map((tab) => { + {filteredTabs.map((tab) => { const isActive = isTabActive(tab.route); const IconComponent = tab.icon; diff --git a/components/settings/APIConfigSection.tsx b/components/settings/APIConfigSection.tsx index 70bdb2b..7868eac 100644 --- a/components/settings/APIConfigSection.tsx +++ b/components/settings/APIConfigSection.tsx @@ -12,6 +12,7 @@ interface APIConfigSectionProps { onChanged: () => void; onFocus?: () => void; onBlur?: () => void; + hideDescription?: boolean; } export interface APIConfigSectionRef { @@ -19,7 +20,7 @@ export interface APIConfigSectionRef { } export const APIConfigSection = forwardRef( - ({ onChanged, onFocus, onBlur }, ref) => { + ({ onChanged, onFocus, onBlur, hideDescription = false }, ref) => { const { apiBaseUrl, setApiBaseUrl, remoteInputEnabled } = useSettingsStore(); const { serverUrl } = useRemoteControlStore(); const [isInputFocused, setIsInputFocused] = useState(false); @@ -66,7 +67,7 @@ export const APIConfigSection = forwardRef API 地址 - {remoteInputEnabled && serverUrl && ( + {!hideDescription && remoteInputEnabled && serverUrl && ( 用手机访问 {serverUrl},可远程输入 )}