fix(rn) add backhandler on Prejoin screen
This commit is contained in:
parent
c29e8bbdd1
commit
d1c9720033
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue