Skip to content

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

fix placeholder not showing in notebooks

ammarahm-edfac03f0ed3a0
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index 6daad645e..41ff71649 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -269,7 +269,7 @@ const PinnedItems = () => {
return (
<>
<FlatList
- data={pinned}
+ data={pinned.notes}
keyExtractor={(item, index) => item.id.toString()}
renderItem={({item, index}) =>
item.type === 'note' ? (
diff --git a/apps/mobile/src/provider/defaultState.js b/apps/mobile/src/provider/defaultState.js
index c1fda7da0..2e01c94ba 100644
--- a/apps/mobile/src/provider/defaultState.js
+++ b/apps/mobile/src/provider/defaultState.js
@@ -8,7 +8,10 @@ export const defaultState = {
notebooks: [],
trash: [],
favorites: [],
- pinned: [],
+ pinned: {
+ notes: [],
+ notebooks: [],
+ },
tags: [],
colorNotes: [],
user: {},
diff --git a/apps/mobile/src/provider/reducer.js b/apps/mobile/src/provider/reducer.js
index 50c2c2571..8f0f2c858 100644
--- a/apps/mobile/src/provider/reducer.js
+++ b/apps/mobile/src/provider/reducer.js
@@ -50,10 +50,15 @@ export const reducer = (state, action) => {
};
}
case ACTIONS.PINNED: {
- let pinned = db.notes.pinned;
+ let notes = db.notes.pinned;
+ let notebooks = db.notebooks.pinned;
+
return {
...state,
- pinned: pinned,
+ pinned: {
+ notes,
+ notebooks,
+ },
};
}
case ACTIONS.CURRENT_SCREEN: {
diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.js
index f9a048947..11c28b872 100644
--- a/apps/mobile/src/views/Folders/index.js
+++ b/apps/mobile/src/views/Folders/index.js
@@ -39,6 +39,10 @@ export const Folders = ({navigation}) => {
return true;
};
+ useEffect(() => {
+ dispatch({type: ACTIONS.PINNED});
+ }, []);
+
useEffect(() => {
eSendEvent(eScrollEvent, 0);
dispatch({type: ACTIONS.NOTEBOOKS});
@@ -130,38 +134,36 @@ export const Folders = ({navigation}) => {
? 155
: 155 - 60,
}}>
- {pinned && pinned.length > 0 ? (
+ {pinned && pinned.notebooks && pinned.notebooks.length > 0 ? (
<>
<FlatList
- data={pinned}
+ data={pinned.notebooks}
keyExtractor={(item, index) => item.id.toString()}
renderItem={({item, index}) =>
item.type === 'notebook' ? (
- <SelectionWrapper item={item}>
- <NotebookItem
- hideMore={params.hideMore}
- customStyle={{
- backgroundColor: Platform.ios
- ? hexToRGBA(colors.accent + '19')
- : hexToRGBA(colors.shade),
- width: '100%',
- paddingHorizontal: 12,
- paddingTop: 20,
- paddingRight: 18,
- marginBottom: 10,
- marginTop: 20,
- borderBottomWidth: 0,
- marginHorizontal: 0,
- }}
- isMove={params.isMove}
- onLongPress={() => {}}
- noteToMove={params.note}
- item={item}
- pinned={true}
- index={index}
- colors={colors}
- />
- </SelectionWrapper>
+ <NotebookItem
+ hideMore={params.hideMore}
+ customStyle={{
+ backgroundColor: Platform.ios
+ ? hexToRGBA(colors.accent + '19')
+ : hexToRGBA(colors.shade),
+ width: '100%',
+ paddingHorizontal: 12,
+ paddingTop: 20,
+ paddingRight: 18,
+ marginBottom: 10,
+ marginTop: 20,
+ borderBottomWidth: 0,
+ marginHorizontal: 0,
+ }}
+ isMove={params.isMove}
+ onLongPress={() => {}}
+ noteToMove={params.note}
+ item={item}
+ pinned={true}
+ index={index}
+ colors={colors}
+ />
) : null
}
/>
@@ -170,31 +172,29 @@ export const Folders = ({navigation}) => {
</View>
}
ListEmptyComponent={
- pinned && pinned.length > 0 ? null : (
- <View
+ <View
+ style={{
+ height: '80%',
+ width: DDS.isTab ? '70%' : '100%',
+ alignItems: 'center',
+ alignSelf: 'center',
+ justifyContent: 'center',
+ opacity: 0.8,
+ }}>
+ <NotebookPlaceHolder animation={slideRight} colors={colors} />
+ <NotebookPlaceHolder animation={slideLeft} colors={colors} />
+ <NotebookPlaceHolder animation={slideRight} colors={colors} />
+
+ <Text
style={{
- height: '80%',
- width: DDS.isTab ? '70%' : '100%',
- alignItems: 'center',
- alignSelf: 'center',
- justifyContent: 'center',
- opacity: 0.8,
+ color: colors.icon,
+ fontSize: SIZE.sm,
+ fontFamily: WEIGHT.regular,
+ marginTop: 30,
}}>
- <NotebookPlaceHolder animation={slideRight} colors={colors} />
- <NotebookPlaceHolder animation={slideLeft} colors={colors} />
- <NotebookPlaceHolder animation={slideRight} colors={colors} />
-
- <Text
- style={{
- color: colors.icon,
- fontSize: SIZE.sm,
- fontFamily: WEIGHT.regular,
- marginTop: 30,
- }}>
- Notebooks you add will appear here
- </Text>
- </View>
- )
+ Notebooks you add will appear here
+ </Text>
+ </View>
}
contentContainerStyle={{
width: '100%',