Skip to content

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

change header style

ammarahm-ed80ee8374a34b
diff --git a/apps/mobile/src/components/Header/HeaderTitle.js b/apps/mobile/src/components/Header/HeaderTitle.js
index 352e77adc..0760d2fc2 100644
--- a/apps/mobile/src/components/Header/HeaderTitle.js
+++ b/apps/mobile/src/components/Header/HeaderTitle.js
@@ -1,14 +1,39 @@
-import React from 'react';
+import React, {useEffect} from 'react';
import {Text} from 'react-native';
+import Animated from 'react-native-reanimated';
import {useTracked} from '../../provider';
+import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
+import {eScrollEvent} from '../../utils/Events';
import Heading from '../Typography/Heading';
+const opacity = new Animated.Value(0);
+
export const HeaderTitle = () => {
const [state] = useTracked();
const {colors, headerTextState} = state;
+ const onScroll = async (y) => {
+ if (y > 75) {
+ let yVal = y - 75;
+ o = yVal / 75;
+ opacity.setValue(o);
+ } else {
+ opacity.setValue(0);
+ }
+ };
+
+ useEffect(() => {
+ eSubscribeEvent(eScrollEvent, onScroll);
+ return () => {
+ eUnSubscribeEvent(eScrollEvent, onScroll);
+ };
+ }, []);
+
return (
- <>
+ <Animated.View
+ style={{
+ opacity: opacity,
+ }}>
<Heading color={headerTextState.color}>
<Text
style={{
@@ -21,6 +46,6 @@ export const HeaderTitle = () => {
? headerTextState.heading.slice(1)
: headerTextState.heading}
</Heading>
- </>
+ </Animated.View>
);
};
diff --git a/apps/mobile/src/components/Header/index.js b/apps/mobile/src/components/Header/index.js
index 54bf8d1b6..a9a0bbe5c 100644
--- a/apps/mobile/src/components/Header/index.js
+++ b/apps/mobile/src/components/Header/index.js
@@ -23,7 +23,7 @@ export const Header = ({root}) => {
const [hide, setHide] = useState(false);
const onScroll = (y) => {
- if (y > 3) {
+ if (y > 150) {
setHide(false);
} else {
setHide(true);