Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/gatsby-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ You will need to add it in your graphql query as is shown in the following snipp
| ---------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `fixed` | `object` | Data returned from the `fixed` query |
| `fluid` | `object` | Data returned from the `fluid` query |
| `fadeIn` | `bool` | Defaults to fading in the image on load |
| `fadeIn` | `number` | Defaults to fading in the image on load in 500ms |
| `title` | `string` | Passed to the `img` element |
| `alt` | `string` | Passed to the `img` element |
| `crossOrigin` | `string` | Passed to the `img` element |
Expand Down
10 changes: 7 additions & 3 deletions packages/gatsby-image/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,13 @@ class Image extends React.Component {
itemProp,
} = convertProps(this.props)

const shouldReveal = this.state.imgLoaded || this.state.fadeIn === false
const shouldFadeIn = this.state.fadeIn === true && !this.state.imgCached
const durationFadeIn = `0.5s`
const shouldReveal =
this.state.imgLoaded || Boolean(this.state.fadeIn) === false
const shouldFadeIn =
Boolean(this.state.fadeIn) === true && !this.state.imgCached
Comment thread
frinyvonnick marked this conversation as resolved.
Outdated
const durationFadeIn = Number.isInteger(this.state.fadeIn)
? `${this.state.fadeIn}ms`
: `0.5s`

const imageStyle = {
opacity: shouldReveal ? 1 : 0,
Expand Down