Adds share TEXT option in message's context menu (#220)
* Adds share text option in message's context menu
This commit is contained in:
parent
a3b173c9c1
commit
9f96136571
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Alert, Clipboard, Vibration } from 'react-native';
|
import { Alert, Clipboard, Vibration, Share } from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import ActionSheet from 'react-native-actionsheet';
|
import ActionSheet from 'react-native-actionsheet';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
@ -107,6 +107,9 @@ export default class MessageActions extends React.Component {
|
||||||
// Copy
|
// Copy
|
||||||
this.options.push('Copy Message');
|
this.options.push('Copy Message');
|
||||||
this.COPY_INDEX = this.options.length - 1;
|
this.COPY_INDEX = this.options.length - 1;
|
||||||
|
// Share
|
||||||
|
this.options.push('Share Message');
|
||||||
|
this.SHARE_INDEX = this.options.length - 1;
|
||||||
// Quote
|
// Quote
|
||||||
if (!this.isRoomReadOnly()) {
|
if (!this.isRoomReadOnly()) {
|
||||||
this.options.push('Quote');
|
this.options.push('Quote');
|
||||||
|
@ -260,6 +263,12 @@ export default class MessageActions extends React.Component {
|
||||||
showToast('Copied to clipboard!');
|
showToast('Copied to clipboard!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleShare = async() => {
|
||||||
|
Share.share({
|
||||||
|
message: this.props.actionMessage.msg.content.replace(/<(?:.|\n)*?>/gm, '')
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
handleStar() {
|
handleStar() {
|
||||||
this.props.toggleStarRequest(this.props.actionMessage);
|
this.props.toggleStarRequest(this.props.actionMessage);
|
||||||
}
|
}
|
||||||
|
@ -301,6 +310,9 @@ export default class MessageActions extends React.Component {
|
||||||
case this.COPY_INDEX:
|
case this.COPY_INDEX:
|
||||||
this.handleCopy();
|
this.handleCopy();
|
||||||
break;
|
break;
|
||||||
|
case this.SHARE_INDEX:
|
||||||
|
this.handleShare();
|
||||||
|
break;
|
||||||
case this.QUOTE_INDEX:
|
case this.QUOTE_INDEX:
|
||||||
this.handleQuote();
|
this.handleQuote();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue