Skip to content

Commit

Permalink
Update and Fix Slack Example onLongPress() (FaridSafi#1143)
Browse files Browse the repository at this point in the history
* 👽 Fixing PropTypes

* 🐛 Fix onSend()

* 🐛 fixed onLongPress()

Prior version was missing this.props.currentMessage
  • Loading branch information
thedmeyer authored and xcarpentier committed Feb 18, 2019
1 parent 5c0b71a commit 08f94d9
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions example-slack-message/src/SlackBubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,26 @@ export default class Bubble extends React.Component {

onLongPress() {
if (this.props.onLongPress) {
this.props.onLongPress(this.context);
} else if (this.props.currentMessage.text) {
const options = [
'Copy Text',
'Cancel',
];
const cancelButtonIndex = options.length - 1;
this.context.actionSheet().showActionSheetWithOptions(
{ options, cancelButtonIndex },
this.props.onLongPress(this.context, this.props.currentMessage);
} else {
if (this.props.currentMessage.text) {
const options = [
'Copy Text',
'Cancel',
];
const cancelButtonIndex = options.length - 1;
this.context.actionSheet().showActionSheetWithOptions({
options,
cancelButtonIndex,
},
(buttonIndex) => {
if (buttonIndex === 0) {
Clipboard.setString(this.props.currentMessage.text);
switch (buttonIndex) {
case 0:
Clipboard.setString(this.props.currentMessage.text);
break;
}
});
}
}
}

Expand Down

0 comments on commit 08f94d9

Please sign in to comment.