Skip to content

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

fix adding notebook.

ammarahm-ed98384ab16249
diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.js
index fccb93ab6..c05dd2d1c 100644
--- a/apps/mobile/src/components/AddNotebookDialog/index.js
+++ b/apps/mobile/src/components/AddNotebookDialog/index.js
@@ -105,23 +105,34 @@ export class AddNotebookDialog extends React.Component {
};
addNewNotebook = async () => {
- let {topics} = this.state;
- let {toEdit} = this.props;
- if (!this.title)
- return ToastEvent.show('Title is required', 'error', 3000, () => {}, '');
+ if (this.currentInputValue) {
+ this.onSubmit();
+ }
+ setTimeout(async () => {
+ let {topics} = this.state;
+ let {toEdit} = this.props;
+ if (!this.title)
+ return ToastEvent.show(
+ 'Title is required',
+ 'error',
+ 3000,
+ () => {},
+ '',
+ );
- let id = toEdit && toEdit.id ? toEdit.id : null;
+ let id = toEdit && toEdit.id ? toEdit.id : null;
- await db.notebooks.add({
- title: this.title,
- description: this.description,
- topics,
- id: id,
- });
+ await db.notebooks.add({
+ title: this.title,
+ description: this.description,
+ topics,
+ id: id,
+ });
- updateEvent({type: ACTIONS.NOTEBOOKS});
- this.close();
- ToastEvent.show('New notebook added', 'success', 3000, () => {}, '');
+ updateEvent({type: ACTIONS.NOTEBOOKS});
+ this.close();
+ ToastEvent.show('New notebook added', 'success', 3000, () => {}, '');
+ }, 200);
};
onSubmit = () => {
@@ -337,6 +348,7 @@ export class AddNotebookDialog extends React.Component {
});
}}
onBlur={() => {
+ this.onSubmit();
this.setState({
topicInputFoused: false,
});
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index d221dbe63..dac58f699 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -21,8 +21,15 @@ import {db, DDS} from '../../../App';
export const NotesList = ({isGrouped = false}) => {
const [state, dispatch] = useTracked();
- const {colors, selectionMode, currentEditingNote, loading, keyword} = state;
- const notes = [...state.notes];
+ const {
+ colors,
+ selectionMode,
+ currentEditingNote,
+ loading,
+ keyword,
+ notes,
+ } = state;
+
const searchResults = [...state.searchResults];
const [refreshing, setRefreshing] = useState(false);