This commit is contained in:
ammarahm-ed
2021-12-25 11:16:33 +05:00
parent 73f961d7d8
commit 928e8debef
22 changed files with 55 additions and 60 deletions

View File

@@ -10,7 +10,7 @@ import {db} from '../../utils/database';
import {ph, pv, SIZE} from '../../utils/SizeUtils'; import {ph, pv, SIZE} from '../../utils/SizeUtils';
import {sleep} from '../../utils/TimeUtils'; import {sleep} from '../../utils/TimeUtils';
import {ActionIcon} from '../ActionIcon'; import {ActionIcon} from '../ActionIcon';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import {Button} from '../Button'; import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header'; import DialogHeader from '../Dialog/dialog-header';
import Input from '../Input'; import Input from '../Input';
@@ -254,7 +254,7 @@ export class AddNotebookDialog extends React.Component {
const {topics, visible, topicInputFocused} = this.state; const {topics, visible, topicInputFocused} = this.state;
if (!visible) return null; if (!visible) return null;
return ( return (
<ActionSheetWrapper <SheetWrapper
onOpen={async () => { onOpen={async () => {
this.topicsToDelete = []; this.topicsToDelete = [];
await sleep(300); await sleep(300);
@@ -408,7 +408,7 @@ export class AddNotebookDialog extends React.Component {
</View> </View>
<Toast context="local" /> <Toast context="local" />
</ActionSheetWrapper> </SheetWrapper>
); );
} }
} }

View File

@@ -17,7 +17,7 @@ import {
import filesystem from '../../utils/filesystem'; import filesystem from '../../utils/filesystem';
import { SIZE } from '../../utils/SizeUtils'; import { SIZE } from '../../utils/SizeUtils';
import { ActionIcon } from '../ActionIcon'; import { ActionIcon } from '../ActionIcon';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import DialogHeader from '../Dialog/dialog-header'; import DialogHeader from '../Dialog/dialog-header';
import GeneralSheet from '../GeneralSheet'; import GeneralSheet from '../GeneralSheet';
import Paragraph from '../Typography/Paragraph'; import Paragraph from '../Typography/Paragraph';
@@ -57,7 +57,7 @@ export const AttachmentDialog = () => {
}; };
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper <SheetWrapper
centered={false} centered={false}
fwdRef={actionSheetRef} fwdRef={actionSheetRef}
onClose={async () => { onClose={async () => {
@@ -107,7 +107,7 @@ export const AttachmentDialog = () => {
{' '}All attachments are end-to-end encrypted. {' '}All attachments are end-to-end encrypted.
</Paragraph> </Paragraph>
</View> </View>
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -8,7 +8,7 @@ import {
TouchableOpacity TouchableOpacity
} from 'react-native'; } from 'react-native';
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard'; import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
import { BouncingView } from '../ActionSheetComponent/BouncingView'; import { BouncingView } from '../Transitions/bouncing-view';
const BaseDialog = ({ const BaseDialog = ({
visible, visible,

View File

@@ -21,8 +21,8 @@ import {
eThemeUpdated eThemeUpdated
} from '../../utils/Events'; } from '../../utils/Events';
import { EditorSettings } from '../../views/Editor/EditorSettings'; import { EditorSettings } from '../../views/Editor/EditorSettings';
import { ActionSheetComponent } from '../ActionSheetComponent'; import { Properties } from '../Properties';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import { AddNotebookDialog } from '../AddNotebookDialog'; import { AddNotebookDialog } from '../AddNotebookDialog';
import { AddTopicDialog } from '../AddTopicDialog'; import { AddTopicDialog } from '../AddTopicDialog';
import { AnnouncementDialog } from '../Announcements'; import { AnnouncementDialog } from '../Announcements';
@@ -237,7 +237,7 @@ export class DialogManager extends Component {
return ( return (
<> <>
{!this.state.actionSheetVisible ? null : ( {!this.state.actionSheetVisible ? null : (
<ActionSheetWrapper <SheetWrapper
fwdRef={this.actionSheet} fwdRef={this.actionSheet}
onClose={() => { onClose={() => {
eSendEvent(eShowGetPremium, null); eSendEvent(eShowGetPremium, null);
@@ -246,15 +246,11 @@ export class DialogManager extends Component {
actionSheetVisible: false actionSheetVisible: false
}); });
}}> }}>
<ActionSheetComponent <Properties
item={item} item={item}
setWillRefresh={value => {
this.willRefresh = true;
}}
getRef={() => this.actionSheet} getRef={() => this.actionSheet}
hasColors={actionSheetData.colors} hasColors={actionSheetData.colors}
hasTags={actionSheetData.colors} hasTags={actionSheetData.colors}
overlayColor="rgba(0,0,0,0.3)"
rowItems={actionSheetData.rowItems} rowItems={actionSheetData.rowItems}
columnItems={actionSheetData.columnItems} columnItems={actionSheetData.columnItems}
close={value => { close={value => {
@@ -264,7 +260,7 @@ export class DialogManager extends Component {
this.actionSheet.current?.setModalVisible(); this.actionSheet.current?.setModalVisible();
}} }}
/> />
</ActionSheetWrapper> </SheetWrapper>
)} )}
<Dialog context="global" /> <Dialog context="global" />
<AddTopicDialog <AddTopicDialog

View File

@@ -10,7 +10,7 @@ import Exporter from '../../services/Exporter';
import { getElevation } from '../../utils'; import { getElevation } from '../../utils';
import { ph, pv, SIZE } from '../../utils/SizeUtils'; import { ph, pv, SIZE } from '../../utils/SizeUtils';
import { sleep } from '../../utils/TimeUtils'; import { sleep } from '../../utils/TimeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import { Button } from '../Button'; import { Button } from '../Button';
import DialogHeader from '../Dialog/dialog-header'; import DialogHeader from '../Dialog/dialog-header';
import { PressableButton } from '../PressableButton'; import { PressableButton } from '../PressableButton';
@@ -132,7 +132,7 @@ const ExportDialog = () => {
]; ];
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper fwdRef={actionSheetRef} onClose={close} visible={true}> <SheetWrapper fwdRef={actionSheetRef} onClose={close} visible={true}>
<View> <View>
<View <View
style={{ style={{
@@ -269,7 +269,7 @@ const ExportDialog = () => {
</View> </View>
</View> </View>
</View> </View>
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -6,7 +6,7 @@ import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
import {eCloseProgressDialog, eOpenProgressDialog} from '../../utils/Events'; import {eCloseProgressDialog, eOpenProgressDialog} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils'; import {SIZE} from '../../utils/SizeUtils';
import {sleep} from '../../utils/TimeUtils'; import {sleep} from '../../utils/TimeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import {Button} from '../Button'; import {Button} from '../Button';
import Heading from '../Typography/Heading'; import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph'; import Paragraph from '../Typography/Paragraph';
@@ -50,7 +50,7 @@ const GeneralSheet = ({context}) => {
}; };
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper <SheetWrapper
fwdRef={actionSheetRef} fwdRef={actionSheetRef}
gestureEnabled={dialogData?.noProgress} gestureEnabled={dialogData?.noProgress}
closeOnTouchBackdrop={dialogData?.noProgress} closeOnTouchBackdrop={dialogData?.noProgress}
@@ -166,7 +166,7 @@ const GeneralSheet = ({context}) => {
/> />
))} ))}
</View> </View>
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -25,7 +25,7 @@ import {MMKV} from '../../utils/mmkv';
import {SIZE} from '../../utils/SizeUtils'; import {SIZE} from '../../utils/SizeUtils';
import Storage from '../../utils/storage'; import Storage from '../../utils/storage';
import {sleep} from '../../utils/TimeUtils'; import {sleep} from '../../utils/TimeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import BaseDialog from '../Dialog/base-dialog'; import BaseDialog from '../Dialog/base-dialog';
import DialogButtons from '../Dialog/dialog-buttons'; import DialogButtons from '../Dialog/dialog-buttons';
import DialogContainer from '../Dialog/dialog-container'; import DialogContainer from '../Dialog/dialog-container';
@@ -410,7 +410,7 @@ const LoginDialog = () => {
}; };
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper <SheetWrapper
fwdRef={actionSheetRef} fwdRef={actionSheetRef}
animation={DDS.isTab ? 'fade' : 'slide'} animation={DDS.isTab ? 'fade' : 'slide'}
statusBarTranslucent={false} statusBarTranslucent={false}
@@ -755,7 +755,7 @@ const LoginDialog = () => {
}} }}
/> />
</ScrollView> </ScrollView>
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -12,7 +12,7 @@ import Navigation from '../../services/Navigation';
import {db} from '../../utils/database'; import {db} from '../../utils/database';
import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events'; import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';
import {normalize, SIZE} from '../../utils/SizeUtils'; import {normalize, SIZE} from '../../utils/SizeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import {Button} from '../Button'; import {Button} from '../Button';
import {ActionSheetEvent} from '../DialogManager/recievers'; import {ActionSheetEvent} from '../DialogManager/recievers';
import {PressableButton} from '../PressableButton'; import {PressableButton} from '../PressableButton';
@@ -126,7 +126,7 @@ const PinItem = ({item, index, onPress}) => {
return ( return (
<> <>
{visible && ( {visible && (
<ActionSheetWrapper <SheetWrapper
onClose={() => { onClose={() => {
setVisible(false); setVisible(false);
}} }}
@@ -149,7 +149,7 @@ const PinItem = ({item, index, onPress}) => {
marginBottom: 30 marginBottom: 30
}} }}
/> />
</ActionSheetWrapper> </SheetWrapper>
)} )}
<PressableButton <PressableButton
type={headerTextState?.id === item.id ? 'grayBg' : 'gray'} type={headerTextState?.id === item.id ? 'grayBg' : 'gray'}

View File

@@ -17,7 +17,7 @@ import {getTotalNotes} from '../../utils';
import {db} from '../../utils/database'; import {db} from '../../utils/database';
import {eOpenMoveNoteDialog} from '../../utils/Events'; import {eOpenMoveNoteDialog} from '../../utils/Events';
import {pv, SIZE} from '../../utils/SizeUtils'; import {pv, SIZE} from '../../utils/SizeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import {Button} from '../Button'; import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header'; import DialogHeader from '../Dialog/dialog-header';
import {PressableButton} from '../PressableButton'; import {PressableButton} from '../PressableButton';
@@ -68,9 +68,9 @@ const MoveNoteDialog = () => {
}; };
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper fwdRef={actionSheetRef} onClose={_onClose}> <SheetWrapper fwdRef={actionSheetRef} onClose={_onClose}>
<MoveNoteComponent close={close} note={note} setNote={update} /> <MoveNoteComponent close={close} note={note} setNote={update} />
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -65,7 +65,7 @@ import {Topics} from './topics';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
let htmlToText; let htmlToText;
export const ActionSheetComponent = ({ export const Properties = ({
close = () => {}, close = () => {},
item, item,
hasColors = false, hasColors = false,

View File

@@ -17,7 +17,7 @@ import {
import {openLinkInBrowser} from '../../utils/functions'; import {openLinkInBrowser} from '../../utils/functions';
import {SIZE} from '../../utils/SizeUtils'; import {SIZE} from '../../utils/SizeUtils';
import {ActionIcon} from '../ActionIcon'; import {ActionIcon} from '../ActionIcon';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import {Button} from '../Button'; import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header'; import DialogHeader from '../Dialog/dialog-header';
import Input from '../Input'; import Input from '../Input';
@@ -129,7 +129,7 @@ const PublishNoteDialog = () => {
}; };
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper <SheetWrapper
centered={false} centered={false}
fwdRef={actionSheetRef} fwdRef={actionSheetRef}
closeOnTouchBackdrop={!publishing} closeOnTouchBackdrop={!publishing}
@@ -366,7 +366,7 @@ const PublishNoteDialog = () => {
Learn more about Notesnook Monograph Learn more about Notesnook Monograph
</Paragraph> </Paragraph>
</View> </View>
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -4,7 +4,7 @@ import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
import {eCloseRateDialog, eOpenRateDialog} from '../../utils/Events'; import {eCloseRateDialog, eOpenRateDialog} from '../../utils/Events';
import {MMKV} from '../../utils/mmkv'; import {MMKV} from '../../utils/mmkv';
import {SIZE} from '../../utils/SizeUtils'; import {SIZE} from '../../utils/SizeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import {Button} from '../Button'; import {Button} from '../Button';
import Seperator from '../Seperator'; import Seperator from '../Seperator';
import Heading from '../Typography/Heading'; import Heading from '../Typography/Heading';
@@ -37,7 +37,7 @@ const RateDialog = () => {
}; };
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper <SheetWrapper
centered={false} centered={false}
fwdRef={actionSheetRef} fwdRef={actionSheetRef}
onClose={async () => { onClose={async () => {
@@ -117,7 +117,7 @@ const RateDialog = () => {
/> />
</View> </View>
</View> </View>
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -16,7 +16,7 @@ import {sanitizeFilename} from '../../utils/filename';
import {SIZE} from '../../utils/SizeUtils'; import {SIZE} from '../../utils/SizeUtils';
import Storage from '../../utils/storage'; import Storage from '../../utils/storage';
import {sleep} from '../../utils/TimeUtils'; import {sleep} from '../../utils/TimeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import {Button} from '../Button'; import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header'; import DialogHeader from '../Dialog/dialog-header';
import Seperator from '../Seperator'; import Seperator from '../Seperator';
@@ -185,7 +185,7 @@ class RecoveryKeyDialog extends React.Component {
const {colors} = this.props; const {colors} = this.props;
if (!this.state.visible) return null; if (!this.state.visible) return null;
return ( return (
<ActionSheetWrapper <SheetWrapper
closeOnTouchBackdrop={false} closeOnTouchBackdrop={false}
gestureEnabled={false} gestureEnabled={false}
onOpen={this.onOpen} onOpen={this.onOpen}
@@ -317,7 +317,7 @@ class RecoveryKeyDialog extends React.Component {
onPress={this.close} onPress={this.close}
/> />
</View> </View>
</ActionSheetWrapper> </SheetWrapper>
); );
} }
} }

View File

@@ -15,7 +15,7 @@ import {MMKV} from '../../utils/mmkv';
import {SIZE} from '../../utils/SizeUtils'; import {SIZE} from '../../utils/SizeUtils';
import storage from '../../utils/storage'; import storage from '../../utils/storage';
import {sleep, timeConverter} from '../../utils/TimeUtils'; import {sleep, timeConverter} from '../../utils/TimeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import {Button} from '../Button'; import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header'; import DialogHeader from '../Dialog/dialog-header';
import Seperator from '../Seperator'; import Seperator from '../Seperator';
@@ -60,7 +60,7 @@ const RestoreDialog = () => {
}; };
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper <SheetWrapper
fwdRef={actionSheetRef} fwdRef={actionSheetRef}
gestureEnabled={!restoring} gestureEnabled={!restoring}
closeOnTouchBackdrop={!restoring} closeOnTouchBackdrop={!restoring}
@@ -70,7 +70,7 @@ const RestoreDialog = () => {
restoring={restoring} restoring={restoring}
setRestoring={setRestoring} setRestoring={setRestoring}
/> />
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -8,7 +8,7 @@ import Navigation from '../../services/Navigation';
import {db} from '../../utils/database'; import {db} from '../../utils/database';
import {eCloseTagsDialog, eOpenTagsDialog, refreshNotesPage} from '../../utils/Events'; import {eCloseTagsDialog, eOpenTagsDialog, refreshNotesPage} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils'; import {SIZE} from '../../utils/SizeUtils';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../sheet';
import Input from '../Input'; import Input from '../Input';
import {PressableButton} from '../PressableButton'; import {PressableButton} from '../PressableButton';
import Paragraph from '../Typography/Paragraph'; import Paragraph from '../Typography/Paragraph';
@@ -117,7 +117,7 @@ const TagsDialog = () => {
}; };
return !visible ? null : ( return !visible ? null : (
<ActionSheetWrapper <SheetWrapper
centered={false} centered={false}
fwdRef={actionSheetRef} fwdRef={actionSheetRef}
onOpen={async () => { onOpen={async () => {
@@ -203,7 +203,7 @@ const TagsDialog = () => {
))} ))}
</ScrollView> </ScrollView>
</View> </View>
</ActionSheetWrapper> </SheetWrapper>
); );
}; };

View File

@@ -6,9 +6,9 @@ import { useTracked } from '../../provider';
import {useSettingStore} from '../../provider/stores'; import {useSettingStore} from '../../provider/stores';
import {PremiumToast} from '../Premium/premium-toast'; import {PremiumToast} from '../Premium/premium-toast';
import {Toast} from '../Toast'; import {Toast} from '../Toast';
import { BouncingView } from './BouncingView'; import {BouncingView} from '../Transitions/bouncing-view';
const ActionSheetWrapper = ({ const SheetWrapper = ({
children, children,
fwdRef, fwdRef,
gestureEnabled = true, gestureEnabled = true,
@@ -48,7 +48,6 @@ const ActionSheetWrapper = ({
}; };
const _onClose = async () => { const _onClose = async () => {
//await reFocusEditor();
if (onClose) { if (onClose) {
onClose(); onClose();
} }
@@ -96,4 +95,4 @@ const ActionSheetWrapper = ({
); );
}; };
export default ActionSheetWrapper; export default SheetWrapper;

View File

@@ -2,7 +2,7 @@ import React, {createRef, useEffect, useRef, useState} from 'react';
import {View} from 'react-native'; import {View} from 'react-native';
import Menu, {MenuItem} from 'react-native-reanimated-material-menu'; import Menu, {MenuItem} from 'react-native-reanimated-material-menu';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import ActionSheetWrapper from '../../components/ActionSheetComponent/ActionSheetWrapper'; import SheetWrapper from '../../components/sheet';
import {Button} from '../../components/Button'; import {Button} from '../../components/Button';
import BaseDialog from '../../components/Dialog/base-dialog'; import BaseDialog from '../../components/Dialog/base-dialog';
import DialogButtons from '../../components/Dialog/dialog-buttons'; import DialogButtons from '../../components/Dialog/dialog-buttons';
@@ -161,7 +161,7 @@ export const EditorSettings = () => {
return ( return (
visible && ( visible && (
<ActionSheetWrapper <SheetWrapper
fwdRef={actionSheetRef} fwdRef={actionSheetRef}
onClose={() => { onClose={() => {
setVisible(false); setVisible(false);
@@ -209,7 +209,7 @@ export const EditorSettings = () => {
<SettingsButton {...item} /> <SettingsButton {...item} />
))} ))}
</View> </View>
</ActionSheetWrapper> </SheetWrapper>
) )
); );
}; };