Skip to content

Commit

Permalink
Merge pull request #790 from thundersdata-frontend/picker-issue
Browse files Browse the repository at this point in the history
fix: 修复Picker 组件的 placeholder 跟 Input 组件的 placeholder 颜色不一致的问题
  • Loading branch information
chj-damon authored Dec 14, 2023
2 parents 544b4bf + d0e2d71 commit e664af4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-hornets-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@td-design/react-native-picker': patch
---

fix: 修复Picker 组件的 placeholder 跟 Input 组件的 placeholder 颜色不一致的问题
4 changes: 2 additions & 2 deletions packages/react-native-picker/src/date-period-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const DatePeriodInput: FC<DatePeriodInputProps> = ({
<>
<Flex>
<SvgIcon name="date" color={theme.colors.icon} />
<Text variant="p1" color={disabled ? 'disabled' : 'text'} marginLeft="x2">
<Text variant="p1" color={disabled ? 'disabled' : dates[0] ? 'text' : 'gray300'} marginLeft="x2">
{dates[0] ? dayjs(dates[0]).format(format) : placeholders[0]}
</Text>
</Flex>
Expand All @@ -88,7 +88,7 @@ const DatePeriodInput: FC<DatePeriodInputProps> = ({
<>
<Flex>
<SvgIcon name="date" color={theme.colors.icon} />
<Text variant="p1" color={disabled ? 'disabled' : 'text'} marginLeft="x2">
<Text variant="p1" color={disabled ? 'disabled' : dates[1] ? 'text' : 'gray300'} marginLeft="x2">
{dates[1] ? dayjs(dates[1]).format(format) : placeholders[1]}
</Text>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const DatePickerInput = forwardRef<PickerRef, DatePickerInputProps>(
>
<Flex flex={1}>
<SvgIcon name="date" color={theme.colors.icon} />
<Text variant="p1" color={'text'} marginLeft="x2">
<Text variant="p1" color={currentText === placeholder ? 'gray300' : 'text'} marginLeft="x2">
{currentText}
</Text>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const DatePickerItem = forwardRef<PickerRef, PickerItemProps>(

const Content = (
<>
<Text variant="p1" color={disabled ? 'disabled' : 'text'}>
<Text variant="p1" color={disabled ? 'disabled' : currentText === placeholder ? 'gray300' : 'text'}>
{currentText}
</Text>
{!disabled && allowClear && !!currentText && currentText !== placeholder && (
Expand Down
6 changes: 5 additions & 1 deletion packages/react-native-picker/src/picker-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ const PickerInput = forwardRef<PickerRef, PickerInputProps>(
const BaseContent = (
<>
<Box flex={1}>
<Text variant="p1" color={disabled ? 'disabled' : 'text'} marginLeft="x2">
<Text
variant="p1"
color={disabled ? 'disabled' : currentText === placeholder ? 'gray300' : 'text'}
marginLeft="x2"
>
{currentText}
</Text>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-picker/src/picker-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const PickerItem = forwardRef<PickerRef, PickerItemProps>(
<>
<Text
variant="p1"
color={disabled ? 'disabled' : 'text'}
color={disabled ? 'disabled' : currentText === placeholder ? 'gray300' : 'text'}
numberOfLines={1}
textAlign={'right'}
style={{ flex: 1 }}
Expand Down

0 comments on commit e664af4

Please sign in to comment.