dhre-ui-kit 0.0.190 → 0.0.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -629,6 +629,8 @@ interface CustomDropdownProps {
629
629
  itemTextStyle?: TextStyle;
630
630
  onValueChange?: (value: string) => void;
631
631
  itemContainerStyle?: ViewStyle;
632
+ keepPlaceholderOnFocus?: boolean;
633
+ selectedItemTextStyle?: TextStyle;
632
634
  menuContainerStyle?: ViewStyle;
633
635
  activeColor?: string;
634
636
  renderRightIcon?: (visible?: boolean) => JSX.Element | null | undefined;
package/lib/index.js CHANGED
@@ -3418,7 +3418,9 @@ const CustomDropdown = (props) => {
3418
3418
  onValueChange,
3419
3419
  itemContainerStyle,
3420
3420
  menuContainerStyle,
3421
- activeColor
3421
+ activeColor,
3422
+ keepPlaceholderOnFocus = false,
3423
+ selectedItemTextStyle
3422
3424
  } = props;
3423
3425
  const [value, setValue] = React.useState(defaultValue);
3424
3426
  const [isFocus, setIsFocus] = React.useState(false);
@@ -3446,6 +3448,22 @@ const CustomDropdown = (props) => {
3446
3448
  onValueChange(newValue);
3447
3449
  }
3448
3450
  };
3451
+ const renderItem = (item) => {
3452
+ const isSelected = item[valueField] === value;
3453
+ return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: [styles$7.itemContainer, itemContainerStyle] }, /* @__PURE__ */ React__default["default"].createElement(
3454
+ reactNative.Text,
3455
+ {
3456
+ style: [
3457
+ styles$7.itemText,
3458
+ itemTextStyle,
3459
+ // Apply itemTextStyle to all items
3460
+ isSelected && selectedItemTextStyle
3461
+ // Apply selectedItemTextStyle to the selected item
3462
+ ]
3463
+ },
3464
+ item[labelField]
3465
+ ));
3466
+ };
3449
3467
  return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: [styles$7.container, containerStyle] }, label && renderLabel(), /* @__PURE__ */ React__default["default"].createElement(
3450
3468
  reactNativeElementDropdown.Dropdown,
3451
3469
  {
@@ -3461,13 +3479,14 @@ const CustomDropdown = (props) => {
3461
3479
  data: data ?? [],
3462
3480
  labelField,
3463
3481
  valueField,
3464
- placeholder: !isFocus ? placeholder : "",
3482
+ placeholder: keepPlaceholderOnFocus || !isFocus ? placeholder : "",
3465
3483
  value,
3466
3484
  onFocus: () => setIsFocus(true),
3467
3485
  onBlur: () => setIsFocus(false),
3468
3486
  onChange: handleValueChange,
3469
3487
  iconColor,
3470
3488
  dropdownPosition: "bottom",
3489
+ renderItem,
3471
3490
  itemTextStyle,
3472
3491
  containerStyle: menuContainerStyle,
3473
3492
  activeColor,
@@ -3510,6 +3529,13 @@ const styles$7 = reactNative.StyleSheet.create({
3510
3529
  },
3511
3530
  itemListStyle: {
3512
3531
  maxHeight: verticalScale(150)
3532
+ },
3533
+ itemContainer: {
3534
+ paddingVertical: verticalScale(8),
3535
+ paddingHorizontal: horizontalScale(12)
3536
+ },
3537
+ itemText: {
3538
+ fontSize: verticalScale(14)
3513
3539
  }
3514
3540
  });
3515
3541