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

Fixed terms visualization on mweb android #41234

Merged
merged 3 commits into from
May 2, 2024
Merged
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
43 changes: 34 additions & 9 deletions src/components/Onfido/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,43 @@ import type {OnfidoElement, OnfidoProps} from './types';
function Onfido({sdkToken, onSuccess, onError, onUserExit}: OnfidoProps) {
const baseOnfidoRef = useRef<OnfidoElement>(null);

useEffect(
() => () => {
const onfidoOut = baseOnfidoRef.current?.onfidoOut;
useEffect(() => {
const onfidoOut = baseOnfidoRef.current?.onfidoOut;

if (!onfidoOut) {
return;
const observer = new MutationObserver(() => {
const fidoRef = baseOnfidoRef.current;
/** This condition is needed because we are using external embedded content and they are
* causing two scrollbars to be displayed which make it difficult to accept the consent for
* the processing of biometric data and sensitive data we are resizing the first iframe so
* that this problem no longer occurs.
*/
if (fidoRef) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const onfidoSdk = fidoRef.querySelector('#onfido-sdk > iframe') as HTMLElement | null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@samilabud I think we should add a comment on why this code exists.

if (onfidoSdk) {
const viewportHeight = window.innerHeight; // Get the viewport height
const desiredHeight = viewportHeight * 0.8;
onfidoSdk.style.height = `${desiredHeight}px`;
}
}
});
if (baseOnfidoRef.current) {
observer.observe(baseOnfidoRef.current, {attributes: false, childList: true, subtree: true});
}

onfidoOut.tearDown();
},
[],
);
if (!onfidoOut) {
return;
}

onfidoOut.tearDown();

// Clean up function to remove the observer when component unmounts
return () => {
observer.disconnect();
};
}, []);

useEffect(() => {}, []);

return (
<BaseOnfidoWeb
Expand Down
Loading