@tamagui/react-native-web-lite
Version:
React Native for Web
28 lines (27 loc) • 1.05 kB
JavaScript
import * as React from "react";
import { useMergeRefs } from "@tamagui/react-native-web-internals";
import useAnimatedProps from "./useAnimatedProps.native.js";
function createAnimatedComponent(Component) {
return /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
var _useAnimatedProps = useAnimatedProps(props),
reducedProps = _useAnimatedProps[0],
callbackRef = _useAnimatedProps[1],
ref = useMergeRefs(callbackRef, forwardedRef),
passthroughAnimatedPropExplicitValues = reducedProps.passthroughAnimatedPropExplicitValues,
style = reducedProps.style,
_ref = passthroughAnimatedPropExplicitValues ?? {},
{
passthroughStyle,
...passthroughProps
} = _ref,
mergedStyle = [style, passthroughStyle];
return /* @__PURE__ */React.createElement(Component, {
...reducedProps,
...passthroughProps,
style: mergedStyle,
ref
});
});
}
export { createAnimatedComponent as default };
//# sourceMappingURL=createAnimatedComponent.native.js.map