diff --git a/apps/frontend/src/components/launches/providers/tiktok/tiktok.provider.tsx b/apps/frontend/src/components/launches/providers/tiktok/tiktok.provider.tsx
index 9ec2c06d..6f2ca47c 100644
--- a/apps/frontend/src/components/launches/providers/tiktok/tiktok.provider.tsx
+++ b/apps/frontend/src/components/launches/providers/tiktok/tiktok.provider.tsx
@@ -130,6 +130,7 @@ const TikTokSettings: FC<{ values?: any }> = (props) => {
Allow User To:
= (props) => {
/>
= (props) => {
= (props) => {
-
+
= (props) => {
This video will be classified as Brand Organic.
,
- HTMLInputElement
- > & {
- error?: any;
- extraForm?: RegisterOptions;
+export const Checkbox = forwardRef<
+ null,
+ {
+ checked?: boolean;
disableForm?: boolean;
- label: string;
- name: string;
- hideErrors?: boolean;
+ name?: string;
+ className?: string;
+ label?: string;
+ onChange?: (event: { target: { name?: string; value: boolean } }) => void;
+ variant?: 'default' | 'hollow';
}
-> = (props) => {
- const {
- label,
- className,
- hideErrors,
- disableForm,
- error,
- extraForm,
- name,
- ...rest
- } = props;
+>((props, ref: any) => {
+ const { checked, className, label, disableForm, variant } = props;
const form = useFormContext();
+ const register = disableForm ? {} : form.register(props.name!);
+
+ const watch = disableForm
+ ? undefined
+ : useWatch({
+ name: props.name!,
+ });
+
+ const [currentStatus, setCurrentStatus] = useState(watch || checked);
+ const changeStatus = useCallback(() => {
+ setCurrentStatus(!currentStatus);
+ props?.onChange?.({ target: { name: props.name!, value: !currentStatus } });
+ if (!disableForm) {
+ // @ts-ignore
+ register?.onChange?.({
+ target: { name: props.name!, value: !currentStatus },
+ });
+ }
+ }, [currentStatus]);
return (
-
-
+
+
+ {currentStatus && (
+
+ )}
+
+ {!!label &&
{label}
}
);
-};
\ No newline at end of file
+});