Comments (8)
Recently I migrated my bootstrap4 project to reactstrap but unfortunately it didn't support a scrollspy... So, I had no choice but created and published a small library to implement a scrollspy for reactstrap. It provides just a minimum feature but check out reactstrap-scrollspy if you're interested in.
from reactstrap.
- possible: https://github.com/fisshy/react-scroll
- possible: https://github.com/makotot/react-scrollspy
from reactstrap.
Hey, while investigating on how to implement Scrollspy
I focused onto
https://github.com/camwiegert/in-view
and I found out that there already are a couple of implementations, i.e.:
the API for Scrollspy
would be something like react-in-view
does:
<Scrollspy
onEnter={this.handleEnter}
onLeave={this.handleLeave}
threshold={{ x: 0, y: 0 }}
offset={{ top: 0, right: 0, bottom: 0, left: 0 }}
>
<div>Spied component</div>
</Scrollspy>
where callbacks would be used to update state (and set active Nav
elements).
Would this be a suitable solution for you?
from reactstrap.
As a second option there are a couple of HoC, i.e.:
react-in-viewport
relies on Intersection Observer API
the API would then be something like:
<Scrollspy
onEnter={this.handleEnter}
onLeave={this.handleLeave}
options={{
margin: "0 0 0 0",
threshold: 10 // Percentage
}}
config={{ disconnectOnLeave: boolean }}
>
<div>Spied component</div>
</Scrollspy>;
from reactstrap.
I saw this feature was removed from To Do. Is reactstrap going to support Scrollspy?
from reactstrap.
I know this is kinda a cop-out, but since scrollspy doesn't really do much other than add a the active class based on scrolling and there are libs out there which currently do that and do that very well, we haven't implemented it and instead just suggest the use of things like react-scrollspy.
You're probably like "there are tons of libraries which do things like dropdowns (react-select) and modals (react-modal) and reactstrap has those built-in", but they do not look like or work like bootstrap out-of-the-box. react-scrollspy does (given that you set currentClassName="active"
).
Maybe we could has react-scrollspy as a dep and expose it with currentClassName="active"
as the default so that reactstrap includes the feature without really having to maintain it. Honestly though, I don't think that many people use it.
from reactstrap.
@keidrun awesome! If you'd like, submit a PR to add it to the In the wild section of the docs.
from reactstrap.
@TheSharpieOne Sure. I'd love to.
from reactstrap.
Related Issues (20)
- Cannot npm run start HOT 8
- DropdownMenu end does not right align in navbar
- ERROR: "Class extends value undefined is not a constructor or null" after running Next.js 13 with app dir HOT 9
- Dropdown appered error useState
- Offcanvas example code not working HOT 1
- Dropdown component throws error if used with inNavbar property HOT 4
- DropdownItem looses menuitem role when disabled HOT 1
- Enhancement Request - ModalTitle component
- Tooltip arrows are not visible with Bootstrap 5.3.0 HOT 1
- [deps] Checking for breaking changes in Dependabot's PRs
- Problem to centralize CarouselCaption
- Shift+Tab Model with ShadowRoot
- Carousel: switching interval to false does not deactivate autoplay directly
- Padding issue when closing a modal and opening another at the same time
- FormGroup combined with InputGroup doesn't render properly due to mis-placed class name 'mb-3' HOT 1
- Preventing scroll is not working for nested Offcanvas
- Due to the type definition, UncontrolledAccordion cannot be used without toggle HOT 1
- ReactStrap Navbar is not printed to default pdf printer pf browsers
- Dropdown not working witn Reactstrap v8 and Bootstrap v4 HOT 1
- Use useId() hook in Popover
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactstrap.