diff --git a/apps/readest-app/src/app/reader/components/Reader.tsx b/apps/readest-app/src/app/reader/components/Reader.tsx index bf7b1dc4..d621fe14 100644 --- a/apps/readest-app/src/app/reader/components/Reader.tsx +++ b/apps/readest-app/src/app/reader/components/Reader.tsx @@ -51,12 +51,6 @@ const Reader: React.FC<{ ids?: string }> = ({ ids }) => { setTimeout(getSysFontsList, 3000); } initDayjs(getLocale()); - - acquireBackKeyInterception(); - return () => { - releaseBackKeyInterception(); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const handleKeyDown = (event: CustomEvent) => { @@ -74,6 +68,15 @@ const Reader: React.FC<{ ids?: string }> = ({ ids }) => { return false; }; + useEffect(() => { + if (!appService?.isAndroidApp) return; + acquireBackKeyInterception(); + return () => { + releaseBackKeyInterception(); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [appService?.isAndroidApp]); + useEffect(() => { if (!appService?.isAndroidApp) return; eventDispatcher.onSync('native-key-down', handleKeyDown);