diff --git a/app/components/home.tsx b/app/components/home.tsx index 4ff72ab7..f8c1b238 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -29,7 +29,7 @@ import DownloadIcon from "../icons/download.svg"; import { Message, SubmitKey, useChatStore, Theme } from "../store"; import { Settings } from "./settings"; import { showModal } from "./ui-lib"; -import { copyToClipboard, downloadAs } from "../utils"; +import { copyToClipboard, downloadAs, isIOS } from "../utils"; export function Markdown(props: { content: string }) { return ( @@ -177,9 +177,8 @@ export function Chat(props: { showSideBar?: () => void }) { ); useEffect(() => { - const dom = latestMessageRef.current; - const rect = dom?.getBoundingClientRect(); - if (dom && rect && rect?.top >= document.documentElement.clientHeight - 120) { + const dom = latestMessageRef.current + if (dom && !isIOS()) { dom.scrollIntoView({ behavior: "smooth", block: "end" diff --git a/app/utils.ts b/app/utils.ts index d1e8d3ee..6c73cac7 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -29,4 +29,9 @@ export function downloadAs(text: string, filename: string) { element.click(); document.body.removeChild(element); +} + +export function isIOS() { + const userAgent = navigator.userAgent.toLowerCase(); + return /iphone|ipad|ipod/.test(userAgent); } \ No newline at end of file