Close export dialog autmatically for support form

Summary: This diff adds the support to close the dialog automatically for the support form.

Reviewed By: passy

Differential Revision: D17899862

fbshipit-source-id: 9d9cd14556a4cebe60f8cc1d082be3e439998e9c
This commit is contained in:
Pritesh Nandgaonkar
2019-10-14 08:05:55 -07:00
committed by Facebook Github Bot
parent 4a8a4aabb6
commit de17f3905b
5 changed files with 63 additions and 12 deletions

View File

@@ -69,6 +69,7 @@ const ErrorMessage = styled(Text)({
type Props = {
onHide: () => any;
logger: Logger;
closeOnFinish: boolean;
};
type State = {
@@ -162,6 +163,24 @@ export default class ShareSheetExportUrl extends Component<Props, State> {
}
}
sheetHidden: boolean = false;
hideSheet = () => {
this.sheetHidden = true;
this.props.onHide();
this.idler.cancel();
};
componentDidUpdate() {
const {result} = this.state;
if (!result || !(result as DataExportResult).flipperUrl) {
return;
}
if (!this.sheetHidden && this.props.closeOnFinish) {
this.hideSheet();
}
}
renderPending(cancelAndHide: () => void, statusUpdate: string | null) {
return (
<ShareSheetPendingDialog
@@ -182,9 +201,9 @@ export default class ShareSheetExportUrl extends Component<Props, State> {
render() {
const cancelAndHide = () => {
this.context.store.dispatch(unsetShare());
this.props.onHide();
this.idler.cancel();
this.hideSheet();
};
const {result, statusUpdate, errorArray} = this.state;
if (!result || !(result as DataExportResult).flipperUrl) {
return this.renderPending(cancelAndHide, statusUpdate);