Skip to content

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

fix swipe down animation

ammarahm-ed598b38aa6dbe
diff --git a/apps/mobile/src/views/Editor/EditorWrapper.js b/apps/mobile/src/views/Editor/EditorWrapper.js
index c4cd5d463..7592f922d 100644
--- a/apps/mobile/src/views/Editor/EditorWrapper.js
+++ b/apps/mobile/src/views/Editor/EditorWrapper.js
@@ -9,26 +9,25 @@ import { eSendEvent } from '../../services/EventManager';
import { eOnLoadNote } from '../../utils/Events';
import Editor from './index';
-let prevVal = -80;
-let finalValue = 0;
-let anim2 = new Animated.Value(-80);
+let prevVal = 0;
+let finalValue = 80;
+let anim2 = new Animated.Value(0);
const op1 = new Animated.Value(1);
const op2 = new Animated.Value(0);
const op3 = new Animated.Value(0);
const onHandlerStateChange = (evt) => {
if (evt.nativeEvent.state === State.END) {
if (evt.nativeEvent.translationY >= finalValue) {
- console.log('I can be called too');
eSendEvent(eOnLoadNote, {type: 'new'});
opacityAnim(0, 1, 0);
setTimeout(() => {
- animation(-80);
+ animation(0);
setTimeout(() => {
opacityAnim(1, 0, 0);
}, 150);
}, 200);
} else {
- animation(-80);
+ animation(0);
setTimeout(() => {
opacityAnim(1, 0, 0);
}, 150);
@@ -38,15 +37,15 @@ const onHandlerStateChange = (evt) => {
const onGestureEvent = (event) => {
if (event.nativeEvent.translationY < 0) return;
- let v = -80 + event.nativeEvent.translationY;
- if (v >= 0 && prevVal !== 0) {
- prevVal = 0;
- animation(0);
+ let v = event.nativeEvent.translationY;
+ if (v >= 80 && prevVal !== 80) {
+ prevVal = 80;
+ animation(80);
opacityAnim(0, 0, 1);
return;
}
- if (v >= 0) return;
+ if (v >= 80) return;
prevVal = v;
anim2.setValue(v);
};
@@ -101,10 +100,12 @@ export const EditorWrapper = () => {
],
height: '100%',
width: '100%',
+
}}>
<View
style={{
height: 80,
+ position:'absolute',
backgroundColor: colors.accent,
width: '100%',
justifyContent: 'center',
@@ -112,7 +113,7 @@ export const EditorWrapper = () => {
zIndex: 10,
transform: [
{
- translateY: insets.top,
+ translateY: - 80 + insets.top,
},
],
}}>