From 2485f69039feb7b62630f0069422a54bf6a09bce Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Sat, 22 Jul 2023 14:43:48 -0400 Subject: [PATCH] views/AddNotes: add save icon in top right corner --- assets/images/SVG/Save.svg | 4 ++++ views/AddNotes.tsx | 31 ++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 assets/images/SVG/Save.svg diff --git a/assets/images/SVG/Save.svg b/assets/images/SVG/Save.svg new file mode 100644 index 000000000..39c9fa515 --- /dev/null +++ b/assets/images/SVG/Save.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/views/AddNotes.tsx b/views/AddNotes.tsx index be1d36898..fe75f1e81 100644 --- a/views/AddNotes.tsx +++ b/views/AddNotes.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Keyboard, View } from 'react-native'; +import { Keyboard, TouchableOpacity, View } from 'react-native'; import EncryptedStorage from 'react-native-encrypted-storage'; import { inject, observer } from 'mobx-react'; @@ -13,6 +13,8 @@ import { themeColor } from '../utils/ThemeUtils'; import NotesStore from '../stores/NotesStore'; import TextInput from '../components/TextInput'; +import SaveIcon from '../assets/images/SVG/Save.svg'; + interface AddNotesProps { navigation: any; NotesStore: NotesStore; @@ -68,6 +70,23 @@ export default class AddNotes extends React.Component< const { storeNoteKeys, removeNoteKeys } = NotesStore; const { payment_hash, txid, getRPreimage, isNoteStored } = this.state; const { notes } = this.state; + + const saveNote = async () => { + const key: string = + 'note-' + (payment_hash || txid || getRPreimage); + EncryptedStorage.setItem(key, notes); + await storeNoteKeys(key, notes); + navigation.goBack(); + }; + + const SaveButton = () => ( + saveNote()}> + + + ); return ( { - const key: string = - 'note-' + - (payment_hash || txid || getRPreimage); - EncryptedStorage.setItem(key, notes); - await storeNoteKeys(key, notes); - navigation.goBack(); - }} + onPress={() => saveNote()} buttonStyle={{ padding: 15 }}