Coder Social home page Coder Social logo

Comments (10)

mrtheyann avatar mrtheyann commented on June 26, 2024 15

Still a problem, actually

from react-infinite-scroll-component.

ankeetmaini avatar ankeetmaini commented on June 26, 2024 8

@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.

BlueBeret avatar BlueBeret commented on June 26, 2024 3

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.

Anna-Weaver-JL avatar Anna-Weaver-JL commented on June 26, 2024 1

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.

doanhtu07 avatar doanhtu07 commented on June 26, 2024 1

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.

ankeetmaini avatar ankeetmaini commented on June 26, 2024

from react-infinite-scroll-component.

Anna-Weaver-JL avatar Anna-Weaver-JL commented on June 26, 2024

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.

Ali-0235 avatar Ali-0235 commented on June 26, 2024
<div className="cover">
<InfiniteScroll />
</div>
CSS File:
.cover{
//Styling
}

from react-infinite-scroll-component.

gilopavani avatar gilopavani commented on June 26, 2024

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.

d4nielchaves avatar d4nielchaves commented on June 26, 2024

Thank you so much, @BlueBeret !

from react-infinite-scroll-component.

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.