Skip to content

Commit

Permalink
fix(antd&next): false should be a valid value in `PreviewText.Selec…
Browse files Browse the repository at this point in the history
…t` (#1297)
  • Loading branch information
cning112 authored Apr 26, 2021
1 parent 132bbe4 commit 388288a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/antd/src/preview-text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ const Select: React.FC<SelectProps<any>> = (props) => {
}
} else {
if (props.labelInValue) {
return value ? [value] : []
return isValid(value) ? [value] : []
} else {
return value ? [{ label: value, value }] : []
return isValid(value) ? [{ label: value, value }] : []
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/next/src/preview-text/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { createContext, useContext } from 'react'
import { isArr, isEmpty } from '@formily/shared'
import { isArr, isEmpty, isValid } from '@formily/shared'
import { useField } from '@formily/react'
import { InputProps } from '@alifd/next/lib/input'
import { SelectProps } from '@alifd/next/lib/select'
Expand Down Expand Up @@ -57,9 +57,9 @@ const Select: React.FC<SelectProps> = (props) => {
}
} else {
if (props.useDetailValue) {
return value ? [value] : []
return isValid(value) ? [value] : []
} else {
return value ? [{ label: value, value }] : []
return isValid(value) ? [{ label: value, value }] : []
}
}
}
Expand Down

0 comments on commit 388288a

Please sign in to comment.