Skip to content

Commit 2669d02

Browse files
committed
fix: ts types
1 parent 65a3c5a commit 2669d02

File tree

9 files changed

+16
-17
lines changed

9 files changed

+16
-17
lines changed

src/packages/fixednav/fixednav.taro.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const defaultProps: FixedNavProps = {
1919
bottom: 'auto',
2020
},
2121
zIndex: 200,
22-
onChange: () => {},
22+
onChange: (value: boolean) => {},
2323
onSelect: () => {},
2424
}
2525

src/packages/fixednav/fixednav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const defaultProps: FixedNavProps = {
1818
bottom: 'auto',
1919
},
2020
zIndex: 200,
21-
onChange: () => {},
21+
onChange: (value: boolean) => {},
2222
onSelect: () => {},
2323
}
2424

src/packages/fixednav/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export interface FixedNavProps extends Omit<OverlayProps, 'onClick'> {
2222
type: FixedNavType
2323
content?: React.ReactNode
2424
list: Array<FixedNavItem>
25-
onChange: (item: any) => void
25+
onChange: (value: boolean) => void
2626
onSelect: (
27-
item: any,
27+
item: FixedNavItem,
2828
event: React.MouseEvent<HTMLDivElement, MouseEvent>
2929
) => void
3030
}

src/packages/overlay/overlay.taro.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export const defaultOverlayProps: OverlayProps = {
1919
afterClose: () => {},
2020
}
2121
export const Overlay: FunctionComponent<
22-
Partial<OverlayProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>
22+
Partial<OverlayProps> &
23+
Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> & {
24+
onClick: (event: React.MouseEvent | ITouchEvent) => void
25+
}
2326
> = (props) => {
2427
const {
2528
children,

src/packages/overlay/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface OverlayProps extends BasicComponent {
66
closeOnOverlayClick: boolean
77
visible: boolean
88
lockScroll: boolean
9-
onClick: (event: TouchEvent) => void
9+
onClick: (event: React.MouseEvent) => void
1010
afterShow: () => void
1111
afterClose: () => void
1212
}

src/packages/popup/popup.taro.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ import { Close } from '@nutui/icons-react-taro'
1212
import { View, ITouchEvent } from '@tarojs/components'
1313
import { defaultOverlayProps } from '@/packages/overlay/overlay.taro'
1414
import Overlay from '@/packages/overlay/index.taro'
15-
import { ComponentDefaults } from '@/utils/typings'
1615
import { useLockScrollTaro } from '@/utils/use-lock-scoll-taro'
1716
import { PopupProps, Teleport } from './types'
1817

1918
const defaultProps: PopupProps = {
20-
...ComponentDefaults,
19+
...defaultOverlayProps,
2120
position: 'center',
2221
transition: '',
2322
overlayStyle: {},
@@ -33,7 +32,6 @@ const defaultProps: PopupProps = {
3332
onClose: () => {},
3433
onOverlayClick: () => true,
3534
onCloseIconClick: () => true,
36-
...defaultOverlayProps,
3735
}
3836

3937
// 默认1000,参看variables

src/packages/popup/popup.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import classNames from 'classnames'
1111
import { Close } from '@nutui/icons-react'
1212
import { defaultOverlayProps } from '@/packages/overlay/overlay'
1313
import Overlay from '@/packages/overlay'
14-
import { ComponentDefaults } from '@/utils/typings'
1514
import { useLockScroll } from '@/utils/use-lock-scroll'
1615
import { PopupProps, Teleport } from './types'
1716

1817
const defaultProps: PopupProps = {
19-
...ComponentDefaults,
18+
...defaultOverlayProps,
2019
position: 'center',
2120
transition: '',
2221
overlayStyle: {},
@@ -32,7 +31,6 @@ const defaultProps: PopupProps = {
3231
onClose: () => {},
3332
onOverlayClick: () => true,
3433
onCloseIconClick: () => true,
35-
...defaultOverlayProps,
3634
}
3735

3836
// 默认1000,参看variables
@@ -118,14 +116,14 @@ export const Popup: FunctionComponent<
118116
}
119117
}
120118

121-
const handleOverlayClick = (e: any) => {
119+
const handleOverlayClick = (e: React.MouseEvent) => {
122120
e.stopPropagation()
123121
if (closeOnOverlayClick && onOverlayClick(e)) {
124122
close()
125123
}
126124
}
127125

128-
const handleCloseIconClick = (e: any) => {
126+
const handleCloseIconClick = (e: React.MouseEvent) => {
129127
onCloseIconClick(e) && close()
130128
}
131129

src/packages/popup/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export interface PopupProps extends OverlayProps {
1919
round: boolean
2020
onOpen: () => void
2121
onClose: () => void
22-
onOverlayClick: (e: TouchEvent) => boolean | void
23-
onCloseIconClick: (e: TouchEvent) => boolean | void
22+
onOverlayClick: (e: React.MouseEvent) => boolean | undefined
23+
onCloseIconClick: (e: React.MouseEvent) => boolean | undefined
2424
}

src/packages/toast/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface ToastProps extends OverlayProps {
1414
id: string
1515
position: ToastPosition
1616
title: string
17-
size: string | number
17+
size: ToastSize
1818
icon: ToastIcon
1919
content: React.ReactNode
2020
contentClassName: string

0 commit comments

Comments
 (0)