* MM-17692 execute callback after closing post options * Fix unit tests * Fix snapshot
This commit is contained in:
parent
880cbd9f3d
commit
7bf3020490
4 changed files with 20 additions and 16 deletions
|
|
@ -130,12 +130,12 @@ export default class SlideUpPanel extends PureComponent {
|
|||
}).start();
|
||||
}
|
||||
|
||||
closeWithAnimation = () => {
|
||||
closeWithAnimation = (cb) => {
|
||||
Animated.timing(this.translateYOffset, {
|
||||
duration: 200,
|
||||
toValue: this.snapPoints[2],
|
||||
useNativeDriver: true,
|
||||
}).start(() => this.props.onRequestClose());
|
||||
}).start(() => this.props.onRequestClose(cb));
|
||||
};
|
||||
|
||||
onHeaderHandlerStateChange = ({nativeEvent}) => {
|
||||
|
|
|
|||
|
|
@ -49,15 +49,19 @@ export default class PostOptions extends PureComponent {
|
|||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
||||
close = () => {
|
||||
this.props.actions.dismissModal();
|
||||
close = async (cb) => {
|
||||
await this.props.actions.dismissModal();
|
||||
|
||||
if (typeof cb === 'function') {
|
||||
setTimeout(cb, 300);
|
||||
}
|
||||
};
|
||||
|
||||
closeWithAnimation = () => {
|
||||
closeWithAnimation = (cb) => {
|
||||
if (this.slideUpPanel) {
|
||||
this.slideUpPanel.closeWithAnimation();
|
||||
this.slideUpPanel.closeWithAnimation(cb);
|
||||
} else {
|
||||
this.close();
|
||||
this.close(cb);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -268,8 +272,7 @@ export default class PostOptions extends PureComponent {
|
|||
const {actions, theme} = this.props;
|
||||
const {formatMessage} = this.context.intl;
|
||||
|
||||
this.close();
|
||||
setTimeout(() => {
|
||||
this.close(() => {
|
||||
MaterialIcon.getImageSource('close', 20, theme.sidebarHeaderTextColor).then((source) => {
|
||||
const screen = 'AddReaction';
|
||||
const title = formatMessage({id: 'mobile.post_info.add_reaction', defaultMessage: 'Add Reaction'});
|
||||
|
|
@ -280,15 +283,14 @@ export default class PostOptions extends PureComponent {
|
|||
|
||||
actions.showModal(screen, title, passProps);
|
||||
});
|
||||
}, 300);
|
||||
});
|
||||
};
|
||||
|
||||
handleReply = () => {
|
||||
const {post} = this.props;
|
||||
this.closeWithAnimation();
|
||||
setTimeout(() => {
|
||||
this.closeWithAnimation(() => {
|
||||
EventEmitter.emit('goToThread', post);
|
||||
}, 250);
|
||||
});
|
||||
};
|
||||
|
||||
handleAddReactionToPost = (emoji) => {
|
||||
|
|
@ -359,8 +361,7 @@ export default class PostOptions extends PureComponent {
|
|||
const {actions, theme, post} = this.props;
|
||||
const {intl} = this.context;
|
||||
|
||||
this.close();
|
||||
setTimeout(() => {
|
||||
this.close(() => {
|
||||
MaterialIcon.getImageSource('close', 20, theme.sidebarHeaderTextColor).then((source) => {
|
||||
const screen = 'EditPost';
|
||||
const title = intl.formatMessage({id: 'mobile.edit_post.title', defaultMessage: 'Editing Message'});
|
||||
|
|
@ -371,7 +372,7 @@ export default class PostOptions extends PureComponent {
|
|||
|
||||
actions.showModal(screen, title, passProps);
|
||||
});
|
||||
}, 300);
|
||||
});
|
||||
};
|
||||
|
||||
handleUnflagPost = () => {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ NotificationSettingsMentionsKeywords {
|
|||
"textComponent": "span",
|
||||
"timeZone": null,
|
||||
},
|
||||
"isLandscape": false,
|
||||
"keywords": "",
|
||||
"onBack": [MockFunction],
|
||||
"theme": Object {
|
||||
|
|
@ -125,6 +126,7 @@ NotificationSettingsMentionsKeywords {
|
|||
"timeZone": null,
|
||||
}
|
||||
}
|
||||
isLandscape={false}
|
||||
keywords=""
|
||||
onBack={[MockFunction]}
|
||||
theme={
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ describe('NotificationSettingsMentionsKeywords', () => {
|
|||
},
|
||||
componentId: 'component-id',
|
||||
keywords: '',
|
||||
isLandscape: false,
|
||||
onBack: jest.fn(),
|
||||
theme: Preferences.THEMES.default,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue