From 6f4904d247ff7020ef852d60a121c873b3fe8f9c Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Thu, 3 Jun 2021 12:07:54 +0500 Subject: [PATCH] minor bug fixes --- .../src/components/ListPlaceholders/index.js | 9 ++--- .../src/components/SplashScreen/index.js | 3 +- apps/mobile/src/navigation/Drawer.js | 1 + apps/mobile/src/views/Editor/Functions.js | 40 +++++++++++-------- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/apps/mobile/src/components/ListPlaceholders/index.js b/apps/mobile/src/components/ListPlaceholders/index.js index 1889f234a..78a1b6466 100644 --- a/apps/mobile/src/components/ListPlaceholders/index.js +++ b/apps/mobile/src/components/ListPlaceholders/index.js @@ -16,8 +16,7 @@ import { } from '../../assets/images/assets'; import {useTracked} from '../../provider'; import FastImage from 'react-native-fast-image'; -export const Placeholder = React.memo( - ({type, w, h, color}) => { +export const Placeholder = ({type, w, h, color}) => { const [state, dispatch] = useTracked(); const {colors} = state; const getSVG = () => { @@ -53,10 +52,8 @@ export const Placeholder = React.memo( width={w} height={h} /> - ); - }, - () => true, -); + ) + } export const SvgToPngView = ({width, height, src, color, img}) => { const [error, setError] = useState(false); diff --git a/apps/mobile/src/components/SplashScreen/index.js b/apps/mobile/src/components/SplashScreen/index.js index 97811522c..ae2823ccd 100644 --- a/apps/mobile/src/components/SplashScreen/index.js +++ b/apps/mobile/src/components/SplashScreen/index.js @@ -27,6 +27,7 @@ import {openLinkInBrowser} from '../../utils/functions'; import {Modal} from 'react-native'; import {SafeAreaView} from 'react-native'; import {SvgToPngView} from '../ListPlaceholders'; +import { MMKV } from '../../utils/mmkv'; const features = [ { @@ -81,7 +82,7 @@ const SplashScreen = () => { const translateY2 = useValue(0); useEffect(() => { - Storage.read('introCompleted').then(async (r) => { + MMKV.getStringAsync('introCompleted').then(async (r) => { setTimeout(() => { if (!r) { setVisible(true); diff --git a/apps/mobile/src/navigation/Drawer.js b/apps/mobile/src/navigation/Drawer.js index 860867e2f..66767987a 100644 --- a/apps/mobile/src/navigation/Drawer.js +++ b/apps/mobile/src/navigation/Drawer.js @@ -69,6 +69,7 @@ export const NavigationStack = ({component = NavigatorStack}) => { width: deviceMode !== 'mobile' ? 0 : '75%', borderRightWidth: 0, }} + edgeWidth={200} drawerType="slide" drawerContent={deviceMode !== 'mobile' ? () => <> : DrawerComponent} diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js index c1ddceb75..d85511231 100644 --- a/apps/mobile/src/views/Editor/Functions.js +++ b/apps/mobile/src/views/Editor/Functions.js @@ -407,24 +407,30 @@ function onNoteChange() { } export async function clearEditor() { - tiny.call(EditorWebView, tiny.reset, true); - clearTimer(); - if ( - (content?.data && content.data?.trim().length > 0) || - (title && title.trim().length > 0) - ) { - await saveNote(true); + try { + tiny.call(EditorWebView, tiny.reset, true); + clearTimer(); + if ( + (content?.data && + typeof content.data == 'string' && + content.data?.trim().length > 0) || + (title && title?.trim().length > 0) + ) { + await saveNote(true); + } + clearNote(); + editing.focusType = null; + eSendEvent('historyEvent', { + undo: 0, + redo: 0, + }); + saveCounter = 0; + setTimeout(() => { + updateEvent({type: Actions.CURRENT_EDITING_NOTE, id: null}); + }, 1); + } catch (e) { + console.log(e); } - clearNote(); - editing.focusType = null; - eSendEvent('historyEvent', { - undo: 0, - redo: 0, - }); - saveCounter = 0; - setTimeout(() => { - updateEvent({type: Actions.CURRENT_EDITING_NOTE, id: null}); - }, 1); } async function setNoteInEditorAfterSaving(oldId, currentId) {