Skip to content

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

do not indicate currentScreen on JumpToDialog

ammarahm-ed4e8feb790657
diff --git a/apps/mobile/src/components/JumpToDialog/index.js b/apps/mobile/src/components/JumpToDialog/index.js
index b9d1589fd..07ba4db7e 100644
--- a/apps/mobile/src/components/JumpToDialog/index.js
+++ b/apps/mobile/src/components/JumpToDialog/index.js
@@ -7,11 +7,7 @@ import {useTracked} from '../../provider';
import {DDS} from '../../services/DeviceDetection';
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
import {getElevation, scrollRef} from '../../utils';
-import {
- eCloseJumpToDialog,
- eOpenJumpToDialog,
- eScrollEvent,
-} from '../../utils/Events';
+import {eCloseJumpToDialog, eOpenJumpToDialog} from '../../utils/Events';
import {SIZE, WEIGHT} from '../../utils/SizeUtils';
import Paragraph from '../Typography/Paragraph';
@@ -24,26 +20,26 @@ const JumpToDialog = () => {
const [currentIndex, setCurrentIndex] = useState(0);
const onPress = (item, index) => {
- let offset = 30 * index;
+ let offset = 35 * index;
let ind = notes.findIndex(
(i) => i.title === item.title && i.type === 'header',
);
ind = ind + 1;
ind = ind - (index + 1);
- offset = offset + ind * 100;
- scrollRef.current?.scrollToOffset(0, index === 0 ? 0 : offset + 50, true);
+ offset = offset + ind * 100 + 200;
+ scrollRef.current?.scrollToOffset(0, index === 0 ? 0 : offset, true);
close();
};
useEffect(() => {
eSubscribeEvent(eOpenJumpToDialog, open);
eSubscribeEvent(eCloseJumpToDialog, close);
- eSubscribeEvent(eScrollEvent, onScroll);
+ //eSubscribeEvent(eScrollEvent, onScroll);
return () => {
eUnSubscribeEvent(eOpenJumpToDialog, open);
eUnSubscribeEvent(eCloseJumpToDialog, close);
- eUnSubscribeEvent(eScrollEvent, onScroll);
+ //eUnSubscribeEvent(eScrollEvent, onScroll);
};
}, []);
@@ -54,8 +50,8 @@ const JumpToDialog = () => {
}
timeout = setTimeout(() => {
let index = offsets.findIndex((o, i) => o <= y && offsets[i + 1] > y);
- setCurrentIndex(index);
- }, 30);
+ //setCurrentIndex(index);
+ }, 100);
};
const open = () => {
@@ -74,13 +70,14 @@ const JumpToDialog = () => {
notes
.filter((i) => i.type === 'header')
.map((item, index) => {
- let offset = 30 * index;
+ let offset = 35 * index;
let ind = notes.findIndex(
(i) => i.title === item.title && i.type === 'header',
);
ind = ind + 1;
ind = ind - (index + 1);
- offset = offset + ind * 100;
+ offset = offset + ind * 100 + 200;
+
offsets.push(offset);
});
};
@@ -130,6 +127,7 @@ const JumpToDialog = () => {
.filter((i) => i.type === 'header')
.map((item, index) => (
<PressableButton
+ key={item.title}
onPress={() => onPress(item, index)}
color={currentIndex === index ? colors.shade : 'transparent'}
selectedColor={