1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Various RN changes

This commit is contained in:
Laurent Cozic
2017-07-13 00:01:15 +01:00
parent d92f1c7eba
commit bde42a80b6
7 changed files with 64 additions and 20 deletions

View File

@ -8,6 +8,8 @@ import { ScreenHeader } from 'lib/components/screen-header.js';
import { MenuOption, Text } from 'react-native-popup-menu';
import { _ } from 'lib/locale.js';
import { ActionButton } from 'lib/components/action-button.js';
import { dialogs } from 'lib/dialogs.js';
import { NotesScreenUtils } from 'lib/components/screens/notes-utils.js'
import DialogBox from 'react-native-dialogbox';
class NotesScreenComponent extends React.Component {
@ -17,16 +19,15 @@ class NotesScreenComponent extends React.Component {
}
deleteFolder_onPress(folderId) {
let ok = confirm(_('Delete notebook?'));
if (!ok) return;
dialogs.confirm(this, _('Delete notebook?')).then((ok) => {
if (!ok) return;
Folder.delete(folderId).then(() => {
this.props.dispatch({
type: 'Navigation/NAVIGATE',
routeName: 'Folders',
Folder.delete(folderId).then(() => {
return NotesScreenUtils.openDefaultNoteList();
}).catch((error) => {
alert(error.message);
});
}).catch((error) => {
alert(error.message);
});
}
@ -49,12 +50,16 @@ class NotesScreenComponent extends React.Component {
let folder = Folder.byId(this.props.folders, this.props.selectedFolderId);
let title = folder ? folder.title : null;
console.info('FOLDER', folder);
const { navigate } = this.props.navigation;
return (
<View style={{flex: 1}}>
<ScreenHeader title={title} navState={this.props.navigation.state} menuOptions={this.menuOptions()} />
<NoteList noItemMessage={_('There are currently no notes. Create one by clicking on the (+) button.')} style={{flex: 1}}/>
<ActionButton parentFolderId={this.props.selectedFolderId}></ActionButton>
<DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/>
</View>
);
}