Skip to content

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

fix notebook adding dialog

ammarahm-ed4bd10a26be2b
diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.js
index 9464d3aaf..3cfbe5152 100644
--- a/apps/mobile/src/components/AddNotebookDialog/index.js
+++ b/apps/mobile/src/components/AddNotebookDialog/index.js
@@ -89,12 +89,14 @@ export class AddNotebookDialog extends React.Component {
this.currentSelectedInput = null;
this.title = null;
this.description = null;
+ this.currentInputValue = null;
this.id = null;
this.setState({
visible: false,
topics: [],
descFocused: false,
titleFocused: false,
+ editTopic: false,
});
};
@@ -191,6 +193,9 @@ export class AddNotebookDialog extends React.Component {
};
onSubmit = (forward = true) => {
+ this.topicInputRef.setNativeProps({
+ text: null,
+ });
let {topics} = this.state;
if (!this.currentInputValue || this.currentInputValue?.trim().length === 0)
return;
@@ -201,9 +206,6 @@ export class AddNotebookDialog extends React.Component {
this.setState({
topics: prevTopics,
});
- this.topicInputRef.setNativeProps({
- text: null,
- });
setTimeout(() => {
this.listRef.scrollToEnd({animated: true});
@@ -215,6 +217,7 @@ export class AddNotebookDialog extends React.Component {
topics: prevTopics,
});
this.currentInputValue = null;
+ console.log('edit topic is', this.state.editTopic);
if (this.state.editTopic) {
this.topicInputRef.blur();
Keyboard.dismiss();
@@ -225,9 +228,6 @@ export class AddNotebookDialog extends React.Component {
this.prevItem = null;
this.prevIndex = null;
this.currentInputValue = null;
- this.topicInputRef.setNativeProps({
- text: null,
- });
if (forward) {
setTimeout(() => {
@@ -289,7 +289,7 @@ export class AddNotebookDialog extends React.Component {
onChangeText={(value) => {
this.title = value;
}}
- placeholder="Title"
+ placeholder="Enter a Title"
onSubmit={() => {
this.descriptionRef.focus();
}}
@@ -298,43 +298,41 @@ export class AddNotebookDialog extends React.Component {
<Input
fwdRef={(ref) => (this.descriptionRef = ref)}
- testID={notesnook.ids.dialogs.notebook.inputs.title}
+ testID={notesnook.ids.dialogs.notebook.inputs.description}
onChangeText={(value) => {
this.description = value;
- this.currentInputValue = value;
- if (this.prevItem !== null) {
- refs[this.prevIndex].setNativeProps({
- text: this.prevIndex + 1 + '. ' + value,
- style: {
- borderBottomColor: colors.accent,
- },
- });
- }
}}
placeholder="Describe your notebook."
onSubmit={() => {
this.topicInputRef.focus();
}}
- defaultValue={toEdit ? toEdit.title : null}
+ defaultValue={toEdit ? toEdit.description : null}
/>
<Input
fwdRef={(ref) => (this.topicInputRef = ref)}
- testID={notesnook.ids.dialogs.notebook.inputs.title}
+ testID={notesnook.ids.dialogs.notebook.inputs.topic}
onChangeText={(value) => {
- this.description = value;
+ this.currentInputValue = value;
+ if (this.prevItem !== null) {
+ refs[this.prevIndex].setNativeProps({
+ text: value,
+ style: {
+ borderBottomColor: colors.accent,
+ },
+ });
+ }
}}
- placeholder="Describe your notebook."
onSubmit={() => {
this.onSubmit();
}}
+ blurOnSubmit={false}
button={{
icon: this.state.editTopic ? 'check' : 'plus',
onPress: this.onSubmit,
color: topicInputFocused ? colors.accent : colors.icon,
}}
placeholder="Add a topic"
- defaultValue={toEdit ? toEdit.title : null}
/>
<FlatList