Skip to content

Commit

Permalink
fix(ActionSheet): onCancel改为必填参数
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenlingasMx committed Mar 7, 2023
1 parent b45428f commit aec05fc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/core/src/ActionSheet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface ActionSheetProps extends ModalProps {
/** 取消的文本 */
cancelText?: React.ReactNode;
/** 蒙层关闭回调 */
onCancel?: () => void;
onCancel: () => void;
}

interface ActionSheetState {
Expand Down Expand Up @@ -82,8 +82,6 @@ export default function ActionSheet(props: ActionSheetProps) {
}
};

const onClose = () => onCancel?.();

return (
<Modal
placement="bottom"
Expand All @@ -107,7 +105,7 @@ export default function ActionSheet(props: ActionSheetProps) {
<ActionSheetItem
activeOpacity={activeOpacity}
underlayColor={underlayColor}
onPress={onClose}
onPress={() => onCancel?.()}
children={cancelText}
containerStyle={containerStyle}
textStyle={textStyle}
Expand Down

0 comments on commit aec05fc

Please sign in to comment.