Skip to content

Commit

Permalink
chore: checkbox type
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang committed Aug 28, 2023
1 parent 204add6 commit 392eb91
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/zarm/src/checkbox/Checkbox.mini.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Label, Switch, View } from '@tarojs/components';
import { BaseEventOrig, Label, Switch, SwitchProps, View } from '@tarojs/components';
import { createBEM } from '@zarm-design/bem';
import { Minus as MinusIcon, Success as SuccessIcon } from '@zarm-design/icons';
import includes from 'lodash/includes';
Expand Down Expand Up @@ -38,7 +38,7 @@ export type CheckboxProps = BaseCheckboxProps &
HTMLProps<CheckboxCssVars> & {
renderIcon?: (props: CheckboxProps) => ReactNode;
render?: (props: CheckboxProps) => ReactNode;
onChange?: (value: boolean) => void;
onChange?: (value: BaseEventOrig<SwitchProps.onChangeEventDetail>) => void;
};

const getChecked = (props: CheckboxProps, defaultChecked?: boolean) => {
Expand Down Expand Up @@ -104,13 +104,13 @@ const Checkbox = forwardRef<unknown, CheckboxProps>((props, ref) => {
className={bem('input')}
disabled={disabled}
checked={checked}
onChange={(e) => {
onChange={(e: BaseEventOrig<SwitchProps.onChangeEventDetail>) => {
if (disabled) return;

if (!('checked' in props)) {
setChecked(e.detail.value);
}
props.onChange?.(e.detail.value);
props.onChange?.(e);
}}
/>
);
Expand Down

0 comments on commit 392eb91

Please sign in to comment.