mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
refactor Navigation
This commit is contained in:
@@ -3,7 +3,7 @@ import {NotebookItem} from '../../components/NotebookItem';
|
||||
import SelectionWrapper from '../../components/SelectionWrapper';
|
||||
import {useTracked} from '../../provider';
|
||||
import {Actions} from '../../provider/Actions';
|
||||
import NavigationService from '../../services/Navigation';
|
||||
import Navigation from '../../services/Navigation';
|
||||
|
||||
export const NotebookItemWrapper = ({
|
||||
item,
|
||||
@@ -38,30 +38,20 @@ export const NotebookItemWrapper = ({
|
||||
onLongPress();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isTopic) {
|
||||
NavigationService.navigate('NotesPage', {
|
||||
...item,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: Actions.HEADER_TEXT_STATE,
|
||||
state: {
|
||||
heading: item.title,
|
||||
},
|
||||
});
|
||||
dispatch({
|
||||
type: Actions.HEADER_STATE,
|
||||
state: false,
|
||||
});
|
||||
|
||||
NavigationService.navigate('Notebook', {
|
||||
notebook: item,
|
||||
title: item.title,
|
||||
root: true,
|
||||
});
|
||||
let routeName = isTopic ? 'NotesPage' : 'Notebook';
|
||||
let params = isTopic
|
||||
? {...item, menu: false}
|
||||
: {
|
||||
menu: false,
|
||||
notebook: item,
|
||||
title: item.title,
|
||||
};
|
||||
let headerState = {
|
||||
heading: item.title,
|
||||
id: item.id,
|
||||
type: item.type,
|
||||
};
|
||||
Navigation.navigate(routeName, params, headerState);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user