icd2k3 / react-scroll-into-view-if-needed Goto Github PK
View Code? Open in Web Editor NEWA thin react component wrapper bundled with scroll-into-view-if-needed
Home Page: https://codesandbox.io/s/3j4qjp7yp
License: MIT License
A thin react component wrapper bundled with scroll-into-view-if-needed
Home Page: https://codesandbox.io/s/3j4qjp7yp
License: MIT License
There's a ponyfill to support browsers which don't natively support it.
Using next.js, I was receiving ReferenceError: Element is not defined
presumably due to this line:
my code
<ScrollIntoViewIfNeeded
elementType="tr"
options={{
behavior: 'smooth',
block: 'nearest',
scrollMode: 'if-needed',
boundary: document.getElementById('preAllocation-select-panel')
}}
active={active}
{...props}/>
);
got error
webpack-internal:///./node_modules/fbjs/lib/warning.js:33 Warning: Failed prop type: Invalid prop `options.boundary` supplied to `ScrollIntoViewIfNeeded`.
in ScrollIntoViewIfNeeded (created by CustomRow)
in CustomRow (created by BodyRow)
in BodyRow (created by TableRow)
in TableRow (created by Connect(TableRow))
....
I found source code
https://github.com/icd2k3/react-scroll-into-view-if-needed/blob/master/src/index.js#L38
because document.getElementById('preAllocation-select-panel')
return Element
object witch is not React Element
. so got error.
Hello ๐ I am having some difficulty getting the window to scroll upward to a component when the scroll mode is 'if-needed'. If I set the scroll mode to 'always' it seems to work the way I expect.
I have created a codesandbox which demos this. Try clicking on the 'prev' button https://codesandbox.io/s/4w50o96p9w
Does this look like a bug to you? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.