From 3494937e34369a7b2901838a697a9dd825bed55b Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 10 May 2018 20:39:41 +0100 Subject: [PATCH] Mobile: Resolves #503: Share note with other apps --- ReactNativeClient/lib/components/screens/note.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ReactNativeClient/lib/components/screens/note.js b/ReactNativeClient/lib/components/screens/note.js index 1b9cbbc33c..51ce590254 100644 --- a/ReactNativeClient/lib/components/screens/note.js +++ b/ReactNativeClient/lib/components/screens/note.js @@ -1,5 +1,5 @@ const React = require('react'); const Component = React.Component; -const { Platform, Clipboard, Keyboard, BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking, Image } = require('react-native'); +const { Platform, Clipboard, Keyboard, BackHandler, View, Button, TextInput, WebView, Text, StyleSheet, Linking, Image, Share } = require('react-native'); const { connect } = require('react-redux'); const { uuid } = require('lib/uuid.js'); const RNFS = require('react-native-fs'); @@ -409,6 +409,13 @@ class NoteScreenComponent extends BaseScreenComponent { this.setState({ noteTagDialogShown: true }); } + async share_onPress() { + await Share.share({ + message: this.state.note.title + '\n\n' + this.state.note.body, + title: this.state.note.title, + }); + } + setAlarm_onPress() { this.setState({ alarmDialogShown: true }); } @@ -468,6 +475,7 @@ class NoteScreenComponent extends BaseScreenComponent { output.push({ title: _('Set alarm'), onPress: () => { this.setState({ alarmDialogShown: true }) }});; } + output.push({ title: _('Share'), onPress: () => { this.share_onPress(); } }); if (isSaved) output.push({ title: _('Tags'), onPress: () => { this.tags_onPress(); } }); output.push({ title: isTodo ? _('Convert to note') : _('Convert to todo'), onPress: () => { this.toggleIsTodo_onPress(); } }); if (isSaved) output.push({ title: _('Copy Markdown link'), onPress: () => { this.copyMarkdownLink_onPress(); } });