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

73 lines
1.8 KiB
JavaScript
Raw Normal View History

2017-05-16 23:05:53 +02:00
import React, { Component } from 'react';
import { StyleSheet } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import ReactNativeActionButton from 'react-native-action-button';
import { connect } from 'react-redux'
2017-06-24 20:06:28 +02:00
import { Log } from 'lib/log.js'
2017-05-16 23:05:53 +02:00
const styles = StyleSheet.create({
actionButtonIcon: {
fontSize: 20,
height: 22,
color: 'white',
},
});
class ActionButtonComponent extends React.Component {
2017-05-24 22:51:50 +02:00
newTodo_press() {
this.props.dispatch({
type: 'Navigation/NAVIGATE',
routeName: 'Note',
noteId: null,
folderId: this.props.parentFolderId,
itemType: 'todo',
});
}
2017-05-16 23:05:53 +02:00
newNote_press() {
this.props.dispatch({
type: 'Navigation/NAVIGATE',
routeName: 'Note',
noteId: null,
folderId: this.props.parentFolderId,
2017-05-24 22:51:50 +02:00
itemType: 'note',
2017-05-16 23:05:53 +02:00
});
}
newFolder_press() {
this.props.dispatch({
type: 'Navigation/NAVIGATE',
routeName: 'Folder',
folderId: null,
});
}
render() {
return (
<ReactNativeActionButton buttonColor="rgba(231,76,60,1)">
2017-05-24 22:51:50 +02:00
<ReactNativeActionButton.Item buttonColor='#9b59b6' title="New todo" onPress={() => { this.newTodo_press() }}>
<Icon name="md-checkbox-outline" style={styles.actionButtonIcon} />
</ReactNativeActionButton.Item>
2017-05-16 23:05:53 +02:00
<ReactNativeActionButton.Item buttonColor='#9b59b6' title="New note" onPress={() => { this.newNote_press() }}>
<Icon name="md-document" style={styles.actionButtonIcon} />
</ReactNativeActionButton.Item>
2017-05-24 22:51:50 +02:00
2017-05-16 23:05:53 +02:00
<ReactNativeActionButton.Item buttonColor='#3498db' title="New folder" onPress={() => { this.newFolder_press() }}>
<Icon name="md-folder" style={styles.actionButtonIcon} />
</ReactNativeActionButton.Item>
2017-05-24 22:51:50 +02:00
2017-05-16 23:05:53 +02:00
</ReactNativeActionButton>
);
}
}
const ActionButton = connect(
(state) => {
return {};
}
)(ActionButtonComponent)
export { ActionButton };