Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 155x 2998x 2998x 3193x 155x | import { WithFetching } from "@containers/WithFetching";
import * as React from "react";
import { Controller, useFormContext } from "react-hook-form";
import GiveSelect, { GiveSelectProps } from "@shared/GiveInputs/GiveSelect";
type HFGiveSelectProps = GiveSelectProps & {
name: string;
isFetchindData?: boolean;
isError?: boolean;
errorsMessage?: string;
focusViewColor?: string;
withSearchBar?: boolean;
hideError?: boolean;
};
const HFGiveSelect = React.forwardRef(
(
{
name,
helperText,
isFetchindData = false,
isError = false,
errorsMessage,
withSearchBar,
hideError = false,
...props
}: HFGiveSelectProps,
ref,
) => {
const { control } = useFormContext();
return (
<Controller
name={name}
control={control}
render={({
field: { ref: inputRef, ...rest },
fieldState: { error },
}) => (
<WithFetching
errorsMessage={errorsMessage}
isFetching={isFetchindData}
isError={isError}
>
<GiveSelect
withSearchBar={withSearchBar}
inputRef={inputRef}
{...rest}
error={hideError ? false : !!error}
helperText={
helperText ? helperText : hideError ? "" : error?.message
}
{...props}
ref={ref}
/>
</WithFetching>
)}
/>
);
},
);
HFGiveSelect.displayName = "HFGiveSelect";
export default HFGiveSelect;
|