Skip to content

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

fix pinning items to menu

ammarahm-ed75f8441f0f89
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index 44482157c..925f5e0ef 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -83,9 +83,7 @@ export const ActionSheetComponent = ({
if (item.dateCreated !== null) {
setNote({...item});
if (item.type !== note) {
- setIsPinnedToMenu(
- db.settings.pins.findIndex((i) => i.id === item.id) > -1,
- );
+ setIsPinnedToMenu(db.settings.isPinned(note.id));
}
}
}, [item]);
@@ -326,17 +324,14 @@ export const ActionSheetComponent = ({
} else {
if (item.type === 'topic') {
await db.settings.pin(note.type, {
- id: note.notebookId,
- topic: note.id,
+ id: note.id,
+ notebookId: note.notebookId,
});
} else {
await db.settings.pin(note.type, {id: note.id});
}
}
-
- setIsPinnedToMenu(
- db.settings.pins.findIndex((i) => i.id === item.id) > -1,
- );
+ setIsPinnedToMenu(db.settings.isPinned(note.id));
dispatch({type: Actions.MENU_PINS});
} catch (e) {}
},
diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.js
index 1060742fc..7711c10a0 100644
--- a/apps/mobile/src/components/Menu/TagsSection.js
+++ b/apps/mobile/src/components/Menu/TagsSection.js
@@ -102,24 +102,6 @@ export const TagsSection = () => {
</Paragraph>
</View>
}
- ListHeaderComponent={
- <Heading
- color={colors.accent}
- style={{
- paddingHorizontal: 8,
- textAlignVertical: 'center',
- height: 35,
- }}
- size={SIZE.sm}>
- Your Pins{'\n'}
- <Paragraph
- style={{textAlign: 'center'}}
- color={colors.icon}
- size={SIZE.xs}>
- Tap and hold to unpin.
- </Paragraph>
- </Heading>
- }
renderItem={({item, index}) => (
<PinItem key={item.id} item={item} index={index} onPress={onPress} />
)}
@@ -175,8 +157,6 @@ const PinItem = ({item, index, onPress}) => {
borderRadius: 0,
paddingHorizontal: 10,
minHeight: 50,
- borderBottomWidth: 1,
- borderBottomColor: colors.nav,
}}>
<View
style={{
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index d9e7aab98..9e21d0b16 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -1,17 +1,16 @@
-import React, {useCallback, useEffect} from 'react';
-import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
+import React, { useCallback, useEffect } from 'react';
+import { ContainerBottomButton } from '../../components/Container/ContainerBottomButton';
import SimpleList from '../../components/SimpleList';
-import {useTracked} from '../../provider';
-import {Actions} from '../../provider/Actions';
-import {DDS} from '../../services/DeviceDetection';
-import {eSendEvent} from '../../services/EventManager';
-import Navigation from '../../services/Navigation';
+import { useTracked } from '../../provider';
+import { Actions } from '../../provider/Actions';
+import { DDS } from '../../services/DeviceDetection';
+import { eSendEvent } from '../../services/EventManager';
import SearchService from '../../services/SearchService';
-import {scrollRef} from '../../utils';
-import {eOnLoadNote, eScrollEvent} from '../../utils/Events';
-import {rootNavigatorRef, tabBarRef} from '../../utils/Refs';
+import { scrollRef } from '../../utils';
+import { eOnLoadNote, eScrollEvent } from '../../utils/Events';
+import { tabBarRef } from '../../utils/Refs';
-export const Home = ({route,navigation}) => {
+export const Home = ({route, navigation}) => {
const [state, dispatch] = useTracked();
const {notes, loading} = state;
@@ -57,11 +56,11 @@ export const Home = ({route,navigation}) => {
}, []);
useEffect(() => {
- console.log('rerender')
+ console.log('rerender');
if (navigation.isFocused()) {
updateSearch();
}
- }, [notes,route.params]);
+ }, [notes, route.params]);
const updateSearch = () => {
SearchService.update({
@@ -72,7 +71,6 @@ export const Home = ({route,navigation}) => {
};
const _onPressBottomButton = (event) => {
-
if (!DDS.isLargeTablet()) {
tabBarRef.current?.goToPage(1);
} else {