UNPKG

@crossed/primitive

Version:

A universal & performant styling library for React Native, Next.js & React

28 lines (27 loc) 759 B
import { jsx } from "react/jsx-runtime"; import { useContext } from "./context"; import { forwardRef } from "react"; import { composeEventHandlers } from "@crossed/core"; const createLabelText = (StyledText) => forwardRef( (props, ref) => { const { id, inputRef } = useContext(); return /* @__PURE__ */ jsx( StyledText, { ref, id: `label-${id}`, role: "label", htmlFor: id, ...props, onPress: composeEventHandlers(props.onPress, () => { var _a, _b; (_b = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a); }) } ); } ); export { createLabelText }; //# sourceMappingURL=LabelText.js.map