From ab8561b5b245fc0b6fc9e64509d6859c568cebef Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Wed, 9 Oct 2019 00:19:57 -0400 Subject: [PATCH] fix: resolve locked body back from resources on mobile --- src/layouts/Layout/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/layouts/Layout/index.tsx b/src/layouts/Layout/index.tsx index 42faea7..339806f 100644 --- a/src/layouts/Layout/index.tsx +++ b/src/layouts/Layout/index.tsx @@ -6,18 +6,26 @@ */ import { RouteComponentProps } from "@reach/router" -import React, { FC, Fragment } from "react" +import React, { FC, Fragment, useEffect } from "react" import { Container } from "../../components/Container" import { Footer } from "../../components/Footer" import { Header } from "../../components/Header" import { WavesBottom } from "../../components/Waves" import { GlobalStyles } from "../../globalStyles" +import { useLockBodyScroll } from "../../hooks/useLockBodyScroll" import { ThemeProvider } from "../../ThemeProvider" import * as SC from "./styles" export const Layout: FC = ({ children, location }) => { const isHome = location ? location.pathname === "/" : false + const { locked, unlock } = useLockBodyScroll() + + useEffect(() => { + if (locked) { + unlock() + } + }, [locked]) return (