1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

Various changes

This commit is contained in:
Laurent Cozic
2017-07-08 00:25:10 +01:00
parent 38c9d49cdb
commit a9f7b0d531
11 changed files with 44 additions and 21 deletions

View File

@@ -59,13 +59,19 @@ class ItemListComponent extends Component {
}
// `enableEmptySections` is to fix this warning: https://github.com/FaridSafi/react-native-gifted-listview/issues/39
return (
<ListView
dataSource={this.state.dataSource}
renderRow={renderRow}
enableEmptySections={true}
/>
);
if (this.state.dataSource.getRowCount()) {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={renderRow}
enableEmptySections={true}
/>
);
} else {
const noItemMessage = this.props.noItemMessage ? this.props.noItemMessage : '';
return <Text>{noItemMessage}</Text>;
}
}
}

View File

@@ -24,6 +24,7 @@ class ScreenHeaderComponent extends Component {
// Note: this is hardcoded for now because navigation.state doesn't tell whether
// it's possible to go back or not. Maybe it's possible to get this information
// from somewhere else.
return true;
return this.props.navState.routeName != 'Notes';
}

View File

@@ -17,7 +17,7 @@ class FoldersScreenComponent extends React.Component {
return (
<View style={{flex: 1}}>
<ScreenHeader navState={this.props.navigation.state} />
<FolderList style={{flex: 1}}/>
<FolderList noItemMessage={_('There is currently no notebook. Create one by clicking on the (+) button.')} style={{flex: 1}}/>
<ActionButton></ActionButton>
</View>
);

View File

@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { ListView, View, Text } from 'react-native';
import { ListView, View, Text, Button } from 'react-native';
import { connect } from 'react-redux'
import { Log } from 'lib/log.js'
import { reg } from 'lib/registry.js'
@@ -23,6 +23,10 @@ class LogScreenComponent extends React.Component {
}
componentWillMount() {
this.resfreshLogEntries();
}
resfreshLogEntries() {
reg.logger().lastEntries(1000).then((entries) => {
const newDataSource = this.state.dataSource.cloneWithRows(entries);
this.setState({ dataSource: newDataSource });
@@ -47,6 +51,7 @@ class LogScreenComponent extends React.Component {
renderRow={renderRow}
enableEmptySections={true}
/>
<Button title="Refresh" onPress={() => { this.resfreshLogEntries(); }}/>
</View>
);
}

View File

@@ -49,7 +49,7 @@ class NotesScreenComponent extends React.Component {
return (
<View style={{flex: 1}}>
<ScreenHeader title={title} navState={this.props.navigation.state} menuOptions={this.menuOptions()} />
<NoteList style={{flex: 1}}/>
<NoteList noItemMessage={_('There are currently no notes. Create one by clicking on the (+) button.')} style={{flex: 1}}/>
<ActionButton parentFolderId={this.props.selectedFolderId}></ActionButton>
</View>
);

View File

@@ -46,7 +46,12 @@ class OneDriveLoginScreenComponent extends React.Component {
let code = url.split('?code=');
this.authCode_ = code[1];
await reg.oneDriveApi().execTokenRequest(this.authCode_, this.redirectUrl(), true);
try {
await reg.oneDriveApi().execTokenRequest(this.authCode_, this.redirectUrl(), true);
this.props.dispatch({ type: 'Navigation/BACK' });
} catch (error) {
alert(error.message);
}
this.authCode_ = null;
}