Skip to content

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

create a list for pinned items

ammarahm-ed53b556a2fad4
diff --git a/apps/mobile/src/components/SimpleList/PinnedItemList.js b/apps/mobile/src/components/SimpleList/PinnedItemList.js
new file mode 100644
index 000000000..afdcf5404
--- /dev/null
+++ b/apps/mobile/src/components/SimpleList/PinnedItemList.js
@@ -0,0 +1,26 @@
+import React from 'react';
+import { FlatList } from 'react-native';
+import { useTracked } from '../../provider';
+import { NotebookItemWrapper } from './NotebookItemWrapper';
+import { NoteItemWrapper } from './NoteItemWrapper';
+
+export const PinnedItemList = ({type}) => {
+ const [state, dispatch] = useTracked();
+ const {pinned} = state;
+
+ return pinned? (
+ <>
+ <FlatList
+ data={type === 'notebooks' ? pinned.notebooks : pinned.notes}
+ keyExtractor={(item, index) => item.id.toString()}
+ renderItem={({item, index}) =>
+ item.type === 'notebook' ? (
+ <NotebookItemWrapper pinned={true} item={item} index={index} />
+ ) : (
+ <NoteItemWrapper pinned={true} item={item} index={index} />
+ )
+ }
+ />
+ </>
+ ) : null;
+};