Skip to content

Commit 0c9187d

Browse files
authored
Merge pull request #6461 from Expensify/cmartins-fixOnfidoDesktop
Fix blank screen when exiting the Onfido page in IOU flow
2 parents d279c8a + 4b421cf commit 0c9187d

File tree

3 files changed

+45
-8
lines changed

3 files changed

+45
-8
lines changed

src/components/Onfido/index.js renamed to src/components/Onfido/BaseOnfidoWeb.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,6 @@ class Onfido extends React.Component {
9393
});
9494
}
9595

96-
componentWillUnmount() {
97-
if (!this.onfidoOut) {
98-
return;
99-
}
100-
101-
this.onfidoOut.tearDown();
102-
}
103-
10496
render() {
10597
return (
10698
<div id={CONST.ONFIDO.CONTAINER_ID} />
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import BaseOnfidoWeb from './BaseOnfidoWeb';
2+
import onfidoPropTypes from './onfidoPropTypes';
3+
4+
// On desktop, we do not want to teardown onfido, because it causes a crash.
5+
// See https://github.com/Expensify/App/issues/6082
6+
const Onfido = BaseOnfidoWeb;
7+
8+
Onfido.propTypes = onfidoPropTypes;
9+
Onfido.displayName = 'Onfido';
10+
11+
export default Onfido;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React, {Component} from 'react';
2+
import lodashGet from 'lodash/get';
3+
import BaseOnfidoWeb from './BaseOnfidoWeb';
4+
import onfidoPropTypes from './onfidoPropTypes';
5+
6+
class Onfido extends Component {
7+
constructor(props) {
8+
super(props);
9+
this.baseOnfido = null;
10+
}
11+
12+
componentWillUnmount() {
13+
const onfidoOut = lodashGet(this, 'baseOnfido.onfidoOut');
14+
if (!onfidoOut) {
15+
return;
16+
}
17+
18+
onfidoOut.tearDown();
19+
}
20+
21+
render() {
22+
return (
23+
<BaseOnfidoWeb
24+
ref={e => this.baseOnfido = e}
25+
// eslint-disable-next-line react/jsx-props-no-spreading
26+
{...this.props}
27+
/>
28+
);
29+
}
30+
}
31+
32+
Onfido.propTypes = onfidoPropTypes;
33+
34+
export default Onfido;

0 commit comments

Comments
 (0)