Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blank screen when exiting the Onfido page in IOU flow #6461

Merged
merged 7 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ class Onfido extends React.Component {
});
}

componentWillUnmount() {
if (!this.onfidoOut) {
return;
}

this.onfidoOut.tearDown();
}

render() {
return (
<div id={CONST.ONFIDO.CONTAINER_ID} />
Expand Down
11 changes: 11 additions & 0 deletions src/components/Onfido/index.desktop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import BaseOnfidoWeb from './BaseOnfidoWeb';
import onfidoPropTypes from './onfidoPropTypes';

// On desktop, we do not want to teardown onfido, because it causes a crash.
// See https://github.com/Expensify/App/issues/6082
const Onfido = BaseOnfidoWeb;

Onfido.propTypes = onfidoPropTypes;
Onfido.displayName = 'Onfido';

export default Onfido;
34 changes: 34 additions & 0 deletions src/components/Onfido/index.website.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, {Component} from 'react';
import lodashGet from 'lodash/get';
import BaseOnfidoWeb from './BaseOnfidoWeb';
import onfidoPropTypes from './onfidoPropTypes';

class Onfido extends Component {
constructor(props) {
super(props);
this.baseOnfido = null;
}

componentWillUnmount() {
const onfidoOut = lodashGet(this, 'baseOnfido.onfidoOut');
if (!onfidoOut) {
return;
}

onfidoOut.tearDown();
}

render() {
return (
<BaseOnfidoWeb
ref={e => this.baseOnfido = e}
// eslint-disable-next-line react/jsx-props-no-spreading
{...this.props}
/>
);
}
}

Onfido.propTypes = onfidoPropTypes;

export default Onfido;