Skip to content

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

fix: flicker in animation when switched to selection mode.

ammarahm-ed3b0af710cac2
diff --git a/apps/mobile/src/components/Container/ContainerTopSection.js b/apps/mobile/src/components/Container/ContainerTopSection.js
index 0c6b62508..c3c2d6e8c 100644
--- a/apps/mobile/src/components/Container/ContainerTopSection.js
+++ b/apps/mobile/src/components/Container/ContainerTopSection.js
@@ -1,40 +1,26 @@
-import React, {useEffect} from 'react';
-import Animated, {Easing, useValue} from 'react-native-reanimated';
-import {useTracked} from '../../provider';
-import {Header} from '../Header';
+import React from 'react';
+import { View } from 'react-native';
+import { useTracked } from '../../provider';
+import { Header } from '../Header';
export const ContainerTopSection = ({root}) => {
- const [state,] = useTracked();
+ const [state] = useTracked();
const {colors, selectionMode} = state;
- const opacity = useValue(0);
- const translateY = useValue(0);
- useEffect(() => {
- Animated.timing(opacity, {
- duration: 100,
- toValue: selectionMode ? 0 : 1,
- easing: Easing.in(Easing.ease),
- }).start();
- Animated.timing(translateY, {
- toValue: selectionMode ? -150 : 0,
- duration: 100,
- easing: Easing.in(Easing.ease),
- }).start();
- }, [selectionMode]);
return (
- <Animated.View
+ <View
style={{
backgroundColor: colors.bg,
width: '100%',
- opacity: opacity,
+ opacity: selectionMode ? 0 : 1,
overflow: 'hidden',
transform: [
{
- translateY: translateY,
+ translateY: selectionMode ? -150 : 0,
},
],
}}>
- <Header root={root} />
- </Animated.View>
+ <Header root={root} />
+ </View>
);
};
diff --git a/apps/mobile/src/components/SelectionHeader/index.js b/apps/mobile/src/components/SelectionHeader/index.js
index 7021bc55e..57becca42 100644
--- a/apps/mobile/src/components/SelectionHeader/index.js
+++ b/apps/mobile/src/components/SelectionHeader/index.js
@@ -29,6 +29,7 @@ export const SelectionHeader = () => {
const {colors, selectionMode, selectedItemsList} = state;
const insets = useSafeAreaInsets();
const translateY = useValue(-150);
+ const opacity = useValue(0);
const [headerTextState, setHeaderTextState] = useState(
Navigation.getHeaderState(),
@@ -48,9 +49,10 @@ export const SelectionHeader = () => {
}, []);
useEffect(() => {
- Animated.timing(translateY, {
- duration: 300,
- toValue: selectionMode ? 0 : -150,
+ translateY.setValue(selectionMode ? 0 : -150);
+ Animated.timing(opacity, {
+ duration: 200,
+ toValue: selectionMode ? 1 : 0,
easing: Easing.in(Easing.ease),
}).start();
}, [selectionMode]);
@@ -67,6 +69,7 @@ export const SelectionHeader = () => {
alignItems: 'center',
flexDirection: 'row',
zIndex: 999,
+ opacity: opacity,
paddingHorizontal: 12,
transform: [
{