mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 14:39:34 +01:00
fix edit topic dialog
This commit is contained in:
@@ -1,19 +1,24 @@
|
|||||||
import React, {createRef} from 'react';
|
import React, {createRef} from 'react';
|
||||||
import {View} from 'react-native';
|
|
||||||
import {TextInput} from 'react-native-gesture-handler';
|
import {TextInput} from 'react-native-gesture-handler';
|
||||||
import {Actions} from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
import {DDS} from '../../services/DeviceDetection';
|
import {
|
||||||
import {eSendEvent, ToastEvent} from '../../services/EventManager';
|
eSendEvent,
|
||||||
import {getElevation} from '../../utils';
|
eSubscribeEvent,
|
||||||
|
eUnSubscribeEvent,
|
||||||
|
ToastEvent,
|
||||||
|
} from '../../services/EventManager';
|
||||||
import {db} from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
import {eOnNewTopicAdded} from '../../utils/Events';
|
import {
|
||||||
import {ph, pv, SIZE, WEIGHT} from '../../utils/SizeUtils';
|
eCloseAddTopicDialog,
|
||||||
|
eOnNewTopicAdded,
|
||||||
|
eOpenAddTopicDialog,
|
||||||
|
} from '../../utils/Events';
|
||||||
|
import {SIZE, WEIGHT} from '../../utils/SizeUtils';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../Dialog/base-dialog';
|
||||||
import DialogButtons from '../Dialog/dialog-buttons';
|
import DialogButtons from '../Dialog/dialog-buttons';
|
||||||
import DialogContainer from '../Dialog/dialog-container';
|
import DialogContainer from '../Dialog/dialog-container';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../Dialog/dialog-header';
|
||||||
import {updateEvent} from '../DialogManager/recievers';
|
import {updateEvent} from '../DialogManager/recievers';
|
||||||
import Seperator from '../Seperator';
|
|
||||||
import {Toast} from '../Toast';
|
import {Toast} from '../Toast';
|
||||||
|
|
||||||
export class AddTopicDialog extends React.Component {
|
export class AddTopicDialog extends React.Component {
|
||||||
@@ -46,13 +51,22 @@ export class AddTopicDialog extends React.Component {
|
|||||||
eSendEvent(eOnNewTopicAdded);
|
eSendEvent(eOnNewTopicAdded);
|
||||||
};
|
};
|
||||||
|
|
||||||
async open() {
|
componentDidMount() {
|
||||||
console.log(this.props.notebookID);
|
eSubscribeEvent(eOpenAddTopicDialog, this.open);
|
||||||
this.notebook = await db.notebooks.notebook(this.props.notebookID);
|
eSubscribeEvent(eCloseAddTopicDialog, this.close);
|
||||||
|
}
|
||||||
|
componentWillUnmount() {
|
||||||
|
eUnSubscribeEvent(eOpenAddTopicDialog, this.open);
|
||||||
|
eUnSubscribeEvent(eCloseAddTopicDialog, this.close);
|
||||||
|
}
|
||||||
|
|
||||||
|
open = async (notebookId) => {
|
||||||
|
let id = notebookId || this.props.notebookID;
|
||||||
|
this.notebook = await db.notebooks.notebook(id);
|
||||||
this.setState({
|
this.setState({
|
||||||
visible: true,
|
visible: true,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
close = () => {
|
close = () => {
|
||||||
this.title = null;
|
this.title = null;
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
@@ -147,8 +147,8 @@ export class DialogManager extends Component {
|
|||||||
eSubscribeEvent(eOpenAddNotebookDialog, this.showAddNotebook);
|
eSubscribeEvent(eOpenAddNotebookDialog, this.showAddNotebook);
|
||||||
eSubscribeEvent(eCloseAddNotebookDialog, this.hideAddNotebook);
|
eSubscribeEvent(eCloseAddNotebookDialog, this.hideAddNotebook);
|
||||||
|
|
||||||
eSubscribeEvent(eOpenAddTopicDialog, this.showAddTopic);
|
//eSubscribeEvent(eOpenAddTopicDialog, this.showAddTopic);
|
||||||
eSubscribeEvent(eCloseAddTopicDialog, this.hideAddTopic);
|
//eSubscribeEvent(eCloseAddTopicDialog, this.hideAddTopic);
|
||||||
|
|
||||||
eSubscribeEvent(eOpenLoginDialog, this.showLoginDialog);
|
eSubscribeEvent(eOpenLoginDialog, this.showLoginDialog);
|
||||||
eSubscribeEvent(eCloseLoginDialog, this.hideLoginDialog);
|
eSubscribeEvent(eCloseLoginDialog, this.hideLoginDialog);
|
||||||
@@ -172,8 +172,8 @@ export class DialogManager extends Component {
|
|||||||
eUnSubscribeEvent(eOpenAddNotebookDialog, this.showAddNotebook);
|
eUnSubscribeEvent(eOpenAddNotebookDialog, this.showAddNotebook);
|
||||||
eUnSubscribeEvent(eCloseAddNotebookDialog, this.hideAddNotebook);
|
eUnSubscribeEvent(eCloseAddNotebookDialog, this.hideAddNotebook);
|
||||||
|
|
||||||
eUnSubscribeEvent(eOpenAddTopicDialog, this.showAddTopic);
|
//eUnSubscribeEvent(eOpenAddTopicDialog, this.showAddTopic);
|
||||||
eUnSubscribeEvent(eCloseAddTopicDialog, this.hideAddTopic);
|
//eUnSubscribeEvent(eCloseAddTopicDialog, this.hideAddTopic);
|
||||||
|
|
||||||
eUnSubscribeEvent(eOpenLoginDialog, this.showLoginDialog);
|
eUnSubscribeEvent(eOpenLoginDialog, this.showLoginDialog);
|
||||||
eUnSubscribeEvent(eCloseLoginDialog, this.hideLoginDialog);
|
eUnSubscribeEvent(eCloseLoginDialog, this.hideLoginDialog);
|
||||||
|
|||||||
Reference in New Issue
Block a user