Skip to content

Commit b132e0d

Browse files
committed
fix: fixed most of the issue was not closed
- close #658 - close #664 - close #665 - close #668 - close #680 - close #681
1 parent 309fb2a commit b132e0d

File tree

13 files changed

+28
-18
lines changed

13 files changed

+28
-18
lines changed

packages/react-vant/src/components/area/Area.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ const Area = forwardRef<AreaInstance, AreaProps<AreaColumnOption>>((p, ref) => {
8484
const props = mergeProps(p, {
8585
areaList: {},
8686
columnsNum: 3,
87+
itemHeight: 44,
88+
visibleItemCount: 5,
89+
swipeDuration: 300,
90+
showToolbar: true,
91+
placeholder: true,
92+
toolbarPosition: 'top',
8793
})
8894
const columns = useMemo(
8995
() => props.columns ?? parseVanAreaList(props.areaList, +props.columnsNum),

packages/react-vant/src/components/dialog/demo/base.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ export default () => {
1111
Dialog.confirm({
1212
title: '标题',
1313
message: '代码是写出来给人看的,附带能在机器上运行',
14+
onCancel: () => console.log('cancel'),
15+
onConfirm: () => console.log('confirm'),
1416
})
15-
.then(() => {
16-
console.log('confirm')
17-
})
18-
.catch(() => {
19-
console.log('catch')
20-
})
2117
}
2218
/>
2319
<Cell

packages/react-vant/src/components/dropdown-menu/DropdownMenu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const DropdownMenu = forwardRef<DropdownMenuInstance, DropdownMenuProps>(
3737
closeOnClickOverlay: true,
3838
direction: 'down' as const,
3939
defaultValue: {},
40+
teleport: () => document.body,
4041
})
4142
const [innerValue = {}, setInnerValue] = useMergedState({
4243
value: props.value,

packages/react-vant/src/components/dropdown-menu/DropdownMenuItem.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ const DropdownMenuItem = forwardRef<
141141
>
142142
<Popup
143143
{...attrs}
144-
teleport={null}
145144
visible={props.showPopup}
146145
className={clsx(bem('content'))}
147146
position={direction === 'down' ? 'top' : 'bottom'}

packages/react-vant/src/components/flex/Flex.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const Flex: React.FC<FlexProps> = props => {
2020
...rest
2121
} = props
2222
const getGutter: [number, number] = useMemo(
23-
() => (Array.isArray(gutter) ? gutter : [gutter, 0]),
23+
() => (Array.isArray(gutter) ? gutter : [gutter, gutter]),
2424
[gutter]
2525
)
2626

@@ -34,7 +34,7 @@ const Flex: React.FC<FlexProps> = props => {
3434
...(getGutter[1]! > 0
3535
? {
3636
marginTop: getGutter[1]! / -2,
37-
marginBottom: getGutter[1]! / 2,
37+
marginBottom: getGutter[1]! / -2,
3838
}
3939
: {}),
4040
...style,

packages/react-vant/src/components/flex/demo/gutter.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import './style.less'
55
export default () => {
66
return (
77
<div className='demo-flex'>
8-
<Flex gutter={16}>
8+
<Flex gutter={16} wrap='wrap'>
9+
<Flex.Item span={8}>span: 8</Flex.Item>
10+
<Flex.Item span={8}>span: 8</Flex.Item>
11+
<Flex.Item span={8}>span: 8</Flex.Item>
912
<Flex.Item span={8}>span: 8</Flex.Item>
1013
<Flex.Item span={8}>span: 8</Flex.Item>
1114
<Flex.Item span={8}>span: 8</Flex.Item>

packages/react-vant/src/components/input/Input.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ const Input = forwardRef<InputInstance, InputProps>((p, ref) => {
7373
const trigger =
7474
props.clearTrigger === 'always' ||
7575
(props.clearTrigger === 'focus' && inputFocus)
76-
7776
return hasValue && trigger
7877
}
7978
return false
@@ -186,10 +185,13 @@ const Input = forwardRef<InputInstance, InputProps>((p, ref) => {
186185
)}
187186
{renderInput()}
188187
{showClear &&
189-
React.cloneElement(props.clearIcon as React.ReactElement, {
190-
className: clsx(bem('clear')),
191-
onTouchStart: handleClear,
192-
})}
188+
React.cloneElement(
189+
(props.clearIcon || <Clear />) as React.ReactElement,
190+
{
191+
className: clsx(bem('clear')),
192+
onTouchStart: handleClear,
193+
}
194+
)}
193195
{props.suffix && (
194196
<div className={clsx(bem('suffix'))}>{props.suffix}</div>
195197
)}

packages/react-vant/src/components/input/demo/base.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default () => {
1616
value={state.text}
1717
onChange={text => updateState({ text })}
1818
placeholder='请输入文本'
19+
clearable
1920
/>
2021
</Cell>
2122
<Cell>

packages/react-vant/src/components/search/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Search } from 'react-vant';
2525

2626
export default () => {
2727
const [value, setValue] = useState('');
28-
return <Search value={value} onChange={setValue} placeholder="请输入搜索关键词" />;
28+
return <Search value={value} onChange={setValue} clearable placeholder="请输入搜索关键词" />;
2929
};
3030
```
3131

packages/react-vant/src/components/search/Search.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const [bem] = createNamespace('search')
2222
const Search = forwardRef<SearchInstance, SearchProps>((p, ref) => {
2323
const props = mergeProps(p, {
2424
shape: 'square',
25+
clearTrigger: 'focus',
2526
leftIcon: <SearchIco />,
2627
})
2728
const { locale } = useContext(ConfigProviderContext)

0 commit comments

Comments
 (0)