mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-09 19:40:44 +00:00
CastModal Back gesture fix
This commit is contained in:
parent
5143917117
commit
a0626e8f8a
1 changed files with 17 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import {
|
||||||
Dimensions,
|
Dimensions,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
InteractionManager,
|
InteractionManager,
|
||||||
|
BackHandler,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import { useRoute, useNavigation, useFocusEffect } from '@react-navigation/native';
|
import { useRoute, useNavigation, useFocusEffect } from '@react-navigation/native';
|
||||||
|
|
@ -206,7 +207,7 @@ const MetadataScreen: React.FC = () => {
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
setIsScreenFocused(true);
|
setIsScreenFocused(true);
|
||||||
|
|
||||||
// Delay secondary data loading until interactions are complete
|
// Delay secondary data loading until interactions are complete
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
if (!interactionComplete.current) {
|
if (!interactionComplete.current) {
|
||||||
|
|
@ -224,6 +225,21 @@ const MetadataScreen: React.FC = () => {
|
||||||
}, [])
|
}, [])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Handle back button press - close modal if open, otherwise navigate back
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
const backHandler = BackHandler.addEventListener('hardwareBackPress', () => {
|
||||||
|
if (showCastModal) {
|
||||||
|
setShowCastModal(false);
|
||||||
|
return true; // Prevent default back behavior
|
||||||
|
}
|
||||||
|
return false; // Allow default back behavior (navigate back)
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => backHandler.remove();
|
||||||
|
}, [showCastModal])
|
||||||
|
);
|
||||||
|
|
||||||
// Optimize secondary data loading
|
// Optimize secondary data loading
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (metadata && isScreenFocused && !shouldLoadSecondaryData) {
|
if (metadata && isScreenFocused && !shouldLoadSecondaryData) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue