How to use the @react-spring/animated.extendAnimated function in @react-spring/animated

To help you get started, we’ve selected a few @react-spring/animated examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-spring / react-spring / targets / konva / src / animated.ts View on Github external
ElementType,
  ComponentPropsWithRef,
  FluidValue,
} from 'shared'
import { KonvaExports, KonvaElements, elements } from './elements'

type CreateAnimated = (
  wrappedComponent: T
) => AnimatedComponent

type KonvaComponents = {
  [Tag in KonvaElements]: AnimatedComponent
}

// Extend animated with all the available Konva elements
export const animated: CreateAnimated & KonvaComponents = extendAnimated(
  withAnimated,
  elements
)

export { animated as a }

/** The type of an `animated()` component */
export type AnimatedComponent<
  T extends ElementType
> = ForwardRefExoticComponent>>

/** The props of an `animated()` component */
export type AnimatedProps = {
  [P in keyof Props]: (P extends 'ref' | 'key'
    ? Props[P]
    : AnimatedProp)
github react-spring / react-spring / targets / zdog / src / animated.ts View on Github external
'Rect',
  'RoundedRect',
  'Ellipse',
  'Polygon',
  'Hemisphere',
  'Cylinder',
  'Cone',
  'Box',
]

type CreateAnimated = (
  wrappedComponent: T
) => AnimatedComponent

// Extend animated with all the available Zdog elements
export const animated: CreateAnimated & ZdogComponents = extendAnimated(
  withAnimated,
  elements
)

export { animated as a }

/** The type of an `animated()` component */
export type AnimatedComponent<
  T extends ElementType
> = ForwardRefExoticComponent>>

/** The props of an `animated()` component */
export type AnimatedProps = {
  [P in keyof Props]: (P extends 'ref' | 'key'
    ? Props[P]
    : AnimatedProp)