A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix navigating back to route feels slow
Ammar Ahmed1d5d2cc349eb
diff --git a/apps/mobile/src/components/delaylayout/index.tsx b/apps/mobile/src/components/delaylayout/index.tsxindex 63e088cf2..c12c10a65 100644--- a/apps/mobile/src/components/delaylayout/index.tsx+++ b/apps/mobile/src/components/delaylayout/index.tsx@@ -1,5 +1,6 @@import React from 'react';import { View, ViewProps } from 'react-native';+import Animated, { FadeInDown, FadeInUp, FadeOutDown, FadeOutUp } from 'react-native-reanimated';import { useThemeStore } from '../../stores/use-theme-store';import { useDelayLayout } from '../../utils/hooks/use-delay-layout';import { DefaultPlaceholder } from './default-placeholder';@@ -20,11 +21,11 @@ const placeholder = {export default function DelayLayout(props: IDelayLayoutProps) {const colors = useThemeStore(state => state.colors);const loading = useDelayLayout(!props.delay || props.delay < 300 ? 300 : props.delay);-const Placeholder = placeholder[props.type || 'default'];return loading || props.wait ? (- <View+ <Animated.View+ exiting={FadeOutUp}style={{backgroundColor: colors.bg,flex: 1,@@ -32,7 +33,7 @@ export default function DelayLayout(props: IDelayLayoutProps) {}}><Placeholder color={props.color} />- </View>+ </Animated.View>) : (<>{props.children}</>);diff --git a/apps/mobile/src/components/list/index.js b/apps/mobile/src/components/list/index.jsindex c7893a713..8e1391d93 100644--- a/apps/mobile/src/components/list/index.js+++ b/apps/mobile/src/components/list/index.js@@ -1,5 +1,6 @@import React, { useRef } from 'react';-import { FlatList, RefreshControl, View } from 'react-native';+import { RefreshControl, View } from 'react-native';+import Animated, { FadeInDown } from 'react-native-reanimated';import { notesnook } from '../../../e2e/test.ids';import { eSendEvent } from '../../services/event-manager';import Sync from '../../services/sync';@@ -108,7 +109,8 @@ const List = ({return (<>- <FlatList+ <Animated.FlatList+ entering={type === 'search' ? undefined : FadeInDown}style={styles}keyExtractor={_keyExtractor}ref={scrollRef}diff --git a/apps/mobile/src/components/sidemenu/pinnedsection.js b/apps/mobile/src/components/sidemenu/pinnedsection.jsindex 0a501415b..0f428eeb5 100644--- a/apps/mobile/src/components/sidemenu/pinnedsection.js+++ b/apps/mobile/src/components/sidemenu/pinnedsection.js@@ -1,14 +1,15 @@import React, { useEffect, useRef, useState } from 'react';import { FlatList, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import { eSendEvent } from '../../services/event-manager';+import Notebook from '../../screens/notebook';+import { TaggedNotes } from '../../screens/notes/tagged';+import { TopicNotes } from '../../screens/notes/topic-notes';import Navigation from '../../services/navigation';-import useNavigationStore from '../../stores/use-navigation-store';import { useMenuStore } from '../../stores/use-menu-store';+import useNavigationStore from '../../stores/use-navigation-store';import { useNoteStore } from '../../stores/use-notes-store';import { useThemeStore } from '../../stores/use-theme-store';import { db } from '../../utils/database';-import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/events';import { normalize, SIZE } from '../../utils/size';import { Properties } from '../properties';import { Button } from '../ui/button';@@ -18,9 +19,6 @@ import Seperator from '../ui/seperator';import SheetWrapper from '../ui/sheet';import Heading from '../ui/typography/heading';import Paragraph from '../ui/typography/paragraph';-import { TaggedNotes } from '../../screens/notes/tagged';-import { TopicNotes } from '../../screens/notes/topic-notes';-import Notebook from '../../screens/notebook';export const TagsSection = React.memo(() => {diff --git a/apps/mobile/src/screens/notebook/index.tsx b/apps/mobile/src/screens/notebook/index.tsxindex da5fe20c0..3b50f0dd1 100644--- a/apps/mobile/src/screens/notebook/index.tsx+++ b/apps/mobile/src/screens/notebook/index.tsx@@ -18,7 +18,6 @@ const Notebook = ({ route, navigation }: NavigationProps<'Notebook'>) => {const [topics, setTopics] = useState(groupArray(qclone(route?.params.item?.topics) || [], db.settings?.getGroupOptions('topics')));- console.log(route.params);const params = useRef<NotebookScreenParams>(route?.params);useNavigationFocus(navigation, {onFocus: () => {diff --git a/apps/mobile/src/utils/hooks/useNavigationFocus.ts b/apps/mobile/src/utils/hooks/useNavigationFocus.tsindex d129d3c03..07e35963a 100644--- a/apps/mobile/src/utils/hooks/useNavigationFocus.ts+++ b/apps/mobile/src/utils/hooks/useNavigationFocus.ts@@ -14,19 +14,25 @@ export const useNavigationFocus = () => {const [isFocused, setFocused] = useState(focusOnInit);const prev = useRef(false);+ const isBlurred = useRef(false);const _onFocus = useCallback(() => {- setTimeout(() => {- console.log('on focus', prev);- let shouldFocus = onFocus ? onFocus(prev) : true;- if (shouldFocus) {- setFocused(true);- prev.current = true;- }- }, delay || 300);+ setTimeout(+ () => {+ console.log('on focus', prev);+ let shouldFocus = onFocus ? onFocus(prev) : true;+ if (shouldFocus) {+ setFocused(true);+ prev.current = true;+ }+ isBlurred.current = false;+ },+ isBlurred.current ? 0 : delay || 300+ );}, [onFocus, prev]);const _onBlur = useCallback(() => {+ isBlurred.current = true;setTimeout(() => {let shouldBlur = onBlur ? onBlur(prev) : true;if (shouldBlur) {