2020-01-18 01:04:33 +05:00
|
|
|
import React, {useEffect, useState} from 'react';
|
2020-01-09 20:14:51 +05:00
|
|
|
import {
|
|
|
|
|
Dimensions,
|
2020-01-18 18:13:34 +05:00
|
|
|
StatusBar,
|
2020-01-18 01:04:33 +05:00
|
|
|
Text,
|
2020-01-09 20:14:51 +05:00
|
|
|
TextInput,
|
2020-01-18 01:04:33 +05:00
|
|
|
TouchableOpacity,
|
|
|
|
|
View,
|
2020-01-09 20:14:51 +05:00
|
|
|
} from 'react-native';
|
2020-01-18 01:04:33 +05:00
|
|
|
import FastStorage from 'react-native-fast-storage';
|
|
|
|
|
import Icon from 'react-native-vector-icons/Feather';
|
2020-01-22 02:49:29 +05:00
|
|
|
import {db, DDS} from '../../../App';
|
2020-01-10 18:44:41 +05:00
|
|
|
import {
|
2020-01-18 01:04:33 +05:00
|
|
|
ACCENT,
|
|
|
|
|
COLOR_SCHEME,
|
2020-01-10 18:44:41 +05:00
|
|
|
COLOR_SCHEME_DARK,
|
|
|
|
|
COLOR_SCHEME_LIGHT,
|
2020-01-18 01:04:33 +05:00
|
|
|
opacity,
|
|
|
|
|
pv,
|
2020-01-18 18:13:34 +05:00
|
|
|
setColorScheme,
|
2020-01-18 01:04:33 +05:00
|
|
|
SIZE,
|
|
|
|
|
WEIGHT,
|
2020-01-10 18:44:41 +05:00
|
|
|
} from '../../common/common';
|
2020-01-24 23:13:09 +05:00
|
|
|
import {useTracked} from '../../provider';
|
|
|
|
|
import {ACTIONS} from '../../provider/actions';
|
2020-01-25 23:24:01 +05:00
|
|
|
import {moveNoteEvent} from '../DialogManager';
|
2020-01-29 17:38:50 +05:00
|
|
|
import Share from 'react-native-share';
|
2020-01-09 20:14:51 +05:00
|
|
|
const w = Dimensions.get('window').width;
|
|
|
|
|
const h = Dimensions.get('window').height;
|
|
|
|
|
|
|
|
|
|
let tagsInputRef;
|
|
|
|
|
export const ActionSheetComponent = ({
|
|
|
|
|
close = () => {},
|
2020-01-11 23:05:39 +05:00
|
|
|
item,
|
2020-01-10 18:44:41 +05:00
|
|
|
hasColors = false,
|
|
|
|
|
hasTags = false,
|
|
|
|
|
rowItems = [],
|
|
|
|
|
columnItems = [],
|
2020-01-09 20:14:51 +05:00
|
|
|
}) => {
|
2020-01-17 21:26:01 +05:00
|
|
|
const [state, dispatch] = useTracked();
|
|
|
|
|
const {colors} = state;
|
2020-01-09 20:14:51 +05:00
|
|
|
const [focused, setFocused] = useState(false);
|
2020-01-15 20:20:53 +05:00
|
|
|
const [note, setNote] = useState(
|
|
|
|
|
item
|
|
|
|
|
? item
|
|
|
|
|
: {
|
|
|
|
|
colors: [],
|
|
|
|
|
tags: [],
|
|
|
|
|
pinned: false,
|
|
|
|
|
favorite: false,
|
|
|
|
|
locked: false,
|
|
|
|
|
content: {
|
2020-01-29 18:20:54 +05:00
|
|
|
text: null,
|
|
|
|
|
delta: null,
|
2020-01-15 20:20:53 +05:00
|
|
|
},
|
|
|
|
|
dateCreated: null,
|
|
|
|
|
},
|
|
|
|
|
);
|
2020-01-09 20:14:51 +05:00
|
|
|
|
2020-01-22 02:49:29 +05:00
|
|
|
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
|
|
|
|
let newColors = setColorScheme(colors, accent);
|
|
|
|
|
StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
|
|
|
|
|
|
|
|
|
|
dispatch({type: ACTIONS.THEME, colors: newColors});
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-11 23:05:39 +05:00
|
|
|
useEffect(() => {
|
2020-01-14 17:33:48 +05:00
|
|
|
if (item.dateCreated !== null) {
|
|
|
|
|
setNote({...item});
|
|
|
|
|
}
|
2020-01-11 23:05:39 +05:00
|
|
|
}, [item]);
|
|
|
|
|
|
2020-01-09 20:14:51 +05:00
|
|
|
let tagToAdd = null;
|
|
|
|
|
let backPressCount = 0;
|
|
|
|
|
|
|
|
|
|
const _onSubmit = () => {
|
|
|
|
|
if (!tagToAdd || tagToAdd === '#') return;
|
|
|
|
|
|
|
|
|
|
let tag = tagToAdd;
|
|
|
|
|
if (tag[0] !== '#') {
|
|
|
|
|
tag = '#' + tag;
|
|
|
|
|
}
|
|
|
|
|
if (tag.includes(' ')) {
|
|
|
|
|
tag = tag.replace(' ', '_');
|
|
|
|
|
}
|
|
|
|
|
let oldProps = {...note};
|
|
|
|
|
|
|
|
|
|
if (oldProps.tags.includes(tag)) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
oldProps.tags.push(tag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tagsInputRef.setNativeProps({
|
|
|
|
|
text: '#',
|
|
|
|
|
});
|
|
|
|
|
db.addNote({
|
|
|
|
|
dateCreated: note.dateCreated,
|
|
|
|
|
content: note.content,
|
|
|
|
|
title: note.title,
|
|
|
|
|
tags: oldProps.tags,
|
|
|
|
|
});
|
|
|
|
|
setNote({...db.getNote(note.dateCreated)});
|
|
|
|
|
tagToAdd = '';
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
//tagsInputRef.focus();
|
|
|
|
|
}, 300);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const _onKeyPress = event => {
|
|
|
|
|
if (event.nativeEvent.key === 'Backspace') {
|
|
|
|
|
if (backPressCount === 0 && !tagToAdd) {
|
|
|
|
|
backPressCount = 1;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (backPressCount === 1 && !tagToAdd) {
|
|
|
|
|
backPressCount = 0;
|
|
|
|
|
|
|
|
|
|
let tagInputValue = note.tags[note.tags.length - 1];
|
|
|
|
|
let oldProps = {...note};
|
|
|
|
|
if (oldProps.tags.length === 1) return;
|
|
|
|
|
|
|
|
|
|
oldProps.tags.splice(oldProps.tags.length - 1);
|
|
|
|
|
|
|
|
|
|
db.addNote({
|
|
|
|
|
dateCreated: note.dateCreated,
|
|
|
|
|
content: note.content,
|
|
|
|
|
title: note.title,
|
|
|
|
|
tags: oldProps.tags,
|
|
|
|
|
});
|
|
|
|
|
setNote({...db.getNote(note.dateCreated)});
|
|
|
|
|
|
|
|
|
|
tagsInputRef.setNativeProps({
|
|
|
|
|
text: tagInputValue,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
tagsInputRef.focus();
|
|
|
|
|
}, 300);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-20 10:33:36 +05:00
|
|
|
const localRefresh = (type, nodispatch = false) => {
|
2020-01-14 17:33:48 +05:00
|
|
|
if (!note || !note.dateCreated) return;
|
2020-01-10 18:44:41 +05:00
|
|
|
let toAdd;
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 'note': {
|
|
|
|
|
toAdd = db.getNote(note.dateCreated);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'notebook': {
|
|
|
|
|
toAdd = db.getNotebook(note.dateCreated);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 'topic': {
|
2020-01-20 15:32:32 +05:00
|
|
|
toAdd = db.getTopic(note.notebookId, note.title);
|
2020-01-10 18:44:41 +05:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-20 15:32:32 +05:00
|
|
|
|
2020-01-20 10:33:36 +05:00
|
|
|
if (!nodispatch) {
|
|
|
|
|
dispatch({type: type});
|
|
|
|
|
}
|
2020-01-10 18:44:41 +05:00
|
|
|
setNote({...toAdd});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const rowItemsData = [
|
|
|
|
|
{
|
|
|
|
|
name: 'Add to',
|
|
|
|
|
icon: 'book',
|
|
|
|
|
func: () => {
|
2020-01-18 18:13:34 +05:00
|
|
|
dispatch({type: ACTIONS.MODAL_NAVIGATOR, enabled: true});
|
|
|
|
|
dispatch({type: ACTIONS.SELECTED_ITEMS, item: note});
|
|
|
|
|
moveNoteEvent();
|
2020-01-10 18:44:41 +05:00
|
|
|
close();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Share',
|
|
|
|
|
icon: 'share-2',
|
|
|
|
|
func: () => {
|
2020-01-29 17:38:50 +05:00
|
|
|
if (note.locked) {
|
|
|
|
|
close('unlock_share');
|
|
|
|
|
} else {
|
|
|
|
|
close();
|
|
|
|
|
let m = `${note.title}\n \n ${note.content.text}`;
|
|
|
|
|
|
|
|
|
|
Share.open({
|
|
|
|
|
title: 'Share note to',
|
|
|
|
|
failOnCancel: false,
|
|
|
|
|
message: m,
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-01-10 18:44:41 +05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Export',
|
|
|
|
|
icon: 'external-link',
|
|
|
|
|
func: () => {
|
|
|
|
|
close();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Delete',
|
|
|
|
|
icon: 'trash',
|
|
|
|
|
func: () => close('delete'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Edit Notebook',
|
|
|
|
|
icon: 'trash',
|
|
|
|
|
func: () => {
|
2020-01-18 18:13:34 +05:00
|
|
|
close('notebook');
|
2020-01-10 18:44:41 +05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Edit Topic',
|
|
|
|
|
icon: 'trash',
|
|
|
|
|
func: () => {
|
|
|
|
|
close('topic');
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Restore',
|
|
|
|
|
icon: 'trash',
|
|
|
|
|
func: () => {
|
|
|
|
|
db.restoreItem(item.dateCreated);
|
|
|
|
|
ToastEvent.show(
|
2020-01-19 21:31:26 +05:00
|
|
|
item.type === 'note' ? 'Note restored' : 'Notebook restored',
|
2020-01-10 18:44:41 +05:00
|
|
|
'success',
|
|
|
|
|
1000,
|
|
|
|
|
() => {},
|
|
|
|
|
'',
|
|
|
|
|
);
|
|
|
|
|
close();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Remove',
|
|
|
|
|
icon: 'trash',
|
|
|
|
|
func: () => {
|
|
|
|
|
close();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2020-01-29 17:38:50 +05:00
|
|
|
const columnItemsData = [
|
2020-01-10 18:44:41 +05:00
|
|
|
{
|
|
|
|
|
name: 'Dark Mode',
|
|
|
|
|
icon: 'moon',
|
|
|
|
|
func: () => {
|
|
|
|
|
if (!colors.night) {
|
2020-01-14 20:48:03 +05:00
|
|
|
FastStorage.setItem('theme', JSON.stringify({night: true}));
|
2020-01-10 18:44:41 +05:00
|
|
|
changeColorScheme(COLOR_SCHEME_DARK);
|
|
|
|
|
} else {
|
2020-01-14 20:48:03 +05:00
|
|
|
FastStorage.setItem('theme', JSON.stringify({night: false}));
|
2020-01-10 18:44:41 +05:00
|
|
|
changeColorScheme(COLOR_SCHEME_LIGHT);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
switch: true,
|
|
|
|
|
on: colors.night ? true : false,
|
|
|
|
|
close: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Pin',
|
|
|
|
|
icon: 'tag',
|
|
|
|
|
func: () => {
|
2020-01-14 17:33:48 +05:00
|
|
|
if (!note.dateCreated) return;
|
2020-01-10 18:44:41 +05:00
|
|
|
db.pinItem(note.type, note.dateCreated);
|
|
|
|
|
localRefresh(item.type);
|
2020-01-18 00:45:37 +05:00
|
|
|
dispatch({type: ACTIONS.PINNED});
|
2020-01-10 18:44:41 +05:00
|
|
|
},
|
|
|
|
|
close: false,
|
|
|
|
|
check: true,
|
|
|
|
|
on: note.pinned,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Favorite',
|
|
|
|
|
icon: 'star',
|
|
|
|
|
func: () => {
|
2020-01-14 17:33:48 +05:00
|
|
|
if (!note.dateCreated) return;
|
2020-01-10 18:44:41 +05:00
|
|
|
db.favoriteItem(note.type, note.dateCreated);
|
|
|
|
|
localRefresh(item.type);
|
|
|
|
|
},
|
|
|
|
|
close: false,
|
|
|
|
|
check: true,
|
|
|
|
|
on: note.favorite,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Add to Vault',
|
|
|
|
|
icon: 'lock',
|
|
|
|
|
func: () => {
|
2020-01-14 17:33:48 +05:00
|
|
|
if (!note.dateCreated) return;
|
2020-01-10 18:44:41 +05:00
|
|
|
note.locked ? close('unlock') : close('lock');
|
|
|
|
|
},
|
|
|
|
|
close: true,
|
|
|
|
|
check: true,
|
|
|
|
|
on: note.locked,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2020-01-16 19:53:16 +05:00
|
|
|
const _renderTag = tag => (
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
key={tag}
|
|
|
|
|
onPress={() => {
|
|
|
|
|
let oldProps = {...note};
|
|
|
|
|
|
|
|
|
|
oldProps.tags.splice(oldProps.tags.indexOf(tag), 1);
|
|
|
|
|
db.addNote({
|
|
|
|
|
dateCreated: note.dateCreated,
|
|
|
|
|
content: note.content,
|
|
|
|
|
title: note.title,
|
|
|
|
|
tags: oldProps.tags,
|
|
|
|
|
});
|
|
|
|
|
localRefresh(item.type);
|
|
|
|
|
}}
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
justifyContent: 'flex-start',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
margin: 1,
|
|
|
|
|
paddingHorizontal: 5,
|
|
|
|
|
paddingVertical: 2.5,
|
|
|
|
|
}}>
|
|
|
|
|
<Text
|
|
|
|
|
style={{
|
|
|
|
|
fontFamily: WEIGHT.regular,
|
|
|
|
|
fontSize: SIZE.sm,
|
|
|
|
|
color: colors.pri,
|
|
|
|
|
}}>
|
|
|
|
|
<Text
|
|
|
|
|
style={{
|
|
|
|
|
color: colors.accent,
|
|
|
|
|
}}>
|
|
|
|
|
{tag.slice(0, 1)}
|
|
|
|
|
</Text>
|
|
|
|
|
{tag.slice(1)}
|
|
|
|
|
</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const _renderColor = color => (
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
key={color}
|
|
|
|
|
onPress={() => {
|
|
|
|
|
let noteColors = note.colors;
|
|
|
|
|
|
|
|
|
|
if (noteColors.includes(color)) {
|
|
|
|
|
noteColors.splice(color, 1);
|
|
|
|
|
} else {
|
|
|
|
|
noteColors.push(color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db.addNote({
|
|
|
|
|
dateCreated: note.dateCreated,
|
|
|
|
|
colors: noteColors,
|
|
|
|
|
content: note.content,
|
|
|
|
|
title: note.title,
|
|
|
|
|
});
|
|
|
|
|
localRefresh(item.type);
|
|
|
|
|
}}
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
justifyContent: 'flex-start',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
borderColor: colors.nav,
|
|
|
|
|
}}>
|
|
|
|
|
<View
|
|
|
|
|
style={{
|
2020-01-24 18:48:33 +05:00
|
|
|
width: DDS.isTab ? 500 / 10 : w / 10,
|
|
|
|
|
height: DDS.isTab ? 500 / 10 : w / 10,
|
2020-01-16 19:53:16 +05:00
|
|
|
backgroundColor: color,
|
|
|
|
|
borderRadius: 100,
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
}}>
|
|
|
|
|
{note && note.colors && note.colors.includes(color) ? (
|
|
|
|
|
<Icon name="check" color="white" size={SIZE.lg} />
|
|
|
|
|
) : null}
|
|
|
|
|
</View>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const _renderRowItem = rowItem =>
|
|
|
|
|
rowItems.includes(rowItem.name) ? (
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={rowItem.func}
|
|
|
|
|
key={rowItem.name}
|
|
|
|
|
style={{
|
|
|
|
|
alignItems: 'center',
|
2020-01-24 18:48:33 +05:00
|
|
|
width: DDS.isTab ? 500 / rowItems.length : w / rowItems.length,
|
2020-01-16 19:53:16 +05:00
|
|
|
}}>
|
|
|
|
|
<Icon
|
|
|
|
|
style={{
|
|
|
|
|
width: 50,
|
|
|
|
|
height: 40,
|
|
|
|
|
borderRadius: 100,
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
textAlignVertical: 'center',
|
2020-01-24 18:48:33 +05:00
|
|
|
marginBottom: DDS.isTab ? 7 : 3.5,
|
2020-01-16 19:53:16 +05:00
|
|
|
}}
|
|
|
|
|
name={rowItem.icon}
|
2020-01-24 18:48:33 +05:00
|
|
|
size={DDS.isTab ? SIZE.xl : SIZE.lg}
|
2020-01-16 19:53:16 +05:00
|
|
|
color={colors.accent}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Text
|
|
|
|
|
style={{
|
|
|
|
|
fontFamily: WEIGHT.regular,
|
2020-01-24 18:48:33 +05:00
|
|
|
fontSize: DDS.isTab ? SIZE.sm : SIZE.xs + 2,
|
2020-01-16 19:53:16 +05:00
|
|
|
color: colors.pri,
|
|
|
|
|
}}>
|
|
|
|
|
{rowItem.name}
|
|
|
|
|
</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
) : null;
|
|
|
|
|
|
|
|
|
|
const _renderColumnItem = item =>
|
2020-01-29 18:20:54 +05:00
|
|
|
(note.dateCreated && columnItems.includes(item.name)) ||
|
|
|
|
|
item.name === 'Dark Mode' ? (
|
2020-01-16 19:53:16 +05:00
|
|
|
<TouchableOpacity
|
|
|
|
|
key={item.name}
|
|
|
|
|
activeOpacity={opacity}
|
|
|
|
|
onPress={() => {
|
|
|
|
|
item.func();
|
|
|
|
|
}}
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
alignSelf: 'center',
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
|
alignItems: 'flex-end',
|
|
|
|
|
paddingHorizontal: 12,
|
2020-01-24 18:48:33 +05:00
|
|
|
paddingVertical: pv,
|
2020-01-16 19:53:16 +05:00
|
|
|
}}>
|
|
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
}}>
|
|
|
|
|
<Icon
|
|
|
|
|
style={{
|
|
|
|
|
width: 30,
|
|
|
|
|
}}
|
|
|
|
|
name={item.icon}
|
|
|
|
|
color={colors.pri}
|
|
|
|
|
size={SIZE.md}
|
|
|
|
|
/>
|
|
|
|
|
<Text
|
|
|
|
|
style={{
|
|
|
|
|
fontFamily: WEIGHT.regular,
|
|
|
|
|
fontSize: SIZE.sm,
|
|
|
|
|
color: colors.pri,
|
|
|
|
|
}}>
|
|
|
|
|
{item.name}
|
|
|
|
|
</Text>
|
|
|
|
|
</View>
|
|
|
|
|
{item.switch ? (
|
|
|
|
|
<Icon
|
|
|
|
|
size={SIZE.lg + 2}
|
|
|
|
|
color={item.on ? colors.accent : colors.icon}
|
|
|
|
|
name={item.on ? 'toggle-right' : 'toggle-left'}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
undefined
|
|
|
|
|
)}
|
|
|
|
|
{item.check ? (
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
style={{
|
|
|
|
|
borderWidth: 2,
|
|
|
|
|
borderColor: item.on ? colors.accent : colors.icon,
|
|
|
|
|
width: 23,
|
|
|
|
|
height: 23,
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
borderRadius: 100,
|
|
|
|
|
paddingTop: 3,
|
|
|
|
|
}}>
|
|
|
|
|
{item.on ? (
|
|
|
|
|
<Icon size={SIZE.sm - 2} color={colors.accent} name="check" />
|
|
|
|
|
) : null}
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
) : null}
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
) : null;
|
|
|
|
|
|
2020-01-09 20:14:51 +05:00
|
|
|
return (
|
2020-01-10 18:44:41 +05:00
|
|
|
<View
|
2020-01-20 10:33:36 +05:00
|
|
|
onLayout={() => {
|
|
|
|
|
localRefresh(item.type, true);
|
|
|
|
|
}}
|
2020-01-10 18:44:41 +05:00
|
|
|
style={{
|
|
|
|
|
paddingBottom: 15,
|
|
|
|
|
backgroundColor: colors.bg,
|
2020-01-22 02:49:29 +05:00
|
|
|
width: '100%',
|
2020-01-24 18:48:33 +05:00
|
|
|
paddingHorizontal: 0,
|
2020-01-10 18:44:41 +05:00
|
|
|
}}>
|
2020-01-29 18:20:54 +05:00
|
|
|
{!note.dateCreated ? (
|
|
|
|
|
<Text
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
marginVertical: 10,
|
|
|
|
|
color: colors.icon,
|
|
|
|
|
fontFamily: WEIGHT.regular,
|
|
|
|
|
}}>
|
|
|
|
|
Please start writing to save your note.
|
|
|
|
|
</Text>
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
{note.dateCreated ? (
|
|
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
paddingVertical: 10,
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
borderBottomWidth: 1,
|
|
|
|
|
borderBottomColor: colors.nav,
|
|
|
|
|
}}>
|
|
|
|
|
{rowItemsData.map(_renderRowItem)}
|
|
|
|
|
</View>
|
|
|
|
|
) : null}
|
2020-01-09 20:14:51 +05:00
|
|
|
|
2020-01-29 18:20:54 +05:00
|
|
|
{hasColors && note.dateCreated ? (
|
2020-01-10 18:44:41 +05:00
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
|
paddingHorizontal: 12,
|
|
|
|
|
width: '100%',
|
|
|
|
|
marginVertical: 10,
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
|
}}>
|
|
|
|
|
{['red', 'yellow', 'green', 'blue', 'purple', 'orange', 'gray'].map(
|
2020-01-16 19:53:16 +05:00
|
|
|
_renderColor,
|
2020-01-10 18:44:41 +05:00
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
) : null}
|
2020-01-09 20:14:51 +05:00
|
|
|
|
2020-01-29 18:20:54 +05:00
|
|
|
{hasTags && note.dateCreated ? (
|
2020-01-10 18:44:41 +05:00
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
|
marginHorizontal: 12,
|
|
|
|
|
marginBottom: 0,
|
|
|
|
|
borderRadius: 5,
|
|
|
|
|
borderWidth: 1.5,
|
|
|
|
|
borderColor: focused ? colors.accent : colors.nav,
|
|
|
|
|
paddingVertical: 5,
|
|
|
|
|
}}>
|
2020-01-16 19:53:16 +05:00
|
|
|
{note && note.tags ? note.tags.map(_renderTag) : null}
|
2020-01-10 18:44:41 +05:00
|
|
|
<TextInput
|
|
|
|
|
style={{
|
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
|
minWidth: 100,
|
|
|
|
|
fontFamily: WEIGHT.regular,
|
|
|
|
|
color: colors.pri,
|
|
|
|
|
paddingHorizontal: 5,
|
|
|
|
|
paddingVertical: 1.5,
|
|
|
|
|
margin: 1,
|
|
|
|
|
}}
|
|
|
|
|
blurOnSubmit={false}
|
|
|
|
|
ref={ref => (tagsInputRef = ref)}
|
|
|
|
|
placeholderTextColor={colors.icon}
|
|
|
|
|
onFocus={() => {
|
|
|
|
|
setFocused(true);
|
|
|
|
|
}}
|
|
|
|
|
selectionColor={colors.accent}
|
|
|
|
|
onBlur={() => {
|
|
|
|
|
setFocused(false);
|
|
|
|
|
}}
|
|
|
|
|
placeholder="#hashtag"
|
|
|
|
|
onChangeText={value => {
|
|
|
|
|
tagToAdd = value;
|
|
|
|
|
if (tagToAdd.length > 0) backPressCount = 0;
|
|
|
|
|
}}
|
|
|
|
|
onSubmitEditing={_onSubmit}
|
|
|
|
|
onKeyPress={_onKeyPress}
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
{columnItems.length > 0 ? (
|
2020-01-16 19:53:16 +05:00
|
|
|
<View>{columnItemsData.map(_renderColumnItem)}</View>
|
2020-01-10 18:44:41 +05:00
|
|
|
) : null}
|
2020-01-24 18:48:33 +05:00
|
|
|
|
|
|
|
|
{DDS.isTab ? (
|
|
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
height: 20,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
) : null}
|
2020-01-09 20:14:51 +05:00
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
};
|