mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 14:39:34 +01:00
fix notebook not loading in list
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
import React from 'react';
|
||||
import {Text, TouchableOpacity, View} from 'react-native';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import {useTracked} from '../../provider';
|
||||
import NavigationService from '../../services/Navigation';
|
||||
import {ActionSheetEvent} from '../DialogManager/recievers';
|
||||
import Seperator from '../Seperator';
|
||||
import {ph, pv, SIZE, WEIGHT} from "../../utils/SizeUtils";
|
||||
import {ActionIcon} from "../ActionIcon";
|
||||
|
||||
export const NotebookItem = ({
|
||||
item,
|
||||
hideMore = false,
|
||||
isTopic = false,
|
||||
notebookID,
|
||||
numColumns,
|
||||
isTrash,
|
||||
customStyle,
|
||||
}) => {
|
||||
const [state, dispatch] = useTracked();
|
||||
const {colors, selectedItemsList} = state;
|
||||
const [state,] = useTracked();
|
||||
const {colors,} = state;
|
||||
|
||||
return (
|
||||
<View
|
||||
|
||||
@@ -12,8 +12,7 @@ export const NotebookItemWrapper = ({
|
||||
pinned = false,
|
||||
}) => {
|
||||
const [state, dispatch] = useTracked();
|
||||
const {selectionMode, preventDefaultMargins, headerState} = state;
|
||||
let params = headerState.route.params || {};
|
||||
const {selectionMode, preventDefaultMargins} = state;
|
||||
|
||||
const style = useMemo(() => {
|
||||
return {width: selectionMode ? '90%' : '100%', marginHorizontal: 0};
|
||||
@@ -76,7 +75,6 @@ export const NotebookItemWrapper = ({
|
||||
hideMore={preventDefaultMargins}
|
||||
isTopic={item.type === 'topic'}
|
||||
customStyle={style}
|
||||
noteToMove={params.note}
|
||||
item={item}
|
||||
index={index}
|
||||
isTrash={isTrash}
|
||||
|
||||
@@ -58,9 +58,7 @@ const SimpleList = ({
|
||||
: listData;
|
||||
|
||||
let d = [header, ...mainData];
|
||||
/* for (var i = 0; i < 10000; i++) {
|
||||
d = [...d,...data];
|
||||
} */
|
||||
console.log(d,"D");
|
||||
setDataProvider(
|
||||
dataProvider.cloneWithRows(d),
|
||||
);
|
||||
@@ -137,6 +135,7 @@ const SimpleList = ({
|
||||
return dataProvider.getDataForIndex(index).type;
|
||||
},
|
||||
(type, dim) => {
|
||||
console.log(type);
|
||||
switch (type) {
|
||||
case 'note':
|
||||
dim.width = width;
|
||||
@@ -176,13 +175,14 @@ const SimpleList = ({
|
||||
switch (type) {
|
||||
case 'note':
|
||||
return <RenderItem item={data} pinned={data.pinned} index={index}/>;
|
||||
case 'notebook':
|
||||
return <RenderItem item={data} pinned={data.pinned} index={index}/>;
|
||||
case 'MAIN_HEADER':
|
||||
return <ListHeaderComponent type={dataType} data={listData}/>;
|
||||
case 'header':
|
||||
return <RenderSectionHeader item={data}/>;
|
||||
|
||||
default:
|
||||
s
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,6 +6,8 @@ import {NotebookItemWrapper} from '../../components/SimpleList/NotebookItemWrapp
|
||||
import {useTracked} from '../../provider';
|
||||
import {Actions} from '../../provider/Actions';
|
||||
import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
|
||||
import note from "notes-core/models/note";
|
||||
import notebook from "notes-core/models/notebook";
|
||||
export const Folders = ({route, navigation}) => {
|
||||
const [state, dispatch] = useTracked();
|
||||
const {notebooks} = state;
|
||||
@@ -48,7 +50,7 @@ export const Folders = ({route, navigation}) => {
|
||||
type: Actions.CURRENT_SCREEN,
|
||||
screen: 'notebooks',
|
||||
});
|
||||
|
||||
console.log(notebooks)
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -87,8 +89,6 @@ export const Folders = ({route, navigation}) => {
|
||||
focused={() => navigation.isFocused()}
|
||||
RenderItem={NotebookItemWrapper}
|
||||
placeholder={<Placeholder type="notebooks" />}
|
||||
pinned={true}
|
||||
placeholderText="Notebooks you add will appear here"
|
||||
/>
|
||||
<ContainerBottomButton
|
||||
title="Create a new notebook"
|
||||
|
||||
Reference in New Issue
Block a user