Fixed socket not closing on exit

This commit is contained in:
Alex Kim
2024-12-09 02:48:36 +11:00
parent 1d4c56265f
commit 40b3304f9b
3 changed files with 85 additions and 106 deletions

View File

@@ -342,22 +342,11 @@ export default function page() {
: 0;
}, [item]);
const backAction = () => {
videoRef.current?.stop();
return false;
};
useFocusEffect(
React.useCallback(() => {
const onBackPress = () => {
return backAction();
};
BackHandler.addEventListener("hardwareBackPress", onBackPress);
return async () => {
videoRef.current?.stop();
BackHandler.removeEventListener("hardwareBackPress", onBackPress);
stop();
console.log("Unmounted");
};
}, [])
);