Skip to content
Permalink
Browse files

Update and Fix Slack Example onLongPress() (#1143)

* 👽 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 08f94d9eb6a37d1cecf76b746c327765dfb44339
Showing with 17 additions and 11 deletions.
  1. +17 −11 example-slack-message/src/SlackBubble.js
@@ -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;
}
});
}
}
}

0 comments on commit 08f94d9

Please sign in to comment.
You can’t perform that action at this time.