mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
refresh notes list on AppState Changes
- remove mistaken console.log calls in root.js
This commit is contained in:
parent
8840631266
commit
3caf398021
@ -1,5 +1,5 @@
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { View, Button, Text } = require('react-native');
|
||||
const { AppState, View, Button, Text } = require('react-native');
|
||||
const { stateUtils } = require('lib/reducer.js');
|
||||
const { connect } = require('react-redux');
|
||||
const { reg } = require('lib/registry.js');
|
||||
@ -26,6 +26,13 @@ class NotesScreenComponent extends BaseScreenComponent {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.onAppStateChange_ = async () => {
|
||||
// Force an update to the notes list when app state changes
|
||||
let newProps = Object.assign({}, this.props);
|
||||
newProps.notesSource = '';
|
||||
await this.refreshNotes(newProps);
|
||||
}
|
||||
|
||||
this.sortButton_press = async () => {
|
||||
const buttons = [];
|
||||
const sortNoteOptions = Setting.enumOptions('notes.sortOrder.field');
|
||||
@ -67,6 +74,11 @@ class NotesScreenComponent extends BaseScreenComponent {
|
||||
|
||||
async componentDidMount() {
|
||||
await this.refreshNotes();
|
||||
AppState.addEventListener('change', this.onAppStateChange_);
|
||||
}
|
||||
|
||||
async componentWillUnmount() {
|
||||
AppState.removeEventListener('change', this.onAppStateChange_);
|
||||
}
|
||||
|
||||
async UNSAFE_componentWillReceiveProps(newProps) {
|
||||
@ -233,4 +245,4 @@ const NotesScreen = connect(
|
||||
}
|
||||
)(NotesScreenComponent)
|
||||
|
||||
module.exports = { NotesScreen };
|
||||
module.exports = { NotesScreen };
|
||||
|
@ -528,8 +528,6 @@ class AppComponent extends React.Component {
|
||||
const { type, value } = await ShareExtension.data();
|
||||
|
||||
if (type != "") {
|
||||
console.log(value);
|
||||
console.log(type)
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'NAV_GO',
|
||||
|
Loading…
Reference in New Issue
Block a user