UNPKG

react-native-reanimated

Version:

More powerful alternative to Animated library for React Native.

30 lines (29 loc) 1.46 kB
'use strict'; import { filterCSSAndStyleProperties, splitCSSCallbacks } from "../../utils/index.js"; import { configureWebCSS } from "../domUtils.js"; import CSSAnimationsManager from "./CSSAnimationsManager.js"; import CSSPseudoSelectorsManager from "./CSSPseudoSelectorsManager.js"; import CSSTransitionsManager from "./CSSTransitionsManager.js"; export default class CSSManager { constructor(viewInfo, componentDisplayName = '') { configureWebCSS(); const element = viewInfo.DOMElement; const svgElementTag = element?.tagName ?? componentDisplayName; this.animationsManager = new CSSAnimationsManager(element, svgElementTag); this.transitionsManager = new CSSTransitionsManager(element); this.pseudoSelectorsManager = new CSSPseudoSelectorsManager(element, svgElementTag); } update(style, props = {}) { const [animationProperties, transitionProperties, pseudoStylesBySelector] = filterCSSAndStyleProperties(style); const [animationCallbacks, transitionCallbacks] = splitCSSCallbacks(props); this.animationsManager.update(animationProperties, animationCallbacks); this.transitionsManager.update(transitionProperties, transitionCallbacks); this.pseudoSelectorsManager.update(pseudoStylesBySelector); } unmountCleanup() { this.animationsManager.unmountCleanup(); this.transitionsManager.unmountCleanup(); this.pseudoSelectorsManager.unmountCleanup(); } } //# sourceMappingURL=CSSManager.js.map