diff --git a/apps/www/public/r/styles/default/use-mobile.json b/apps/www/public/r/styles/default/use-mobile.json index a6f06c518e..079f52478d 100644 --- a/apps/www/public/r/styles/default/use-mobile.json +++ b/apps/www/public/r/styles/default/use-mobile.json @@ -4,7 +4,7 @@ "files": [ { "path": "hooks/use-mobile.tsx", - "content": "import * as React from \"react\"\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState(undefined)\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n }\n mql.addEventListener(\"change\", onChange)\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n return () => mql.removeEventListener(\"change\", onChange)\n }, [])\n\n return isMobile\n}\n", + "content": "import * as React from \"react\"\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState(undefined)\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n }\n mql.addEventListener(\"change\", onChange)\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n return () => mql.removeEventListener(\"change\", onChange)\n }, [])\n\n return !!isMobile\n}\n", "type": "registry:hook" } ] diff --git a/apps/www/public/r/styles/new-york/use-mobile.json b/apps/www/public/r/styles/new-york/use-mobile.json index a6f06c518e..079f52478d 100644 --- a/apps/www/public/r/styles/new-york/use-mobile.json +++ b/apps/www/public/r/styles/new-york/use-mobile.json @@ -4,7 +4,7 @@ "files": [ { "path": "hooks/use-mobile.tsx", - "content": "import * as React from \"react\"\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState(undefined)\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n }\n mql.addEventListener(\"change\", onChange)\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n return () => mql.removeEventListener(\"change\", onChange)\n }, [])\n\n return isMobile\n}\n", + "content": "import * as React from \"react\"\n\nconst MOBILE_BREAKPOINT = 768\n\nexport function useIsMobile() {\n const [isMobile, setIsMobile] = React.useState(undefined)\n\n React.useEffect(() => {\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n }\n mql.addEventListener(\"change\", onChange)\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)\n return () => mql.removeEventListener(\"change\", onChange)\n }, [])\n\n return !!isMobile\n}\n", "type": "registry:hook" } ] diff --git a/apps/www/registry/default/hooks/use-mobile.tsx b/apps/www/registry/default/hooks/use-mobile.tsx index f2589b4713..2b0fe1dfef 100644 --- a/apps/www/registry/default/hooks/use-mobile.tsx +++ b/apps/www/registry/default/hooks/use-mobile.tsx @@ -15,5 +15,5 @@ export function useIsMobile() { return () => mql.removeEventListener("change", onChange) }, []) - return isMobile + return !!isMobile } diff --git a/apps/www/registry/new-york/hooks/use-mobile.tsx b/apps/www/registry/new-york/hooks/use-mobile.tsx index f2589b4713..2b0fe1dfef 100644 --- a/apps/www/registry/new-york/hooks/use-mobile.tsx +++ b/apps/www/registry/new-york/hooks/use-mobile.tsx @@ -15,5 +15,5 @@ export function useIsMobile() { return () => mql.removeEventListener("change", onChange) }, []) - return isMobile + return !!isMobile }