mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
refactor
This commit is contained in:
@@ -10,7 +10,7 @@ import {db} from '../../utils/database';
|
||||
import {ph, pv, SIZE} from '../../utils/SizeUtils';
|
||||
import {sleep} from '../../utils/TimeUtils';
|
||||
import {ActionIcon} from '../ActionIcon';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import {Button} from '../Button';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import Input from '../Input';
|
||||
@@ -254,7 +254,7 @@ export class AddNotebookDialog extends React.Component {
|
||||
const {topics, visible, topicInputFocused} = this.state;
|
||||
if (!visible) return null;
|
||||
return (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
onOpen={async () => {
|
||||
this.topicsToDelete = [];
|
||||
await sleep(300);
|
||||
@@ -408,7 +408,7 @@ export class AddNotebookDialog extends React.Component {
|
||||
</View>
|
||||
|
||||
<Toast context="local" />
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import filesystem from '../../utils/filesystem';
|
||||
import { SIZE } from '../../utils/SizeUtils';
|
||||
import { ActionIcon } from '../ActionIcon';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import GeneralSheet from '../GeneralSheet';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
@@ -57,7 +57,7 @@ export const AttachmentDialog = () => {
|
||||
};
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
centered={false}
|
||||
fwdRef={actionSheetRef}
|
||||
onClose={async () => {
|
||||
@@ -107,7 +107,7 @@ export const AttachmentDialog = () => {
|
||||
{' '}All attachments are end-to-end encrypted.
|
||||
</Paragraph>
|
||||
</View>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
TouchableOpacity
|
||||
} from 'react-native';
|
||||
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
|
||||
import { BouncingView } from '../ActionSheetComponent/BouncingView';
|
||||
import { BouncingView } from '../Transitions/bouncing-view';
|
||||
|
||||
const BaseDialog = ({
|
||||
visible,
|
||||
|
||||
@@ -21,8 +21,8 @@ import {
|
||||
eThemeUpdated
|
||||
} from '../../utils/Events';
|
||||
import { EditorSettings } from '../../views/Editor/EditorSettings';
|
||||
import { ActionSheetComponent } from '../ActionSheetComponent';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import { Properties } from '../Properties';
|
||||
import SheetWrapper from '../sheet';
|
||||
import { AddNotebookDialog } from '../AddNotebookDialog';
|
||||
import { AddTopicDialog } from '../AddTopicDialog';
|
||||
import { AnnouncementDialog } from '../Announcements';
|
||||
@@ -237,7 +237,7 @@ export class DialogManager extends Component {
|
||||
return (
|
||||
<>
|
||||
{!this.state.actionSheetVisible ? null : (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
fwdRef={this.actionSheet}
|
||||
onClose={() => {
|
||||
eSendEvent(eShowGetPremium, null);
|
||||
@@ -246,15 +246,11 @@ export class DialogManager extends Component {
|
||||
actionSheetVisible: false
|
||||
});
|
||||
}}>
|
||||
<ActionSheetComponent
|
||||
<Properties
|
||||
item={item}
|
||||
setWillRefresh={value => {
|
||||
this.willRefresh = true;
|
||||
}}
|
||||
getRef={() => this.actionSheet}
|
||||
hasColors={actionSheetData.colors}
|
||||
hasTags={actionSheetData.colors}
|
||||
overlayColor="rgba(0,0,0,0.3)"
|
||||
rowItems={actionSheetData.rowItems}
|
||||
columnItems={actionSheetData.columnItems}
|
||||
close={value => {
|
||||
@@ -264,7 +260,7 @@ export class DialogManager extends Component {
|
||||
this.actionSheet.current?.setModalVisible();
|
||||
}}
|
||||
/>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
)}
|
||||
<Dialog context="global" />
|
||||
<AddTopicDialog
|
||||
|
||||
@@ -10,7 +10,7 @@ import Exporter from '../../services/Exporter';
|
||||
import { getElevation } from '../../utils';
|
||||
import { ph, pv, SIZE } from '../../utils/SizeUtils';
|
||||
import { sleep } from '../../utils/TimeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import { Button } from '../Button';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import { PressableButton } from '../PressableButton';
|
||||
@@ -132,7 +132,7 @@ const ExportDialog = () => {
|
||||
];
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper fwdRef={actionSheetRef} onClose={close} visible={true}>
|
||||
<SheetWrapper fwdRef={actionSheetRef} onClose={close} visible={true}>
|
||||
<View>
|
||||
<View
|
||||
style={{
|
||||
@@ -269,7 +269,7 @@ const ExportDialog = () => {
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ 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 SheetWrapper from '../sheet';
|
||||
import {Button} from '../Button';
|
||||
import Heading from '../Typography/Heading';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
@@ -50,7 +50,7 @@ const GeneralSheet = ({context}) => {
|
||||
};
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
fwdRef={actionSheetRef}
|
||||
gestureEnabled={dialogData?.noProgress}
|
||||
closeOnTouchBackdrop={dialogData?.noProgress}
|
||||
@@ -166,7 +166,7 @@ const GeneralSheet = ({context}) => {
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import {MMKV} from '../../utils/mmkv';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import Storage from '../../utils/storage';
|
||||
import {sleep} from '../../utils/TimeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import BaseDialog from '../Dialog/base-dialog';
|
||||
import DialogButtons from '../Dialog/dialog-buttons';
|
||||
import DialogContainer from '../Dialog/dialog-container';
|
||||
@@ -410,7 +410,7 @@ const LoginDialog = () => {
|
||||
};
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
fwdRef={actionSheetRef}
|
||||
animation={DDS.isTab ? 'fade' : 'slide'}
|
||||
statusBarTranslucent={false}
|
||||
@@ -755,7 +755,7 @@ const LoginDialog = () => {
|
||||
}}
|
||||
/>
|
||||
</ScrollView>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import Navigation from '../../services/Navigation';
|
||||
import {db} from '../../utils/database';
|
||||
import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';
|
||||
import {normalize, SIZE} from '../../utils/SizeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import {Button} from '../Button';
|
||||
import {ActionSheetEvent} from '../DialogManager/recievers';
|
||||
import {PressableButton} from '../PressableButton';
|
||||
@@ -126,7 +126,7 @@ const PinItem = ({item, index, onPress}) => {
|
||||
return (
|
||||
<>
|
||||
{visible && (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
onClose={() => {
|
||||
setVisible(false);
|
||||
}}
|
||||
@@ -149,7 +149,7 @@ const PinItem = ({item, index, onPress}) => {
|
||||
marginBottom: 30
|
||||
}}
|
||||
/>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
)}
|
||||
<PressableButton
|
||||
type={headerTextState?.id === item.id ? 'grayBg' : 'gray'}
|
||||
|
||||
@@ -17,7 +17,7 @@ import {getTotalNotes} from '../../utils';
|
||||
import {db} from '../../utils/database';
|
||||
import {eOpenMoveNoteDialog} from '../../utils/Events';
|
||||
import {pv, SIZE} from '../../utils/SizeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import {Button} from '../Button';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import {PressableButton} from '../PressableButton';
|
||||
@@ -68,9 +68,9 @@ const MoveNoteDialog = () => {
|
||||
};
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper fwdRef={actionSheetRef} onClose={_onClose}>
|
||||
<SheetWrapper fwdRef={actionSheetRef} onClose={_onClose}>
|
||||
<MoveNoteComponent close={close} note={note} setNote={update} />
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ import {Topics} from './topics';
|
||||
const w = Dimensions.get('window').width;
|
||||
|
||||
let htmlToText;
|
||||
export const ActionSheetComponent = ({
|
||||
export const Properties = ({
|
||||
close = () => {},
|
||||
item,
|
||||
hasColors = false,
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import {openLinkInBrowser} from '../../utils/functions';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import {ActionIcon} from '../ActionIcon';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import {Button} from '../Button';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import Input from '../Input';
|
||||
@@ -129,7 +129,7 @@ const PublishNoteDialog = () => {
|
||||
};
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
centered={false}
|
||||
fwdRef={actionSheetRef}
|
||||
closeOnTouchBackdrop={!publishing}
|
||||
@@ -366,7 +366,7 @@ const PublishNoteDialog = () => {
|
||||
Learn more about Notesnook Monograph
|
||||
</Paragraph>
|
||||
</View>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
||||
import {eCloseRateDialog, eOpenRateDialog} from '../../utils/Events';
|
||||
import {MMKV} from '../../utils/mmkv';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import {Button} from '../Button';
|
||||
import Seperator from '../Seperator';
|
||||
import Heading from '../Typography/Heading';
|
||||
@@ -37,7 +37,7 @@ const RateDialog = () => {
|
||||
};
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
centered={false}
|
||||
fwdRef={actionSheetRef}
|
||||
onClose={async () => {
|
||||
@@ -117,7 +117,7 @@ const RateDialog = () => {
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import {sanitizeFilename} from '../../utils/filename';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import Storage from '../../utils/storage';
|
||||
import {sleep} from '../../utils/TimeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import {Button} from '../Button';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import Seperator from '../Seperator';
|
||||
@@ -185,7 +185,7 @@ class RecoveryKeyDialog extends React.Component {
|
||||
const {colors} = this.props;
|
||||
if (!this.state.visible) return null;
|
||||
return (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
closeOnTouchBackdrop={false}
|
||||
gestureEnabled={false}
|
||||
onOpen={this.onOpen}
|
||||
@@ -317,7 +317,7 @@ class RecoveryKeyDialog extends React.Component {
|
||||
onPress={this.close}
|
||||
/>
|
||||
</View>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import {MMKV} from '../../utils/mmkv';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import storage from '../../utils/storage';
|
||||
import {sleep, timeConverter} from '../../utils/TimeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import {Button} from '../Button';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import Seperator from '../Seperator';
|
||||
@@ -60,7 +60,7 @@ const RestoreDialog = () => {
|
||||
};
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
fwdRef={actionSheetRef}
|
||||
gestureEnabled={!restoring}
|
||||
closeOnTouchBackdrop={!restoring}
|
||||
@@ -70,7 +70,7 @@ const RestoreDialog = () => {
|
||||
restoring={restoring}
|
||||
setRestoring={setRestoring}
|
||||
/>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import Navigation from '../../services/Navigation';
|
||||
import {db} from '../../utils/database';
|
||||
import {eCloseTagsDialog, eOpenTagsDialog, refreshNotesPage} from '../../utils/Events';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import SheetWrapper from '../sheet';
|
||||
import Input from '../Input';
|
||||
import {PressableButton} from '../PressableButton';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
@@ -117,7 +117,7 @@ const TagsDialog = () => {
|
||||
};
|
||||
|
||||
return !visible ? null : (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
centered={false}
|
||||
fwdRef={actionSheetRef}
|
||||
onOpen={async () => {
|
||||
@@ -203,7 +203,7 @@ const TagsDialog = () => {
|
||||
))}
|
||||
</ScrollView>
|
||||
</View>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import React from 'react';
|
||||
import { Platform, View } from 'react-native';
|
||||
import {Platform, View} from 'react-native';
|
||||
import ActionSheet from 'react-native-actions-sheet';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useTracked } from '../../provider';
|
||||
import { useSettingStore } from '../../provider/stores';
|
||||
import { PremiumToast } from '../Premium/premium-toast';
|
||||
import { Toast } from '../Toast';
|
||||
import { BouncingView } from './BouncingView';
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
import {useTracked} from '../../provider';
|
||||
import {useSettingStore} from '../../provider/stores';
|
||||
import {PremiumToast} from '../Premium/premium-toast';
|
||||
import {Toast} from '../Toast';
|
||||
import {BouncingView} from '../Transitions/bouncing-view';
|
||||
|
||||
const ActionSheetWrapper = ({
|
||||
const SheetWrapper = ({
|
||||
children,
|
||||
fwdRef,
|
||||
gestureEnabled = true,
|
||||
@@ -48,7 +48,6 @@ const ActionSheetWrapper = ({
|
||||
};
|
||||
|
||||
const _onClose = async () => {
|
||||
//await reFocusEditor();
|
||||
if (onClose) {
|
||||
onClose();
|
||||
}
|
||||
@@ -96,4 +95,4 @@ const ActionSheetWrapper = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default ActionSheetWrapper;
|
||||
export default SheetWrapper;
|
||||
@@ -2,7 +2,7 @@ import React, {createRef, useEffect, useRef, useState} from 'react';
|
||||
import {View} from 'react-native';
|
||||
import Menu, {MenuItem} from 'react-native-reanimated-material-menu';
|
||||
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 BaseDialog from '../../components/Dialog/base-dialog';
|
||||
import DialogButtons from '../../components/Dialog/dialog-buttons';
|
||||
@@ -161,7 +161,7 @@ export const EditorSettings = () => {
|
||||
|
||||
return (
|
||||
visible && (
|
||||
<ActionSheetWrapper
|
||||
<SheetWrapper
|
||||
fwdRef={actionSheetRef}
|
||||
onClose={() => {
|
||||
setVisible(false);
|
||||
@@ -209,7 +209,7 @@ export const EditorSettings = () => {
|
||||
<SettingsButton {...item} />
|
||||
))}
|
||||
</View>
|
||||
</ActionSheetWrapper>
|
||||
</SheetWrapper>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user