mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +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,
|
||||
TouchableOpacity,
|
||||
InteractionManager,
|
||||
BackHandler,
|
||||
} from 'react-native';
|
||||
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useRoute, useNavigation, useFocusEffect } from '@react-navigation/native';
|
||||
|
|
@ -206,7 +207,7 @@ const MetadataScreen: React.FC = () => {
|
|||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
setIsScreenFocused(true);
|
||||
|
||||
|
||||
// Delay secondary data loading until interactions are complete
|
||||
const timer = setTimeout(() => {
|
||||
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
|
||||
useEffect(() => {
|
||||
if (metadata && isScreenFocused && !shouldLoadSecondaryData) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue