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: 23369 back button navigation fixed for ondify steps #24406

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions src/components/Onfido/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@
height: 92% !important;
}
}

.onfido-sdk-ui-NavigationBar-back {
/* This keeps onfido back button hidden since there is already a back button in the top header which
programatically clicks onfido button. */
visibility: hidden;
}
16 changes: 15 additions & 1 deletion src/pages/ReimbursementAccount/RequestorOnfidoStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import FullPageOfflineBlockingView from '../../components/BlockingViews/FullPage
import StepPropTypes from './StepPropTypes';
import HeaderWithBackButton from '../../components/HeaderWithBackButton';
import ScreenWrapper from '../../components/ScreenWrapper';
import getPlatform from '../../libs/getPlatform';

const propTypes = {
...StepPropTypes,
Expand All @@ -31,6 +32,19 @@ class RequestorOnfidoStep extends React.Component {
constructor(props) {
super(props);
this.submit = this.submit.bind(this);
this.goBack = this.goBack.bind(this);
}

goBack() {
const platform = getPlatform();
const isNative = platform === CONST.PLATFORM.IOS || platform === CONST.PLATFORM.ANDROID;
if (!isNative) {
const onfidoBack = document.querySelector('.onfido-sdk-ui-NavigationBar-back');
if (onfidoBack && !onfidoBack.classList.contains('onfido-sdk-ui-NavigationBar-disabled')) {
return onfidoBack.click();
}
}
this.props.onBackButtonPress();
Comment on lines +38 to +47
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you think about hoisting onfidoBackAction it to another file where we would have index.js and index.native.js so we won't have the wole platform checking?

The onBackButtonPress can be passed as argument then, sth like:

...
onBackButtonPress={() => onfidoBackAction(this.props.onBackButtonPress)}
...

}

submit(onfidoData) {
Expand All @@ -50,7 +64,7 @@ class RequestorOnfidoStep extends React.Component {
stepCounter={{step: 3, total: 5}}
shouldShowGetAssistanceButton
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT}
onBackButtonPress={this.props.onBackButtonPress}
onBackButtonPress={this.goBack}
/>
<FullPageOfflineBlockingView>
<ScrollView contentContainerStyle={styles.flex1}>
Expand Down
Loading