A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
convert progress dialog to ActionSheet
ammarahm-edf9585dc9952a
diff --git a/apps/mobile/src/components/ProgressDialog/index.js b/apps/mobile/src/components/ProgressDialog/index.jsindex adb888f47..482837a6c 100644--- a/apps/mobile/src/components/ProgressDialog/index.js+++ b/apps/mobile/src/components/ProgressDialog/index.js@@ -1,8 +1,11 @@-import React, {useEffect, useState} from 'react';+import React, {useEffect, useRef, useState} from 'react';import {ActivityIndicator, View} from 'react-native';import {useTracked} from '../../provider';import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';import {eCloseProgressDialog, eOpenProgressDialog} from '../../utils/Events';+import {SIZE} from '../../utils/SizeUtils';+import {sleep} from '../../utils/TimeUtils';+import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';import {Button} from '../Button';import BaseDialog from '../Dialog/base-dialog';import DialogContainer from '../Dialog/dialog-container';@@ -17,6 +20,7 @@ const ProgressDialog = () => {title: 'Loading',paragraph: 'Loading tagline',});+ const actionSheetRef = useRef();useEffect(() => {eSubscribeEvent(eOpenProgressDialog, open);eSubscribeEvent(eCloseProgressDialog, close);@@ -26,9 +30,11 @@ const ProgressDialog = () => {};}, []);- const open = (data) => {+ const open = async (data) => {setDialogData(data);setVisible(true);+ await sleep(1);+ actionSheetRef.current?._setModalVisible(true);};const close = () => {@@ -36,40 +42,44 @@ const ProgressDialog = () => {};return !visible ? null : (- <BaseDialog- visible={true}- onRequestClose={() => {+ <ActionSheetWrapper+ fwdRef={actionSheetRef}+ gestureEnabled={dialogData?.noProgress}+ onClose={() => {if (dialogData.noProgress) {setVisible(false);setDialogData(null);}}}>- <DialogContainer>- <View- style={{- justifyContent: 'center',- alignItems: 'center',- marginBottom: 10,- }}>- <Heading> {dialogData?.title}</Heading>- <Paragraph style={{textAlign: 'center'}}>- {dialogData?.paragraph}- {!dialogData?.noProgress ? (- <Paragraph color={colors.errorText}>- {' '}- Do not close the app.- </Paragraph>- ) : null}- </Paragraph>- </View>- {!dialogData?.noProgress ? (- <ActivityIndicator color={colors.accent} />- ) : null}- {dialogData?.action ? (- <Button type="transparent" title={dialogData.actionText} />- ) : null}- </DialogContainer>- </BaseDialog>+ <View+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ marginBottom: 10,+ paddingHorizontal: 12,+ }}>+ <Heading> {dialogData?.title}</Heading>+ <Paragraph style={{textAlign: 'center'}}>+ {dialogData?.paragraph}+ {!dialogData?.noProgress ? (+ <Paragraph color={colors.errorText}>+ {' '}+ Do not close the app.+ </Paragraph>+ ) : null}+ </Paragraph>+ </View>+ {!dialogData?.noProgress ? (+ <ActivityIndicator size={SIZE.xxxl} color={colors.accent} />+ ) : null}++ {dialogData?.action ? (+ <Button+ type="transparent"+ title={dialogData.actionText}+ />+ ) : null}+ </ActionSheetWrapper>);};