Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix crash on close vault dialog

ammarahm-ed5e550d3430c2
diff --git a/apps/mobile/src/components/VaultDialog/index.js b/apps/mobile/src/components/VaultDialog/index.js
index 3fd97cc75..6385364c9 100644
--- a/apps/mobile/src/components/VaultDialog/index.js
+++ b/apps/mobile/src/components/VaultDialog/index.js
@@ -8,6 +8,7 @@ import {getElevation} from '../../utils/utils';
import NavigationService from '../../services/NavigationService';
import {updateEvent} from '../DialogManager';
+import Share from 'react-native-share';
export class VaultDialog extends Component {
constructor(props) {
@@ -24,24 +25,19 @@ export class VaultDialog extends Component {
});
};
close = (share = false, item = null) => {
- this.setState(
- {
- visible: false,
- },
-
- () => {
- if (share && note) {
- let m = `${item.title}\n \n ${item.content.text}`;
+ if (share && item) {
+ let m = `${item.title}\n \n ${item.content.text}`;
+ Share.open({
+ title: 'Share note to',
+ failOnCancel: false,
+ message: m,
+ });
+ updateEvent({type: item.type});
+ }
- Share.open({
- title: 'Share note to',
- failOnCancel: false,
- message: m,
- });
- }
- updateEvent({type: this.props.note.type});
- },
- );
+ this.setState({
+ visible: false,
+ });
};
onPress = async () => {