Giter Club home page Giter Club logo

image's People

Contributors

zackify avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

image's Issues

Load once scrolled into view

Check if the image tag is close to the scroll height and only load it at that point. Make this an optional prop

Add loading image

This component needs more work to really be future-proof. Expect a pr from me soon.

Server-side pre-rendered images stuck at opacity: 0

When using the react-redux-universal-hot-example repo as a starting point (https://github.com/erikras/react-redux-universal-hot-example/tree/4705688b879f853ede08e3872bc083cc84227824)

My component:

<Image className="thumbnail" src="https://i.imgur.com/l50kGUz.png" />

The HTML that comes through in the view source:

<img class="thumbnail" src="https://images.unsplash.com/photo-1439003511744-2a0490ea0a88?q=80&amp;fm=jpg&amp;s=4dd5809698048edf8b82eedb82ca8cec" style="transition:opacity 1s;opacity:0;" data-reactid=".mzv5v08jcw.2.0.0.0">

Notice how the opacity is frozen at 0.

How to reproduce:

  1. Clone that example repo down
  2. npm i --save legit-image
  3. Spam Image tags on the homepage or whatever page
  4. npm start

Race condition with server-side rendering?

Uncaught Error: A valid ReactComponent must be returned.

Hi :)

When I use your component, I get this error message:

Uncaught Error: A valid ReactComponent must be returned.

Figured, this happens because React is considering the component only valid if its enclosed in div tags. So when changing your code as below, things work properly well.

    return (
      <div>
        <img
          {...this.props}
          style={style}
          src={this.props.src}
          onLoad={this.fadeIn}
        />
      </div>
    )

Protocol-less images doesn't fade in

I'm not quite sure what the intention was with the first part of this line:

if(!src.match(/http/) || typeof window === 'undefined') opacity = 1

Basically that means you won't get fading images for:

  • Relative URLs (<LegitImage src="foo.jpg" />)
  • Protocol-less URLs (<LegitImage src="//domain.com/foo.jpg" />)

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.