Skip to content

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

minor refactoring

Ammar Ahmed35eeb5696b04
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index 7f8f9e5cb..1093f9f1e 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -32,7 +32,7 @@ let passwordValue = null;
let didVerifyUser = false;
const opacityV = new Animated.Value(1);
const AppLoader = ({onLoad}) => {
- const [state, dispatch] = useTracked();
+ const [state,] = useTracked();
const colors = state.colors;
const [loading, setLoading] = useState(true);
const setNotes = useNoteStore(state => state.setNotes);
diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js
index 61b32f890..65b6d4851 100644
--- a/apps/mobile/src/components/Container/index.js
+++ b/apps/mobile/src/components/Container/index.js
@@ -2,7 +2,7 @@ import React from 'react';
import { KeyboardAvoidingView, Platform, SafeAreaView } from 'react-native';
import { useTracked } from '../../provider';
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
-export const Container = ({children, root}) => {
+export const Container = ({children}) => {
const [state] = useTracked();
const {colors, } = state;
const floating = useIsFloatingKeyboard();
diff --git a/apps/mobile/src/components/Header/index.js b/apps/mobile/src/components/Header/index.js
index 5dd32d923..c08d09b7c 100644
--- a/apps/mobile/src/components/Header/index.js
+++ b/apps/mobile/src/components/Header/index.js
@@ -11,7 +11,7 @@ import {ActionIcon} from '../ActionIcon';
import {SearchInput} from '../SearchInput';
import {HeaderLeftMenu} from './HeaderLeftMenu';
import {HeaderRightMenu} from './HeaderRightMenu';
-import {HeaderTitle} from './HeaderTitle';
+import {Title} from './title';
export const Header = React.memo(
({root, title, screen, isBack, color, action}) => {
@@ -54,7 +54,7 @@ export const Header = React.memo(
{(Platform.OS === 'android' || Platform.isPad) &&
screen !== 'Search' ? (
- <HeaderTitle
+ <Title
headerColor={color}
heading={title}
screen={screen}
@@ -63,7 +63,7 @@ export const Header = React.memo(
) : null}
</View>
{Platform.OS !== 'android' && !Platform.isPad && screen !== 'Search' ? (
- <HeaderTitle
+ <Title
headerColor={color}
heading={title}
screen={screen}
diff --git a/apps/mobile/src/components/Header/HeaderTitle.js b/apps/mobile/src/components/Header/title.js
similarity index 76%
rename from apps/mobile/src/components/Header/HeaderTitle.js
rename to apps/mobile/src/components/Header/title.js
index d197609f6..0cd049c98 100644
--- a/apps/mobile/src/components/Header/HeaderTitle.js
+++ b/apps/mobile/src/components/Header/title.js
@@ -1,20 +1,20 @@
import React, { useEffect } from 'react';
import Animated, { useValue } from 'react-native-reanimated';
import { useTracked } from '../../provider';
-import { DDS } from '../../services/DeviceDetection';
+import { useSettingStore } from '../../provider/stores';
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
import { eScrollEvent } from '../../utils/Events';
import Heading from '../Typography/Heading';
-
-export const HeaderTitle = ({heading,headerColor,screen}) => {
+export const Title = ({heading,headerColor,screen}) => {
const [state] = useTracked();
const {colors} = state;
- const opacity = useValue(DDS.isLargeTablet() ? 1 : 0)
+ const deviceMode = useSettingStore(state => state.deviceMode);
+ const opacity = useValue(deviceMode !== "mobile" ? 1 : 0)
const onScroll = async (data) => {
if (data.screen !== screen) return;
- if (DDS.isTab) return;
+ if (deviceMode !== "mobile") return;
if (data.y > 75) {
let yVal = data.y - 75;
o = yVal / 75;
@@ -34,7 +34,7 @@ export const HeaderTitle = ({heading,headerColor,screen}) => {
return (
<Animated.View
style={{
- opacity: DDS.isTab ? 1 : opacity,
+ opacity: deviceMode !== "mobile" ? 1 : opacity,
}}>
<Heading color={headerColor}>
<Heading color={colors.accent}>