diff --git a/apps/mobile/src/components/AddTopicDialog/index.js b/apps/mobile/src/components/AddTopicDialog/index.js index 137a63b6f..10ccc036f 100644 --- a/apps/mobile/src/components/AddTopicDialog/index.js +++ b/apps/mobile/src/components/AddTopicDialog/index.js @@ -8,6 +8,9 @@ import {eSendEvent} from '../../services/eventManager'; import {eOnNewTopicAdded} from '../../services/events'; import {Toast} from '../Toast'; import {Button} from '../Button'; +import BaseDialog from '../Dialog/base-dialog'; +import DialogHeader from '../Dialog/dialog-header'; +import DialogButtons from '../Dialog/dialog-buttons'; export class AddTopicDialog extends React.Component { constructor(props) { @@ -31,7 +34,7 @@ export class AddTopicDialog extends React.Component { } else { let topic = this.props.toEdit; topic.title = this.title; - + await db.notebooks.notebook(topic.notebookId).topics.add(topic); } this.close(); @@ -44,6 +47,7 @@ export class AddTopicDialog extends React.Component { }); } close() { + refs = []; this.title = null; this.setState({ visible: false, @@ -55,116 +59,66 @@ export class AddTopicDialog extends React.Component { const {colors, toEdit} = this.props; return ( - { this.titleRef.current?.focus(); }} - onRequestClose={() => { - refs = []; - this.close(); - }}> + visible={visible} + onRequestClose={this.close}> - this.close()} - style={{ - width: '100%', - height: '100%', - position: 'absolute', - }} + - - - - - {toEdit ? 'Edit Topic' : 'Add New Topic'} - - + borderRadius: 5, + fontSize: SIZE.sm, + fontFamily: WEIGHT.regular, + color: colors.pri, + marginTop: 20, + }} + onFocus={() => { + this.setState({ + titleFocused: true, + }); + }} + onBlur={() => { + this.setState({ + titleFocused: true, + }); + }} + defaultValue={toEdit ? toEdit.title : null} + onChangeText={(value) => { + this.title = value; + }} + placeholder="Enter title of topic" + placeholderTextColor={colors.icon} + /> - { - this.setState({ - titleFocused: true, - }); - }} - onBlur={() => { - this.setState({ - titleFocused: true, - }); - }} - defaultValue={toEdit ? toEdit.title : null} - onChangeText={(value) => { - this.title = value; - }} - placeholder="Enter title of topic" - placeholderTextColor={colors.icon} - /> - - -