Comments (10)
Still a problem, actually
from react-infinite-scroll-component.
@Anna-Weaver-JL, @harvinder-ss I know this reply is a little late. I've created a codesandbox showing this in action.
https://codesandbox.io/s/1y7jjvlwjl
See line 39, there the outer div contains a custom div which is styled in a light yellow color. I am closing this issue. Please reopen if you still face any issue.
from react-infinite-scroll-component.
for anyone who still need to solve the problem. My solution was:
component
<div className="infinite-scroll-container">
<InfiniteScroll />
</div>
css file
.infinite-scroll-container > div:first-child {
/* this styling goes to the outer div of infinite scroll */
}
from react-infinite-scroll-component.
Thank you @ankeetmaini - I wasn't clear enought with the issue I think. Have a look at this sandbox where I have made replicated our issue.
https://codesandbox.io/s/k24w99vojr
We have a grid of details each box in the grid takes a percentage of the row. As long as our first row contains enough items to fill the row the infinite scroll works perfectly but once we have a situation were there are very few items the first display sets the size of the parent div and the percentage calculation becomes an issue. In the sandbox above I have set the size so that 2 items show on a row. When I set the array to start with a single item you will see that the width gets messed up.
This is because of a div coded in teh component - that I identified and re-styled using
#product-grid > div:first-child > div:first-child{
width: 100%;
}
with the code:
<div id="product-grid">
<div className="row">
<InfiniteScroll ...
from react-infinite-scroll-component.
For now, my solution is to have a CSS file. Something like below works:
// Example.css
.infinite-scroll-component__outerdiv {
width: 100%;
/* ...whatever more styles you want */
}
Then you just import this file to your component file. Hope it helps.
from react-infinite-scroll-component.
from react-infinite-scroll-component.
I had the same issue - and wrapping the child items didn't help.
The unnamed, unstyled div gets a width property that caused us some issues. I got round it by assigning a style using div:first-child
from react-infinite-scroll-component.
<div className="cover">
<InfiniteScroll />
</div>
CSS File:
.cover{
//Styling
}
from react-infinite-scroll-component.
para quem ainda precisa resolver o problema. Minha solução foi:
componente
<div className="infinite-scroll-container"> <InfiniteScroll /> </div>
Arquivo CSS
.infinite-scroll-container > div:first-child { /* this styling goes to the outer div of infinite scroll */ }
Obrigado.
resolveu pra mim.
from react-infinite-scroll-component.
Thank you so much, @BlueBeret !
from react-infinite-scroll-component.
Related Issues (20)
- Scroll Both Direction (bidirectional infinite scroll) HOT 3
- Integration with Headless UI popover not working as expected.
- Block is appearing during scroll HOT 1
- Number 0 appears when finish loading message appears HOT 1
- `scrollableTarget` throws error `Type 'HTMLElement' is not assignable to type 'ReactNode'` in React 18 HOT 3
- Inverse does not work if you do not set a specific height
- Not calling next function on long screens HOT 13
- can not working in shadowDOM
- react-infinite-scroll-component is no longer maintained HOT 3
- The component is not working after a certain amount of items in the list
- Don't loading new content, if initial content height <= screen height HOT 4
- Please modify the npm docs and mention that for the dataLength prop we need to pass the actual length of the data that we are currently rendering.
- TypeError on latest Next.js HOT 4
- Bidirectional Infinite Scroll HOT 2
- Wrong calculation in isElementAtTop method causing percentage scrollThreshold to fail in inverse mode HOT 1
- Invalid Hook call on SetProgress -> 100%
- is this library supported horizontal scroll?
- 【IMPORT FOR EVERYONE】HOW TO FIX:Don't load new items when content height <= screen height
- Possibility to pass throttle time as props
- How can I change the scrollY when the InfiniteScroll has rendered HOT 1
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 react-infinite-scroll-component.