Skip to content

Commit aec05fc

Browse files
committed
fix(ActionSheet): onCancel改为必填参数
1 parent b45428f commit aec05fc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/core/src/ActionSheet/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface ActionSheetProps extends ModalProps {
2727
/** 取消的文本 */
2828
cancelText?: React.ReactNode;
2929
/** 蒙层关闭回调 */
30-
onCancel?: () => void;
30+
onCancel: () => void;
3131
}
3232

3333
interface ActionSheetState {
@@ -82,8 +82,6 @@ export default function ActionSheet(props: ActionSheetProps) {
8282
}
8383
};
8484

85-
const onClose = () => onCancel?.();
86-
8785
return (
8886
<Modal
8987
placement="bottom"
@@ -107,7 +105,7 @@ export default function ActionSheet(props: ActionSheetProps) {
107105
<ActionSheetItem
108106
activeOpacity={activeOpacity}
109107
underlayColor={underlayColor}
110-
onPress={onClose}
108+
onPress={() => onCancel?.()}
111109
children={cancelText}
112110
containerStyle={containerStyle}
113111
textStyle={textStyle}

0 commit comments

Comments
 (0)