Fix iOS tap on post (#2095)

This commit is contained in:
Elias Nahum 2018-09-11 08:31:42 -03:00 committed by GitHub
parent a434063512
commit b096ea0a03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 16 deletions

View file

@ -149,7 +149,7 @@ export default class MarkdownImage extends React.Component {
};
handleLinkCopy = () => {
Clipboard.setString(this.props.linkDestination);
Clipboard.setString(this.props.linkDestination || this.props.source);
};
handlePreviewImage = () => {

View file

@ -27,6 +27,18 @@ export default class OptionsContext extends PureComponent {
};
}
beforeShow = (additionalAction) => {
const nextActions = this.props.getPostActions();
if (additionalAction && additionalAction.text && !additionalAction.nativeEvent) {
const copyPostIndex = nextActions.findIndex((action) => action.copyPost);
nextActions.splice(copyPostIndex + 1, 0, additionalAction);
}
this.setState({
actions: nextActions,
});
};
handleHide = () => {
this.isShowing = false;
this.props.toggleSelected(false);
@ -39,7 +51,7 @@ export default class OptionsContext extends PureComponent {
};
handleShowUnderlay = () => {
this.show();
this.beforeShow();
this.props.toggleSelected(true);
this.isShowing = this.state.actions.length > 0;
};
@ -57,27 +69,20 @@ export default class OptionsContext extends PureComponent {
this.props.toggleSelected(false);
};
show = (additionalAction) => {
const nextActions = this.props.getPostActions();
if (additionalAction && additionalAction.text && !additionalAction.nativeEvent) {
const copyPostIndex = nextActions.findIndex((action) => action.copyPost);
nextActions.splice(copyPostIndex + 1, 0, additionalAction);
}
handlePress = () => {
this.props.toggleSelected(false);
this.props.onPress();
};
this.setState({
actions: nextActions,
});
show = (additionalAction) => {
this.props.toggleSelected(true);
this.beforeShow(additionalAction);
if (this.refs.toolTip) {
this.refs.toolTip.showMenu();
}
};
handlePress = () => {
this.props.toggleSelected(false);
this.props.onPress();
};
render() {
return (
<ToolTip