UNPKG

antd-mobile-taro-ui

Version:

以antd-mobile为设计标准,基于taro框架的微信小程序组件库

22 lines 661 B
import React from 'react'; import { usePropsValue } from 'antd-mobile/es/utils/use-props-value'; import { mergeProps } from 'antd-mobile/es/utils/with-default-props'; import { RadioGroupContext } from './group-context'; const defaultProps = { disabled: false, defaultValue: null }; export const Group = p => { const props = mergeProps(defaultProps, p); const [value, setValue] = usePropsValue(props); return React.createElement(RadioGroupContext.Provider, { value: { value: value === null ? [] : [value], check: v => { setValue(v); }, uncheck: () => {}, disabled: props.disabled } }, props.children); };