You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using CameraPreview, on certain mobile devices (Samsumg Galaxy A53 5G, Con Android 14, One Plus nord, Android 14), the component, despite being configured to occupy only half the screen, overlaps and covers the entire screen. The buttons underneath still function—pressing them either takes a photo or closes the camera—but they are not visible.
It is worth noting that the camera displays correctly on the web, but when generating an APK, its appearance changes depending on the mobile model.
Additionally, it doesn't seem to respond to the CSS styles applied to the div containing the camera, and also is important to notice that CameraPreview runs inside a Modal.
To Reproduce
Steps to reproduce the behavior:
On the previously mentioned models where this error occurs, the camera is executed using the CameraPreview.start method with the configuration shown in the screenshot. You'll notice that the screen overlaps the rest of the elements in the Modal.
Expected behavior
The camera should occupy the full width of the screen and half of its height, without overlapping the buttons.
Screenshots
Configuration:
How it displays on the devices where it fails:
How it displays on the devices where it works:
Desktop (please complete the following information):
OS: Windows
Browser Chrome
Version Windows 11 Version 24H2
Smartphone (please complete the following information):
Device: Samsung Galaxy A53 5G
OS: Android 14
OS Customization Layer: One UI 6.1
Additional context
I’m attaching the code where the CameraPreview is executed:
import React, { useEffect, FC, useState } from "react";
import Button from "@amiga-fwk-web/components-action/button";
import Modal from "@amiga-fwk-web/components-surfaces/modal";
import useIntl from "@amiga-fwk-web/components-intl/use-intl";
import { useNotifications } from "@amiga-fwk-web/components-feedback/notifications-provider";
import Loader from "@amiga-fwk-web/components-feedback/loader";
import { formatDateYYYYMMDDHHMMSS } from "@/shared/utils/Utils";
import { CameraPreview } from "@capacitor-community/camera-preview";
import {
CustomImg,
FormNewCommentOtdetailValues,
initialFormNewCommentOtdetailValues,
} from "@/shared/models/Interfaces";
import { useNetwork } from "../network-provider/network-provider";
import "./modal-camera.css";
if (isOpen) {
localStorage.setItem("hidePin", "true");
startCamera();
} else {
stopCamera();
}
return () => {
stopCamera(); // Asegura que la cámara se detiene al desmontarse el componente
localStorage.setItem("hidePin", "false");
};
Describe the bug
When using CameraPreview, on certain mobile devices (Samsumg Galaxy A53 5G, Con Android 14, One Plus nord, Android 14), the component, despite being configured to occupy only half the screen, overlaps and covers the entire screen. The buttons underneath still function—pressing them either takes a photo or closes the camera—but they are not visible.
It is worth noting that the camera displays correctly on the web, but when generating an APK, its appearance changes depending on the mobile model.
Additionally, it doesn't seem to respond to the CSS styles applied to the div containing the camera, and also is important to notice that CameraPreview runs inside a Modal.
To Reproduce
Steps to reproduce the behavior:
On the previously mentioned models where this error occurs, the camera is executed using the CameraPreview.start method with the configuration shown in the screenshot. You'll notice that the screen overlaps the rest of the elements in the Modal.
Expected behavior
The camera should occupy the full width of the screen and half of its height, without overlapping the buttons.
Screenshots
![Image](https://private-user-images.githubusercontent.com/183693183/407221144-c2b97499-fb8b-4b31-a018-e28e89f362e6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjU5ODAsIm5iZiI6MTczOTE2NTY4MCwicGF0aCI6Ii8xODM2OTMxODMvNDA3MjIxMTQ0LWMyYjk3NDk5LWZiOGItNGIzMS1hMDE4LWUyOGU4OWYzNjJlNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQwNTM0NDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01NGUyNzhjMjA4ODkyYTM4OGJjZDhmNTI0ZmQ5ZjJkNmI0ZmM1MTRiOGY1MThhMGMwOGFiMDZlODY1M2QyYjRiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.QF3-x3UXe2k0HWpAur6QfWoDVIgvEl721VGG_9f1DVo)
Configuration:
How it displays on the devices where it fails:
![Image](https://private-user-images.githubusercontent.com/183693183/407226568-c46017c2-4acc-4a02-942b-35efc0f97c71.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjU5ODAsIm5iZiI6MTczOTE2NTY4MCwicGF0aCI6Ii8xODM2OTMxODMvNDA3MjI2NTY4LWM0NjAxN2MyLTRhY2MtNGEwMi05NDJiLTM1ZWZjMGY5N2M3MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQwNTM0NDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03NjQwYzJlOThhYWYwZDExOTU3MWFhN2NmYzI0MWYxM2I0NzY0N2FlNzg2NjllMmFlYTcwYTNhY2FiMTkxZTQ4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.saZX46b1EoyvUcxAZAY5JrsuSVllKsz0bVaRg-ViZLg)
How it displays on the devices where it works:
![Image](https://private-user-images.githubusercontent.com/183693183/407230857-184de1e3-587b-450a-9c32-33b9cf7bd7e1.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjU5ODAsIm5iZiI6MTczOTE2NTY4MCwicGF0aCI6Ii8xODM2OTMxODMvNDA3MjMwODU3LTE4NGRlMWUzLTU4N2ItNDUwYS05YzMyLTMzYjljZjdiZDdlMS5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQwNTM0NDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03NjhlODgyMWNhOTVmMjBiOGIyZGY5NmJjYWRjZjNmNTU5ZTgzNzgxZDA5NjMxMDU3NmUwNzU3NjYxMTczOWNjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.0W53nw1fx8ZPgjGk-1cGK_HO06mcpuFOakbKcDW8mpo)
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
I’m attaching the code where the CameraPreview is executed:
import React, { useEffect, FC, useState } from "react";
import Button from "@amiga-fwk-web/components-action/button";
import Modal from "@amiga-fwk-web/components-surfaces/modal";
import useIntl from "@amiga-fwk-web/components-intl/use-intl";
import { useNotifications } from "@amiga-fwk-web/components-feedback/notifications-provider";
import Loader from "@amiga-fwk-web/components-feedback/loader";
import { formatDateYYYYMMDDHHMMSS } from "@/shared/utils/Utils";
import { CameraPreview } from "@capacitor-community/camera-preview";
import {
CustomImg,
FormNewCommentOtdetailValues,
initialFormNewCommentOtdetailValues,
} from "@/shared/models/Interfaces";
import { useNetwork } from "../network-provider/network-provider";
import "./modal-camera.css";
interface ModalCameraProps {
isOpen: boolean;
onCloseModal: () => void;
onTakePicture: (image: CustomImg) => void; // Callback para enviar la imagen
}
export const ModalCamera: FC = ({ isOpen, onCloseModal, onTakePicture }) => {
const intl = useIntl();
const notifications = useNotifications();
const [formValues] = useState(initialFormNewCommentOtdetailValues);
const { networkConnected } = useNetwork();
const [loadingCamera, setLoadingCamera] = useState(false);
const [isCameraActive, setIsCameraActive] = useState(false);
useEffect(() => {
const startCamera = async () => {
if (!isCameraActive) {
setLoadingCamera(true);
await CameraPreview.start({
parent: "cameraPreview",
position: "rear",
width: window.innerWidth,
height: window.innerHeight,
paddingBottom: 16,
});
setIsCameraActive(true);
setLoadingCamera(false);
}
};
const stopCamera = async () => {
if (isCameraActive) {
await CameraPreview.stop();
setIsCameraActive(false);
setLoadingCamera(false);
}
};
}, [isCameraActive, isOpen, notifications, onCloseModal]);
const takePicture = async () => {
if (formValues.imagesUploaded.length >= 4) {
notifications.info(intl.formatMessage({ id: "app.otDetail.maxImages" }), {
action: { text: "OK", onClick: () => null },
});
return;
}
};
return (
{loadingCamera && (
)}
<Button
className="button"
data-testid="btn-take-picture"
kind="primary"
fullWidth
label={intl.formatMessage({ id: "app.otDetail.takePicture" })}
onClick={takePicture}
/>
<Button
className="button"
data-testid="btn-close-camera"
kind="primary"
fullWidth
label={intl.formatMessage({ id: "app.otDetail.closeCamera" })}
onClick={() => {
onCloseModal();
}}
/>
);
};
export default ModalCamera;
And also the css:
.modal-camera {
justify-content: flex-start;
align-items: center;
height: 100%;
}
/* #cameraPreview {
width: 100%;
height: 50vh;
} */
.modal-camera .button-container {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
margin-top: 50vh;
gap: 16px;
}
.modal-camera .loader-container {
display: flex;
justify-content: center;
margin-top: 64px;
min-height: 380px;
}
The text was updated successfully, but these errors were encountered: