Skip to content

Commit

Permalink
fix: fixed most of the issue was not closed
Browse files Browse the repository at this point in the history
- close #658
- close #664
- close #665
- close #668
- close #680
- close #681
  • Loading branch information
3lang3 committed Sep 18, 2023
1 parent 309fb2a commit b132e0d
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 18 deletions.
6 changes: 6 additions & 0 deletions packages/react-vant/src/components/area/Area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ const Area = forwardRef<AreaInstance, AreaProps<AreaColumnOption>>((p, ref) => {
const props = mergeProps(p, {
areaList: {},
columnsNum: 3,
itemHeight: 44,
visibleItemCount: 5,
swipeDuration: 300,
showToolbar: true,
placeholder: true,
toolbarPosition: 'top',
})
const columns = useMemo(
() => props.columns ?? parseVanAreaList(props.areaList, +props.columnsNum),
Expand Down
8 changes: 2 additions & 6 deletions packages/react-vant/src/components/dialog/demo/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ export default () => {
Dialog.confirm({
title: '标题',
message: '代码是写出来给人看的,附带能在机器上运行',
onCancel: () => console.log('cancel'),
onConfirm: () => console.log('confirm'),
})
.then(() => {
console.log('confirm')
})
.catch(() => {
console.log('catch')
})
}
/>
<Cell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const DropdownMenu = forwardRef<DropdownMenuInstance, DropdownMenuProps>(
closeOnClickOverlay: true,
direction: 'down' as const,
defaultValue: {},
teleport: () => document.body,
})
const [innerValue = {}, setInnerValue] = useMergedState({
value: props.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ const DropdownMenuItem = forwardRef<
>
<Popup
{...attrs}
teleport={null}
visible={props.showPopup}
className={clsx(bem('content'))}
position={direction === 'down' ? 'top' : 'bottom'}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-vant/src/components/flex/Flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Flex: React.FC<FlexProps> = props => {
...rest
} = props
const getGutter: [number, number] = useMemo(
() => (Array.isArray(gutter) ? gutter : [gutter, 0]),
() => (Array.isArray(gutter) ? gutter : [gutter, gutter]),
[gutter]
)

Expand All @@ -34,7 +34,7 @@ const Flex: React.FC<FlexProps> = props => {
...(getGutter[1]! > 0
? {
marginTop: getGutter[1]! / -2,
marginBottom: getGutter[1]! / 2,
marginBottom: getGutter[1]! / -2,
}
: {}),
...style,
Expand Down
5 changes: 4 additions & 1 deletion packages/react-vant/src/components/flex/demo/gutter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import './style.less'
export default () => {
return (
<div className='demo-flex'>
<Flex gutter={16}>
<Flex gutter={16} wrap='wrap'>
<Flex.Item span={8}>span: 8</Flex.Item>
<Flex.Item span={8}>span: 8</Flex.Item>
<Flex.Item span={8}>span: 8</Flex.Item>
<Flex.Item span={8}>span: 8</Flex.Item>
<Flex.Item span={8}>span: 8</Flex.Item>
<Flex.Item span={8}>span: 8</Flex.Item>
Expand Down
12 changes: 7 additions & 5 deletions packages/react-vant/src/components/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const Input = forwardRef<InputInstance, InputProps>((p, ref) => {
const trigger =
props.clearTrigger === 'always' ||
(props.clearTrigger === 'focus' && inputFocus)

return hasValue && trigger
}
return false
Expand Down Expand Up @@ -186,10 +185,13 @@ const Input = forwardRef<InputInstance, InputProps>((p, ref) => {
)}
{renderInput()}
{showClear &&
React.cloneElement(props.clearIcon as React.ReactElement, {
className: clsx(bem('clear')),
onTouchStart: handleClear,
})}
React.cloneElement(
(props.clearIcon || <Clear />) as React.ReactElement,
{
className: clsx(bem('clear')),
onTouchStart: handleClear,
}
)}
{props.suffix && (
<div className={clsx(bem('suffix'))}>{props.suffix}</div>
)}
Expand Down
1 change: 1 addition & 0 deletions packages/react-vant/src/components/input/demo/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default () => {
value={state.text}
onChange={text => updateState({ text })}
placeholder='请输入文本'
clearable
/>
</Cell>
<Cell>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-vant/src/components/search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Search } from 'react-vant';

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

Expand Down
1 change: 1 addition & 0 deletions packages/react-vant/src/components/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const [bem] = createNamespace('search')
const Search = forwardRef<SearchInstance, SearchProps>((p, ref) => {
const props = mergeProps(p, {
shape: 'square',
clearTrigger: 'focus',
leftIcon: <SearchIco />,
})
const { locale } = useContext(ConfigProviderContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const ShareSheet: React.FC<ShareSheetProps> = p => {
closeOnPopstate: true,
safeAreaInsetBottom: true,
closeOnClickOverlay: true,
duration: 300,
})
const { locale } = useContext(ConfigProviderContext)

Expand Down
2 changes: 1 addition & 1 deletion packages/react-vant/src/components/space/Space.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const [bem] = createNamespace('space')
const Space: React.FC<SpaceProps> = props => {
const { wrap, block, direction = 'horizontal', align, justify } = props
const style = React.useMemo(() => {
if (props.gap) {
if (props.gap !== undefined && props.gap !== null) {
if (Array.isArray(props.gap)) {
const [gapV, gapH] = props.gap
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-vant/src/components/tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Tabs = forwardRef<TabsInstance, TabsProps>((p, ref) => {

const navStyle = useMemo(
() => ({
borderColor: props.type === 'card' && color,
borderColor: props.type === 'card' ? color : undefined,
background,
}),
[color, background]
Expand Down

1 comment on commit b132e0d

@mao437303994
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#681 你好哥们,这个问题项目这种写法不止这一处,其他地方其他组件也有这中写法,应该也会有问题吧

Please sign in to comment.