mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-23 03:28:11 +00:00
fix: handle casting-player navigation when no back stack exists
Use useEffect to check connection state and redirect properly. If no back stack exists, navigate to home tab instead of calling router.back().
This commit is contained in:
@@ -198,10 +198,18 @@ export default function CastingPlayerScreen() {
|
||||
}, [currentItem?.Type, nextEpisode, duration, progress]);
|
||||
|
||||
// Redirect if not connected
|
||||
if (!isConnected || !currentItem || !protocol) {
|
||||
if (router.canGoBack()) {
|
||||
router.back();
|
||||
useEffect(() => {
|
||||
if (!isConnected || !currentItem || !protocol) {
|
||||
if (router.canGoBack()) {
|
||||
router.back();
|
||||
} else {
|
||||
router.replace("/(auth)/(tabs)/(home)/");
|
||||
}
|
||||
}
|
||||
}, [isConnected, currentItem, protocol]);
|
||||
|
||||
// Don't render if not connected
|
||||
if (!isConnected || !currentItem || !protocol) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user