Fixed scrollIntoView not working always

This commit is contained in:
Lucas Oliveira 2024-06-10 14:15:52 -03:00
commit 1133529a8d
2 changed files with 3 additions and 9 deletions

View file

@ -6,7 +6,6 @@
"@headlessui/react": "^1.7.17", "@headlessui/react": "^1.7.17",
"@hookform/resolvers": "^3.3.4", "@hookform/resolvers": "^3.3.4",
"@million/lint": "^0.0.73", "@million/lint": "^0.0.73",
"react-hotkeys-hook": "^4.5.0",
"@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.4", "@radix-ui/react-dialog": "^1.0.4",
@ -56,6 +55,7 @@
"react-dom": "^18.2.21", "react-dom": "^18.2.21",
"react-error-boundary": "^4.0.11", "react-error-boundary": "^4.0.11",
"react-hook-form": "^7.51.4", "react-hook-form": "^7.51.4",
"react-hotkeys-hook": "^4.5.0",
"react-icons": "^5.0.1", "react-icons": "^5.0.1",
"react-laag": "^2.0.5", "react-laag": "^2.0.5",
"react-markdown": "^8.0.7", "react-markdown": "^8.0.7",

View file

@ -1,14 +1,8 @@
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef } from "react";
import useAlertStore from "../../../../../../../../stores/alertStore";
import { gradients } from "../../../../../../../../utils/styleUtils";
import useGetProfilePictures from "./hooks/use-get-profile-pictures";
import { Label } from "../../../../../../../../components/ui/label";
import { import {
BACKEND_URL, BACKEND_URL,
BASE_URL_API, BASE_URL_API,
} from "../../../../../../../../constants/constants"; } from "../../../../../../../../constants/constants";
import HorizontalScrollFadeComponent from "../../../../../../../../components/horizontalScrollFadeComponent";
import LoadingComponent from "../../../../../../../../components/loadingComponent";
import Loading from "../../../../../../../../components/ui/loading"; import Loading from "../../../../../../../../components/ui/loading";
import { cn } from "../../../../../../../../utils/utils"; import { cn } from "../../../../../../../../utils/utils";
import { Button } from "../../../../../../../../components/ui/button"; import { Button } from "../../../../../../../../components/ui/button";
@ -34,7 +28,7 @@ export default function ProfilePictureChooserComponent({
if (value && ref) { if (value && ref) {
ref.current?.scrollIntoView({ behavior: "smooth", block: "center" }); ref.current?.scrollIntoView({ behavior: "smooth", block: "center" });
} }
}, [ref]); }, [ref, value]);
return ( return (
<div className="flex flex-col justify-center gap-2"> <div className="flex flex-col justify-center gap-2">