mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
add a remove button
This commit is contained in:
@@ -1,28 +1,29 @@
|
|||||||
import React, { createRef, useEffect, useState } from 'react';
|
import React, {createRef, useEffect, useState} from 'react';
|
||||||
import { Keyboard, TextInput, TouchableOpacity, View } from 'react-native';
|
import {Keyboard, TextInput, TouchableOpacity, View} from 'react-native';
|
||||||
import { FlatList } from 'react-native-gesture-handler';
|
import {FlatList} from 'react-native-gesture-handler';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { notesnook } from '../../../e2e/test.ids';
|
import {notesnook} from '../../../e2e/test.ids';
|
||||||
import { useTracked } from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import { Actions } from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
import {
|
import {
|
||||||
eSendEvent,
|
eSendEvent,
|
||||||
eSubscribeEvent,
|
eSubscribeEvent,
|
||||||
eUnSubscribeEvent,
|
eUnSubscribeEvent,
|
||||||
sendNoteEditedEvent,
|
sendNoteEditedEvent,
|
||||||
ToastEvent
|
ToastEvent,
|
||||||
} from '../../services/EventManager';
|
} from '../../services/EventManager';
|
||||||
import { db } from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
import {
|
import {
|
||||||
eOnNewTopicAdded,
|
eOnNewTopicAdded,
|
||||||
eOpenMoveNoteDialog,
|
eOpenMoveNoteDialog,
|
||||||
refreshNotesPage
|
refreshNotesPage,
|
||||||
} from '../../utils/Events';
|
} from '../../utils/Events';
|
||||||
import { pv, SIZE } from '../../utils/SizeUtils';
|
import {pv, SIZE} from '../../utils/SizeUtils';
|
||||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||||
|
import {Button} from '../Button';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../Dialog/dialog-header';
|
||||||
import { PressableButton } from '../PressableButton';
|
import {PressableButton} from '../PressableButton';
|
||||||
import { Toast } from '../Toast';
|
import {Toast} from '../Toast';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../Typography/Heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../Typography/Paragraph';
|
||||||
|
|
||||||
@@ -148,7 +149,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {
|
|||||||
if (note && note.id) {
|
if (note && note.id) {
|
||||||
setNote({...db.notes.note(note.id).data});
|
setNote({...db.notes.note(note.id).data});
|
||||||
|
|
||||||
sendNoteEditedEvent({
|
sendNoteEditedEvent({
|
||||||
id: note.id,
|
id: note.id,
|
||||||
forced: true,
|
forced: true,
|
||||||
});
|
});
|
||||||
@@ -432,9 +433,21 @@ const MoveNoteComponent = ({close, note, setNote}) => {
|
|||||||
{note?.notebooks?.findIndex(
|
{note?.notebooks?.findIndex(
|
||||||
(o) => o.topics.indexOf(item.id) > -1,
|
(o) => o.topics.indexOf(item.id) > -1,
|
||||||
) > -1 ? (
|
) > -1 ? (
|
||||||
<Paragraph size={SIZE.sm} color={colors.errorText}>
|
<Button
|
||||||
Remove Note
|
onPress={() => handlePress(item, index)}
|
||||||
</Paragraph>
|
title="Remove Note"
|
||||||
|
type="accent"
|
||||||
|
accentColor="red"
|
||||||
|
height={22}
|
||||||
|
style={{
|
||||||
|
margin: 1,
|
||||||
|
marginRight: 5,
|
||||||
|
paddingHorizontal: 0,
|
||||||
|
paddingVertical: 2.5,
|
||||||
|
borderRadius: 100,
|
||||||
|
paddingHorizontal: 12,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</PressableButton>
|
</PressableButton>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user