Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

always show overlay when loading a note

ammarahm-ed63e81ab831cd
diff --git a/apps/mobile/src/views/Editor/EditorOverlay.js b/apps/mobile/src/views/Editor/EditorOverlay.js
index ea9096a27..891050a64 100644
--- a/apps/mobile/src/views/Editor/EditorOverlay.js
+++ b/apps/mobile/src/views/Editor/EditorOverlay.js
@@ -1,16 +1,15 @@
-import React, {useEffect, useState} from 'react';
-import {ActivityIndicator} from 'react-native';
-import {View} from 'react-native';
-import {Button} from '../../components/Button';
-import Heading from '../../components/Typography/Heading';
+import React, { useEffect, useState } from 'react';
+import { ActivityIndicator, View } from 'react-native';
+import Animated, { Easing, timing, useValue } from 'react-native-reanimated';
+import { Button } from '../../components/Button';
import Paragraph from '../../components/Typography/Paragraph';
-import {useTracked} from '../../provider';
+import { useTracked } from '../../provider';
import {
eSendEvent,
eSubscribeEvent,
- eUnSubscribeEvent,
+ eUnSubscribeEvent
} from '../../services/EventManager';
-import {SIZE} from '../../utils/SizeUtils';
+import { SIZE } from '../../utils/SizeUtils';
let timer = null;
let timerError = null;
@@ -19,19 +18,28 @@ const EditorOverlay = () => {
const {colors} = state;
const [loading, setLoading] = useState(false);
const [error, setError] = useState(false);
+ const opacity = useValue(1);
const load = (loading) => {
clearTimeout(timer);
clearTimeout(timerError);
if (loading) {
- timer = setTimeout(() => {
- setLoading(loading);
- timerError = setTimeout(() => {
- setError(true);
- }, 6000);
- }, 3000);
+ setLoading(loading);
+ timerError = setTimeout(() => {
+ setError(true);
+ }, 6000);
} else {
setError(false);
- setLoading(false);
+ timing(opacity, {
+ toValue: 0,
+ duration: 300,
+ easing: Easing.out(Easing.ease),
+ }).start(() => {
+ setTimeout(() => {
+ opacity.setValue(1);
+ clearTimeout(timerError);
+ setLoading(false);
+ }, 300);
+ });
}
};
@@ -44,14 +52,15 @@ const EditorOverlay = () => {
return (
loading && (
- <View
+ <Animated.View
style={{
position: 'absolute',
width: '100%',
height: '100%',
- backgroundColor: 'rgba(0,0,0,0.2)',
+ backgroundColor: colors.bg,
justifyContent: 'center',
alignItems: 'center',
+ opacity: opacity,
}}>
<View
style={{
@@ -92,7 +101,7 @@ const EditorOverlay = () => {
</>
)}
</View>
- </View>
+ </Animated.View>
)
);
};
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index ffb70d0dd..e13e6720a 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -240,7 +240,7 @@ export const _onMessage = async (evt) => {
eSendEvent('historyEvent', message.value);
break;
case 'tiny':
- console.log('change', message);
+ console.log('change');
content = {
type: message.type,
data: message.value,