mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
show loading on add notebook and topic dialog
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
|||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import {FlatList, TextInput} from 'react-native-gesture-handler';
|
import {FlatList, TextInput} from 'react-native-gesture-handler';
|
||||||
import {notesnook} from '../../../e2e/test.ids';
|
import {notesnook} from '../../../e2e/test.ids';
|
||||||
@@ -38,6 +38,7 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
count: 0,
|
count: 0,
|
||||||
topicInputFocused: false,
|
topicInputFocused: false,
|
||||||
editTopic: false,
|
editTopic: false,
|
||||||
|
loading: false,
|
||||||
};
|
};
|
||||||
this.title = null;
|
this.title = null;
|
||||||
this.description = null;
|
this.description = null;
|
||||||
@@ -54,7 +55,6 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
this.hiddenInput = createRef();
|
this.hiddenInput = createRef();
|
||||||
this.topicInputRef = createRef();
|
this.topicInputRef = createRef();
|
||||||
this.addingTopic = false;
|
this.addingTopic = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open = () => {
|
open = () => {
|
||||||
@@ -129,6 +129,9 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
addNewNotebook = async () => {
|
addNewNotebook = async () => {
|
||||||
|
this.setState({
|
||||||
|
loading: true,
|
||||||
|
});
|
||||||
let {topics} = this.state;
|
let {topics} = this.state;
|
||||||
let edit = this.props.toEdit;
|
let edit = this.props.toEdit;
|
||||||
|
|
||||||
@@ -233,8 +236,8 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.topicInputRef.current?.setNativeProps({
|
this.topicInputRef.current?.setNativeProps({
|
||||||
text:''
|
text: '',
|
||||||
})
|
});
|
||||||
this.topicInputRef.current?.focus();
|
this.topicInputRef.current?.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -377,6 +380,7 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
positiveTitle={toEdit && toEdit.dateCreated ? 'Save' : 'Add'}
|
positiveTitle={toEdit && toEdit.dateCreated ? 'Save' : 'Add'}
|
||||||
onPressPositive={this.addNewNotebook}
|
onPressPositive={this.addNewNotebook}
|
||||||
onPressNegative={this.close}
|
onPressNegative={this.close}
|
||||||
|
loading={this.state.loading}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</KeyboardAvoidingView>
|
</KeyboardAvoidingView>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export class AddTopicDialog extends React.Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
visible: false,
|
visible: false,
|
||||||
titleFocused: false,
|
titleFocused: false,
|
||||||
|
loading:false
|
||||||
};
|
};
|
||||||
|
|
||||||
this.title;
|
this.title;
|
||||||
@@ -34,6 +35,7 @@ export class AddTopicDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addNewTopic = async () => {
|
addNewTopic = async () => {
|
||||||
|
this.setState({loading:true})
|
||||||
if (!this.title)
|
if (!this.title)
|
||||||
return ToastEvent.show('Title is required', 'error', 'local');
|
return ToastEvent.show('Title is required', 'error', 'local');
|
||||||
|
|
||||||
@@ -112,6 +114,7 @@ export class AddTopicDialog extends React.Component {
|
|||||||
positiveTitle={toEdit ? 'Save' : 'Add'}
|
positiveTitle={toEdit ? 'Save' : 'Add'}
|
||||||
onPressNegative={() => this.close()}
|
onPressNegative={() => this.close()}
|
||||||
onPressPositive={() => this.addNewTopic()}
|
onPressPositive={() => this.addNewTopic()}
|
||||||
|
loading={this.state.loading}
|
||||||
/>
|
/>
|
||||||
</DialogContainer>
|
</DialogContainer>
|
||||||
<Toast context="local" />
|
<Toast context="local" />
|
||||||
|
|||||||
Reference in New Issue
Block a user