xl vision
  • Component
  • React Hooks
  • Playground
  • Overview
  • useTransition
  • useCssTransition
  • usePopper
  • useNotication
  • useForm
  • useResizeObserver

useTransition

Transition animations can be easily implemented.

Examples

Basic usage

Basic usage

Transition immediately

Transition animation when the component is instantiated

API

type TransitionOptions<T extends Element> = {
  onEnter?: TransitionStartHook<T>;
  onEntering?: TransitionStartingHook<T>;
  onEntered?: TransitionEndHook<T>;
  onEnterCancelled?: TransitionCancelledHook<T>;
  onExit?: TransitionStartHook<T>;
  onExiting?: TransitionStartingHook<T>;
  onExited?: TransitionEndHook<T>;
  onExitCancelled?: TransitionCancelledHook<T>;
  in: boolean;
  transitionOnFirst?: boolean;
};

const {show: boolean, nodeRef: Ref} = useTransition(options: TransitionOptions)

Properties

PropertyDescriptionTypeDefaultRequire
inTrigger the entering and exiting animation, true means entering, false means exitingboolean-true
transitionOnFirstWhether to trigger the first entry and exit hook functionbooleanfalsefalse
onEnterBefore enter hook(el: Element, transitionOnFirst: boolean) => void-
onEnteringEnter hook(el: Element, done: (() => void), transitionOnFirst: boolean, isCancelled: () => boolean) => void-false
onEnteredAfter enter hook(el:Element, transitionOnFirst: boolean) => void-false
onEnterCancelledEnter cancelled hook(el:Element, transitionOnFirst: boolean) => void-false
onExitBefore exit hook(el: Element, transitionOnFirst: boolean) => void-false
onExitingExit hook(el: Element, done: (() => void), transitionOnFirst: boolean, isCancelled: () => boolean) => void-false
onExitedAfter exit hook(el:Element, transitionOnFirst: boolean) => void-false
onExitCancelledExit cancelled hoo(el: Element, transitionOnFirst: boolean) => void-false

Returns

ReturnDescriptionType
showWhether the control component is displayed or hidden during the display processboolean
nodeRefBind to the element, specify the animation elementboolean
Examples
Basic usage
Transition immediately
API
Properties
Returns
Copyright © 2020-2021 Rhys Xia