Code Monkey home page Code Monkey logo

Comments (3)

skoal2007 avatar skoal2007 commented on July 17, 2024 3

'Fraid not yet. =[ Hoping someone has an answer here.

I just went through the source code, and found out you need to set margin on Gallery component as well.
Problem solved, just set margin on both sections

const PHOTO_MARGIN = 5;

class MyGallery extends React.Component {

// ....

  imageRenderer({ index, onClick, photo, margin, direction, top, left, key }) {
    // const { history } = this.props;
    // console.log(props)
    return (
      <div key={photo.id} className="image-div">
        <Photo
          key={photo.id}
          index={index}
          photo={photo}
          left={left}
          top={top}
          onClick={() => {}}
          margin={PHOTO_MARGIN}
          direction={direction}
        />
      </div>
    );
  }
render() {
      return (
         ...
          <Gallery photos={gallery_list} renderImage={this.imageRenderer} margin={PHOTO_MARGIN} />
          ...
       )
  }
}

from react-photo-gallery.

skoal2007 avatar skoal2007 commented on July 17, 2024

Hi Huy,
Have you solved this issue. I also want to increase the margin to 5, but when I use number larger than 2, the gallery breaks. Please let me know if you have any solution. Thank you

from react-photo-gallery.

huy-vuong avatar huy-vuong commented on July 17, 2024

'Fraid not yet. =[ Hoping someone has an answer here.

from react-photo-gallery.

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.