1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-15 09:04:04 +02:00
joplin/ReactNativeClient/src/components/folder-list.js

37 lines
861 B
JavaScript
Raw Normal View History

2017-05-15 21:46:34 +02:00
import React, { Component } from 'react';
import { connect } from 'react-redux'
import { ListView, Text, TouchableHighlight } from 'react-native';
import { Log } from 'src/log.js';
import { ItemListComponent } from 'src/components/item-list.js';
import { Note } from 'src/models/note.js';
import { _ } from 'src/locale.js';
class FolderListComponent extends ItemListComponent {
listView_itemClick = (folderId) => {
Note.previews(folderId).then((notes) => {
this.props.dispatch({
type: 'NOTES_UPDATE_ALL',
notes: notes,
});
this.props.dispatch({
type: 'Navigation/NAVIGATE',
routeName: 'Notes',
folderId: folderId,
});
}).catch((error) => {
Log.warn('Cannot load notes', error);
});
}
}
const FolderList = connect(
(state) => {
return { items: state.folders };
}
)(FolderListComponent)
export { FolderList };