UNPKG

@iimm/formily-taro-vantui

Version:

form field components based on @antmjs/vantui and @formily/react

25 lines 928 B
import { useCreation } from "ahooks"; import { createContext, useContext } from "react"; import { jsx as _jsx } from "react/jsx-runtime"; var FormLayoutContext = /*#__PURE__*/createContext({}); export var useFormLayout = function useFormLayout() { return useContext(FormLayoutContext); }; export var FormLayout = function FormLayout(props) { var showFeedback = props.showFeedback, alwaysShowFeedback = props.alwaysShowFeedback, _props$withFormItem = props.withFormItem, withFormItem = _props$withFormItem === void 0 ? true : _props$withFormItem, children = props.children; var value = useCreation(function () { return { showFeedback: showFeedback, alwaysShowFeedback: alwaysShowFeedback, withFormItem: withFormItem }; }, [showFeedback, alwaysShowFeedback, withFormItem]); return /*#__PURE__*/_jsx(FormLayoutContext.Provider, { value: value, children: children }); };