fix contextOption for post (#2086)
* fix contextOption for post * feedback review
This commit is contained in:
parent
9ca10dc719
commit
8e9146e5c9
2 changed files with 18 additions and 25 deletions
|
|
@ -27,34 +27,34 @@ export default class OptionsContext extends PureComponent {
|
|||
};
|
||||
}
|
||||
|
||||
handleHide = () => {
|
||||
this.isShowing = false;
|
||||
this.props.toggleSelected(false);
|
||||
};
|
||||
|
||||
handleHideUnderlay = () => {
|
||||
if (!this.isShowing) {
|
||||
this.props.toggleSelected(false, false);
|
||||
this.props.toggleSelected(false);
|
||||
}
|
||||
};
|
||||
|
||||
handleShowUnderlay = () => {
|
||||
this.props.toggleSelected(true, false);
|
||||
};
|
||||
|
||||
handleHide = () => {
|
||||
this.isShowing = false;
|
||||
this.props.toggleSelected(false, this.props.getPostActions().length > 0);
|
||||
};
|
||||
|
||||
handleShow = () => {
|
||||
this.isShowing = this.props.getPostActions().length > 0;
|
||||
this.props.toggleSelected(true, this.isShowing);
|
||||
this.show();
|
||||
this.props.toggleSelected(true);
|
||||
this.isShowing = this.state.actions.length > 0;
|
||||
};
|
||||
|
||||
hide = () => {
|
||||
this.setState({
|
||||
actions: this.props.getPostActions(),
|
||||
});
|
||||
|
||||
if (this.refs.toolTip) {
|
||||
this.refs.toolTip.hideMenu();
|
||||
}
|
||||
|
||||
this.setState({
|
||||
actions: this.props.getPostActions(),
|
||||
});
|
||||
this.isShowing = false;
|
||||
this.props.toggleSelected(false);
|
||||
};
|
||||
|
||||
show = (additionalAction) => {
|
||||
|
|
@ -74,7 +74,7 @@ export default class OptionsContext extends PureComponent {
|
|||
};
|
||||
|
||||
handlePress = () => {
|
||||
this.props.toggleSelected(false, this.props.getPostActions().length > 0);
|
||||
this.props.toggleSelected(false);
|
||||
this.props.onPress();
|
||||
};
|
||||
|
||||
|
|
@ -87,10 +87,9 @@ export default class OptionsContext extends PureComponent {
|
|||
actions={this.state.actions}
|
||||
arrowDirection='down'
|
||||
longPress={true}
|
||||
onHide={this.handleHide}
|
||||
onPress={this.handlePress}
|
||||
underlayColor='transparent'
|
||||
onShow={this.handleShow}
|
||||
onHide={this.handleHide}
|
||||
>
|
||||
{this.props.children}
|
||||
</ToolTip>
|
||||
|
|
|
|||
|
|
@ -110,10 +110,6 @@ export default class Post extends PureComponent {
|
|||
this.props.actions.insertToDraft(`@${username} `);
|
||||
};
|
||||
|
||||
handleEditDisable = () => {
|
||||
this.setState({canEdit: false});
|
||||
};
|
||||
|
||||
handlePostDelete = () => {
|
||||
const {formatMessage} = this.context.intl;
|
||||
const {actions, currentUserId, post} = this.props;
|
||||
|
|
@ -313,9 +309,7 @@ export default class Post extends PureComponent {
|
|||
});
|
||||
|
||||
toggleSelected = (selected) => {
|
||||
if (!getToolTipVisible()) {
|
||||
this.setState({selected});
|
||||
}
|
||||
this.setState({selected});
|
||||
};
|
||||
|
||||
handleCopyText = (text) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue