Skip to content

Commit

Permalink
Open modal on init.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbicus committed Oct 31, 2024
1 parent c109e94 commit 22a63a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/create-card/create-card-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export default function CreateCardForm() {
};
}, []);

useEffect(() => {
cameraModalRef.current?.showModal();
}, []);

return (
<>
<form
Expand Down Expand Up @@ -223,7 +227,7 @@ export default function CreateCardForm() {
</button>
</footer>
</form>
<dialog id="camera-modal" className="modal" ref={cameraModalRef}>
<dialog className="modal" ref={cameraModalRef}>
<div className="modal-box w-full h-full max-h-full max-w-full overflow-clip lg:w-11/12 lg:h-5/6 lg:max-w-5xl lg:max-h-5xl">
<div className="grid justify-between items-center pb-4 grid-cols-[auto_1fr_auto] gap-4">
<button
Expand Down
1 change: 1 addition & 0 deletions app/create-card/scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default function Scanner({
}, [getCameraDevices]);

useEffect(() => {
console.log('use effect called');
let cleanup: () => void;
if (activeDevice?.id) {
cleanup = startScanning(activeDevice.id);
Expand Down

0 comments on commit 22a63a9

Please sign in to comment.