UNPKG

@tamagui/react-native-web-lite

Version:
29 lines (28 loc) 1.02 kB
import { useAnimatedProps } from "./useAnimatedProps.mjs"; import { useMergeRefs } from "../Utilities/useMergeRefs.mjs"; import * as React from "react"; import { jsx } from "react/jsx-runtime"; function createAnimatedComponent(Component) { return React.forwardRef((props, forwardedRef) => { const [reducedProps, callbackRef] = useAnimatedProps(props); const ref = useMergeRefs(callbackRef, forwardedRef); const { passthroughAnimatedPropExplicitValues, style } = reducedProps; const { style: passthroughStyle, ...passthroughProps } = passthroughAnimatedPropExplicitValues ?? {}; const mergedStyle = [style, passthroughStyle]; return /* @__PURE__ */jsx(Component, { ...reducedProps, ...passthroughProps, style: mergedStyle, ref }); }); } var createAnimatedComponent_default = createAnimatedComponent; export { createAnimatedComponent, createAnimatedComponent_default as default }; //# sourceMappingURL=createAnimatedComponent.mjs.map