🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

react-fade

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-fade

Simple fades in React

latest
Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
76
-50%
Maintainers
1
Weekly downloads
 
Created
Source

npm travis standard

react-fade

Simple fades in React

npm i react-fade

Fade in

Children components will start invisible and fade into a visible state.

<Fade>
  <p>I am so faded</p>
</Fade>

Fade out

Fade out requires some extra code to stay invisble after it's been faded-out. Right now, the recommended way of using <Fade out/> is to utilize the duration property in conjuction with css display or visibilty. For example:

import { default as React, Component } from 'react'
import { default as Fade } from 'react-fade'

const fadeDuration = 10

class FadeExample extends Component {

  state = {
    fadeOut: false,
    visibility: 'visible'
  }

  componentDidUpdate(nextProps, { fadeOut }) {
    if (fadeOut) {
      setTimeout(() => {
        this.setState({
          visibility: 'hidden'
        })
      }, fadeDuration)
    }
  }
  
  render() {
    return (
      <div>
        <Fade
          out={this.state.fadeOut}
          duration={fadeDuration}
          style={{
            visibility: this.state.visibility
          }}
        >
          <p>I am so faded</p>
        </Fade>
        <button onClick={() => this.setState({ fadeOut: true })}>
          Fade out
        </button>
      </div>
    )
  }
}

Props

PropTypeDescription
outboolfades out instead of in - see instructions for usage patterns
durationnumberthe amount of time in seconds that it takes to fade in or out

Keywords

fade

FAQs

Package last updated on 12 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts