Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(rn) add backhandler on Prejoin screen

Titus Moldovand1c9720033b4
diff --git a/react/features/prejoin/components/Prejoin.native.tsx b/react/features/prejoin/components/Prejoin.native.tsx
index fb54e5f23c..ae4f4c2de6 100644
--- a/react/features/prejoin/components/Prejoin.native.tsx
+++ b/react/features/prejoin/components/Prejoin.native.tsx
@@ -1,6 +1,6 @@
-import React, { useCallback, useLayoutEffect, useState } from 'react';
+import React, { useCallback, useEffect, useLayoutEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { Text, View, TouchableOpacity, TextInput, Platform } from 'react-native';
+import { Text, View, TouchableOpacity, TextInput, Platform, BackHandler } from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { appNavigate } from '../../app/actions.native';
@@ -58,6 +58,7 @@ const Prejoin: ({ navigation }: Props) => JSX.Element = ({ navigation }: Props)
const goBack = useCallback(() => {
dispatch(appNavigate(undefined));
+ return true;
}, [ dispatch ]);
let contentWrapperStyles;
@@ -93,6 +94,13 @@ const Prejoin: ({ navigation }: Props) => JSX.Element = ({ navigation }: Props)
);
}, []);
+ useEffect(() => {
+ BackHandler.addEventListener('hardwareBackPress', goBack);
+
+ return () => BackHandler.removeEventListener('hardwareBackPress', goBack)
+
+ }, [ ]);
+
useLayoutEffect(() => {
navigation.setOptions({
headerLeft