npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@darkui/react-transition

v0.0.4

Published

参考vue transition实现的react版transition组件,

Downloads

23

Readme

react-transition

参考vue transition实现的react版transition组件,

⚠️元素必须设置key,否则会导致动画无效

import React, { useState } from 'react';
import { Transition, TransitionGroup } from "./index";

/** css部分
 
.fade-enter-active, .fade-leave-active {
  transition: opacity 1.5s;
}
.fade-enter, .fade-leave-to  {
  opacity: 0;
}
*/

const Demo = () => {
    const [show, setShow] = useState(false);
    return <div>
        <button onClick={() => setShow(!show)}>测试</button>
        <Transition name="fade" 
        >
            {show ? <div key={2} id='aa' style={{
                    width: 80,
                    height: 80,
                    background:'red'
                }}></div> : false}
        </Transition>
    </div>
}

Props

name- string,用于自动生成 CSS 过渡类名。例如:name: 'fade' 将自动拓展为 .fade-enter,.fade-enter-active 等。 appear - boolean,是否在初始渲染时使用过渡。默认为 false。 type - string,指定过渡事件类型,侦听过渡何时结束。有效值为 "transition" 和 "animation"。默将自动检测出持续时间长的为过渡事件类型。 mode - string,控制离开/进入过渡的时间序列。有效的模式有 "out-in" 和 "in-out";默认同时进行。 modeTime - number,设置组件进程离场时机 duration - number | { enter: number, leave: number } 指定过渡的持续时间。默认情况下,会等待过渡所在根元素的第一个 transitionend 或 animationend 事件。 absolute - boolean,设置元素过渡过程中为绝对定位 absoluteStyle - css,绝对定位中加载的样式 enter-to-class - string leave-to-class - string appear-to-class - string enter-active-class - string leave-active-class - string appear-active-class - string

事件

onBeforeEnter onBeforeLeave onBeforeAppear onEnter onLeave onAppear onAfterEnter onAfterLeave onAfterAppear onTransitionEnd