Giter Site home page Giter Site logo

Comments (8)

arzafran avatar arzafran commented on August 15, 2024

Hello @joshuaedo thanks for the detailed explanation.
first, what is the version of Lenis you're using?
also, have you checked react-lenis?
one more thing, can you share the component?
last, as i was reviewing the structure, i see you are closing a context provider </HeaderProvider> but i don't see where that is opened, same for the component.

from lenis.

joshuaedo avatar joshuaedo commented on August 15, 2024

Lenis Version

"@studio-freight/lenis": "^1.0.16",

HeaderContext.jsx

import { createContext, useState } from "react";

export const HeaderContext = createContext();

export function HeaderProvider({ children }) {
  const [isActive, setIsActive] = useState(false);
  const [show, handleShow] = useState(false);

  return (
    <HeaderContext.Provider value={{ isActive, setIsActive, show, handleShow }}>
      {children}
    </HeaderContext.Provider>
  );
}

Notes

  1. Yes, I have tried react-lenis and locomotive-scroll@beta and I had the same issue; since they're both built on Lenis, I figured the bug was probably from my code.
  2. I'm not sure which component you're referring to unless you mean </HeaderProvider>.
  3. I had this issue before I integrated </HeaderProvider>.
  4. The repo is public (incase you have the time to go through it).

from lenis.

joshuaedo avatar joshuaedo commented on August 15, 2024

last, as i was reviewing the structure, i see you are closing a context provider but i don't see where that is opened, same for the component.

I made mistake while copy-pasting in the original comment.

Here's the full file

import { useState } from "react";
import Header from "./components/header";
import { BrowserRouter } from "react-router-dom";
import Cursor from "./components/cursor/Cursor.jsx";
import Footer from "./components/footer/Footer.jsx";
import Navbar from "./components/navbar/Navbar.jsx";
import { Router } from "./components/router/Router.jsx";
import { HomeLoader } from "./components/loader/Loading.jsx";
import { HeaderProvider } from "./contexts/HeaderContext.jsx";
import MobileNavbar from "./components/mobile-navbar/MobileNavbar.jsx";
import { ScrollToTop } from "./components/smooth-scroll/ScrollToTop.jsx";
// import LenisScroller from "./components/smooth-scroll/LenisScroller.jsx";
// import LocomotiveScroller from "./components/smooth-scroll/LocomotiveScroller.jsx";

export function App() {
  const [loading, setLoading] = useState(true);

  {
    setTimeout(() => {
      setLoading(false);
    }, 4900);
  }

  return (
    <BrowserRouter>
      <div className="bg-black tracking-wider text-white">
        {loading ? (
          <>
            <HomeLoader />
          </>
        ) : (
          <>
            <HeaderProvider>
              {/* <LenisScroller> */}
              {/* <LocomotiveScroller> */}
              <ScrollToTop>
                <Header />
                <Navbar />
                <MobileNavbar />
                <Cursor />
                <Router />
                <Footer />
              </ScrollToTop>
              {/* </LocomotiveScroller> */}
              {/* </LenisScroller> */}
            </HeaderProvider>
          </>
        )}
      </div>
    </BrowserRouter>
  );
}

from lenis.

arzafran avatar arzafran commented on August 15, 2024

I've cloned your repo locally and tested using react-lenis and it's working fine, can you please provide more information like the browser you're using and screen resolution?

steps i did to test:
npm i @studio-freight/react-lenis

then in App.jsx i added:

import { ReactLenis } from "@studio-freight/react-lenis"

  return (
    <BrowserRouter>
      <div className="bg-black tracking-wider text-white">
        {loading ? (
          <>
            <HomeLoader />
          </>
        ) : (
          <>
            [...]
             <ReactLenis root>
               <HeaderProvider>
                  [...]
                </HeaderProvider>
              </ReactLenis>
            [...]
          </>
        )}
      </div>
    </BrowserRouter>
  );
}

from lenis.

joshuaedo avatar joshuaedo commented on August 15, 2024
  1. I just tried this again, same result.
  2. Google Chrome and 1366 x 768.
  3. Did you scroll all the way down on the first two pages you navigated to?

from lenis.

joshuaedo avatar joshuaedo commented on August 15, 2024

@arzafran any luck?

from lenis.

clementroche avatar clementroche commented on August 15, 2024

@joshuaedo provide a codesandbox

from lenis.

clementroche avatar clementroche commented on August 15, 2024

i'm closing this issue because lack of activity

from lenis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.