Skip to content

Commit 91cd278

Browse files
While logging out, I removed loading to avoid blockers in iOS. - fixed
1 parent ee9b1ff commit 91cd278

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/common/LoadingModal.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import commonStyles from '../styles/commonStyles';
55
import Modal, { ModalCenteredContent } from './Modal';
66
import Text from './Text';
77

8-
function LoadingModal({ visible, message }) {
8+
function LoadingModal({ visible, message, behavior = '' }) {
99
const themeColorPalatte = useThemeColorPalatte();
1010

1111
const styles = {
@@ -16,6 +16,22 @@ function LoadingModal({ visible, message }) {
1616
...(Boolean(message) && { paddingHorizontal: 15, minWidth: 300, minHeight: 70 }), // Include paddingHorizontal only when message is available
1717
};
1818

19+
if (behavior === 'costom' && visible) {
20+
return (
21+
<View
22+
style={[
23+
commonStyles.positionAbsolute,
24+
commonStyles.alignItemsCenter,
25+
commonStyles.justifyContentCenter,
26+
{ flex: 1, width: '100%', height: '100%', backgroundColor: themeColorPalatte.modalOverlayBg },
27+
]}>
28+
<View style={styles}>
29+
<ActivityIndicator size={'large'} color={themeColorPalatte.primaryColor} />
30+
</View>
31+
</View>
32+
);
33+
}
34+
1935
return (
2036
<Modal visible={visible}>
2137
<ModalCenteredContent>

src/screens/MenuScreen.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,25 @@ import { useThemeColorPalatte } from '../redux/reduxHook';
1313
import commonStyles from '../styles/commonStyles';
1414
import { logoutClearVariables, mirrorflyLogout } from '../uikitMethods';
1515
import { REGISTERSCREEN } from './constants';
16+
import LoadingModal from '../common/LoadingModal';
1617

1718
function MenuScreen() {
1819
const navigation = useNavigation();
1920
const themeColorPalatte = useThemeColorPalatte();
2021
const [modalContent, setModalContent] = React.useState(null);
2122
const stringSet = getStringSet();
23+
const [visible, setVisible] = React.useState(false);
2224

2325
const toggleModalContent = () => {
2426
setModalContent(null);
2527
};
2628

2729
const hanldeLogout = async () => {
30+
setVisible(true);
2831
const res = await mirrorflyLogout();
2932
if (res === 200) {
3033
setTimeout(() => {
34+
setVisible(false);
3135
logoutClearVariables();
3236
RootNavigation.reset(REGISTERSCREEN);
3337
}, 1000);
@@ -126,6 +130,7 @@ function MenuScreen() {
126130
/>
127131
</View>
128132
{modalContent && <AlertModal {...modalContent} />}
133+
<LoadingModal visible={visible} behavior="costom" />
129134
</>
130135
);
131136
}

0 commit comments

Comments
 (0)