@nativetail/ui 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativetail/ui",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {},
@@ -33,7 +33,7 @@ export type FormBuilderProps<
33
33
  >;
34
34
  containerClassname?: string;
35
35
  submitButtonProps?: ComponentPropsWithoutRef<typeof Button>;
36
- onSubmit?: (values: IValues) => void;
36
+ onSubmit?: (values: IValues, reset?: () => void) => void;
37
37
  onError?: (values: Partial<Record<keyof T, any>>) => void;
38
38
  isSubmitting?: boolean;
39
39
  defaultValues?: DefaultValues<IValues>;
@@ -83,7 +83,9 @@ export function FormBuilder<T extends z.ZodRawShape>({
83
83
  className="w-full"
84
84
  children={"Submit"}
85
85
  {...submitButtonProps}
86
- onPress={form.handleSubmit(onSubmit, onError)}
86
+ onPress={form.handleSubmit((data) => {
87
+ onSubmit?.(data, form.reset);
88
+ }, onError)}
87
89
  isLoading={isSubmitting}
88
90
  />
89
91
  </View>