Skip to content

Commit 515e506

Browse files
committed
Fix some style inconsistencies with date picker
1 parent 67296ba commit 515e506

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

packages/core/src/components/DatePicker/DatePicker.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
132132
width: number;
133133
}>({ measured: false, width: 0 });
134134

135-
const { textStyles } = extractStyles(style);
135+
const { textStyles, viewStyles } = extractStyles(style);
136136

137137
const getValidDate = (): Date => {
138138
if (!value) {
@@ -253,10 +253,12 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
253253

254254
const hasActiveOutline = focused;
255255

256+
const propOrStyleBorderColor = viewStyles.borderColor ?? inputBorderColor;
257+
256258
let inputTextColor,
257259
activeColor,
258260
underlineColor,
259-
borderColor = inputBorderColor,
261+
borderColor = propOrStyleBorderColor,
260262
placeholderColor,
261263
containerStyle: StyleProp<ViewStyle>,
262264
backgroundColor,
@@ -271,8 +273,8 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
271273
backgroundColor = colors.divider;
272274
} else {
273275
activeColor = inputBorderColorActive || colors.primary;
274-
placeholderColor = inputBorderColor || colors.light;
275-
underlineColor = inputBorderColor || colors.light;
276+
placeholderColor = colors.light;
277+
underlineColor = propOrStyleBorderColor || colors.light;
276278
backgroundColor = colors.background;
277279
}
278280

@@ -301,7 +303,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
301303
containerStyle = {
302304
borderRadius: roundness,
303305
borderColor: hasActiveOutline ? activeColor : borderColor,
304-
borderWidth: 1,
306+
borderWidth: viewStyles.borderWidth ?? 1,
305307
paddingTop: labeled && !hideLabel ? 16 * 1.5 : 16,
306308
paddingBottom: labeled && !hideLabel ? 16 * 0.5 : 16,
307309
opacity: disabled ? disabledOpacity : 1,
@@ -399,7 +401,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
399401
<View
400402
style={StyleSheet.flatten([
401403
styles.container,
402-
omit(style, [...paddingStyleNames, "backgroundColor"]),
404+
omit(style, [
405+
...paddingStyleNames,
406+
"backgroundColor",
407+
"borderWidth",
408+
]),
403409
])}
404410
>
405411
{leftIconName && leftIconMode === "outset" ? (
@@ -409,7 +415,12 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
409415
style={StyleSheet.flatten([
410416
containerStyle,
411417
style ? { height: style.height } : {},
412-
omit(style, [...marginStyleNames, ...positionStyleNames]),
418+
omit(style, [
419+
...marginStyleNames,
420+
...positionStyleNames,
421+
"borderColor",
422+
"borderWidth",
423+
]),
413424
])}
414425
>
415426
{type === "underline" ? (

0 commit comments

Comments
 (0)