This repository has been archived by the owner on Jun 15, 2022. It is now read-only.
/
ManageNote.js
73 lines (62 loc) · 2.42 KB
/
ManageNote.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, { Component } from 'react';
import { TextInput, SectionList, ScrollView, View, Text, Platform } from 'react-native';
import SectionHeader from "../components/SectionHeader";
import TableSection from "../components/TableSection";
import SectionedAccessoryTableCell from "../components/SectionedAccessoryTableCell";
import ItemActionManager from '../lib/itemActionManager'
import Icons from "../Icons";
import GlobalStyles from "../Styles"
export default class SortSection extends Component {
constructor(props) {
super(props);
}
onPress = (key) => {
this.props.onEvent(key);
this.forceUpdate();
}
render() {
let root = this;
var pinAction = this.props.note.pinned ? "Unpin" : "Pin";
let pinEvent = pinAction == "Pin" ? ItemActionManager.PinEvent : ItemActionManager.UnpinEvent;
var archiveOption = this.props.note.archived ? "Unarchive" : "Archive";
let archiveEvent = archiveOption == "Archive" ? ItemActionManager.ArchiveEvent : ItemActionManager.UnarchiveEvent;
var lockOption = this.props.note.locked ? "Unlock" : "Lock";
let lockEvent = lockOption == "Lock" ? ItemActionManager.LockEvent : ItemActionManager.UnlockEvent;
return (
<TableSection>
<SectionHeader title={this.props.title} />
<SectionedAccessoryTableCell
iconName={Icons.nameForIcon("bookmark")}
onPress={() => {this.onPress(pinEvent)}}
first={true} text={pinAction}
leftAlignIcon={true}
/>
<SectionedAccessoryTableCell
iconName={Icons.nameForIcon("archive")}
onPress={() => {this.onPress(archiveEvent)}}
text={archiveOption}
leftAlignIcon={true}
/>
<SectionedAccessoryTableCell
iconName={Icons.nameForIcon("lock")}
onPress={() => {this.onPress(lockEvent)}}
text={lockOption}
leftAlignIcon={true}
/>
<SectionedAccessoryTableCell
iconName={Icons.nameForIcon("share")}
onPress={() => {this.onPress(ItemActionManager.ShareEvent)}}
text={"Share"}
leftAlignIcon={true}
/>
<SectionedAccessoryTableCell
iconName={Icons.nameForIcon("trash")}
onPress={() => {this.onPress(ItemActionManager.DeleteEvent)}}
text={"Delete"}
last={true}
leftAlignIcon={true}
/>
</TableSection>
);
}
}