diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js index c78a1d911..aeba91fe0 100644 --- a/apps/mobile/src/components/ActionSheetComponent/index.js +++ b/apps/mobile/src/components/ActionSheetComponent/index.js @@ -24,6 +24,7 @@ import { import {useTracked} from '../../provider'; import {ACTIONS} from '../../provider/actions'; import {moveNoteEvent} from '../DialogManager'; +import Share from 'react-native-share'; const w = Dimensions.get('window').width; const h = Dimensions.get('window').height; @@ -180,7 +181,18 @@ export const ActionSheetComponent = ({ name: 'Share', icon: 'share-2', func: () => { - close(); + 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, + }); + } }, }, { @@ -233,7 +245,7 @@ export const ActionSheetComponent = ({ }, ]; - columnItemsData = [ + const columnItemsData = [ { name: 'Dark Mode', icon: 'moon', diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js index 8f20490ed..62cb5e9da 100644 --- a/apps/mobile/src/components/DialogManager/index.js +++ b/apps/mobile/src/components/DialogManager/index.js @@ -154,6 +154,7 @@ export class DialogManager extends Component { icon: '', }, isPerm: false, + shareAfterUnlock: false, }; } @@ -318,6 +319,14 @@ export class DialogManager extends Component { this._showVaultDialog(); break; } + case 'unlock_share': { + this.setState({ + isPerm: false, + shareAfterUnlock: true, + }); + this._showVaultDialog(); + break; + } case 'notebook': { this.showAddNotebook({item: this.state.item}); break; @@ -340,6 +349,7 @@ export class DialogManager extends Component { isPerm, vaultDialog, unlock, + shareAfterUnlock, } = this.state; return ( <> @@ -404,6 +414,7 @@ export class DialogManager extends Component { colors={colors} note={item} perm={isPerm} + shareAfterUnlock={shareAfterUnlock} openedToUnlock={false} visible={vaultDialog} /> diff --git a/apps/mobile/src/components/ListPlaceholders/index.js b/apps/mobile/src/components/ListPlaceholders/index.js index c9a0e7b26..aa37dc2f8 100644 --- a/apps/mobile/src/components/ListPlaceholders/index.js +++ b/apps/mobile/src/components/ListPlaceholders/index.js @@ -2,7 +2,7 @@ import React from 'react'; import {Text, View} from 'react-native'; import * as Animatable from 'react-native-animatable'; import Icon from 'react-native-vector-icons/Feather'; -import {SIZE, WEIGHT} from '../../common/common'; +import {SIZE, WEIGHT, normalize} from '../../common/common'; import { deleteItems, opacity, @@ -150,12 +150,12 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => { opacity: 0.5, elevation: 5, position: 'absolute', - left: -50, - top: -50, + left: -normalize(50), + top: -normalize(50), }}> { style={{ backgroundColor: colors.nav, borderRadius: 5, - padding: 5, - paddingBottom: 10, - paddingLeft: 15, + padding: normalize(5), + paddingBottom: normalize(10), + paddingLeft: normalize(15), }}> { { { { }}> { style={{ backgroundColor: colors.nav, borderRadius: 5, - padding: 5, - paddingBottom: 10, - paddingLeft: 15, + padding: normalize(5), + paddingBottom: normalize(10), + paddingLeft: normalize(15), }}> { { { { + close = (share = false, item = null) => { this.setState( { visible: false, }, + () => { + if (share && note) { + let m = `${item.title}\n \n ${item.content.text}`; + + Share.open({ + title: 'Share note to', + failOnCancel: false, + message: m, + }); + } updateEvent({type: this.props.note.type}); }, ); @@ -53,7 +63,7 @@ export class VaultDialog extends Component { }); } - this.close(); + this.close(this.props.shareAfterUnlock, item); } else { await db.lockNote(this.props.note.dateCreated, 'password'); this.close();