Skip to content

Commit

Permalink
chore: change select native to include boolean value
Browse files Browse the repository at this point in the history
  • Loading branch information
suisin-deriv committed Nov 13, 2024
1 parent de4f4e1 commit 40874bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/account/src/Components/forms/form-select-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useDevice } from '@deriv-com/ui';
type TFormSelectField = TGetField & {
onItemSelection?: (item: TListItem) => void;
list_height?: string;
is_country_code_dropdown?: boolean;
};

type TSetFieldValue = (
Expand All @@ -24,6 +25,7 @@ const FormSelectField: FC<TFormSelectField> = ({
onItemSelection,
placeholder,
list_height,
is_country_code_dropdown = false,
}) => {
const { isDesktop } = useDevice();
const onSelect =
Expand All @@ -47,6 +49,7 @@ const FormSelectField: FC<TFormSelectField> = ({
disabled={disabled}
error={touched ? error : undefined}
use_text
is_country_code_dropdown={is_country_code_dropdown}
data-testid={`dt_${field.name}`}
/>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ const PersonalDetailsForm = observer(() => {
label={localize('Code*')}
name='calling_country_code'
list_items={formatted_countries_list_for_core}
is_country_code_dropdown
onItemSelection={country_list => {
setFieldValue(
'calling_country_code',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type TSelectNative = {
should_show_empty_option?: boolean;
suffix_icon?: string;
data_testid?: string;
is_country_code_dropdown?: boolean;
hide_selected_value?: boolean;
hide_top_placeholder?: boolean;
value?: string | number;
Expand Down Expand Up @@ -101,6 +102,7 @@ const SelectNative = ({
label,
list_items,
placeholder,
is_country_code_dropdown,
should_hide_disabled_options = true,
should_show_empty_option = true,
suffix_icon,
Expand Down Expand Up @@ -176,7 +178,7 @@ const SelectNative = ({
<SelectNativeOptions
list_items={list_items}
should_hide_disabled_options={should_hide_disabled_options}
use_text={use_text && label !== 'Code*'}
use_text={use_text && !is_country_code_dropdown}
/>
</React.Fragment>
) : (
Expand Down

0 comments on commit 40874bf

Please sign in to comment.