@nativetail/ui 0.1.6 → 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.
|
3
|
+
"version": "0.1.8",
|
4
4
|
"description": "",
|
5
5
|
"main": "src/index.ts",
|
6
6
|
"scripts": {},
|
@@ -29,6 +29,7 @@
|
|
29
29
|
"@hookform/resolvers": "^3.6.0",
|
30
30
|
"@nativetail/core": "^0.0.6",
|
31
31
|
"@shopify/flash-list": "^1.7.1",
|
32
|
+
"@sinclair/typebox": "^0.33.7",
|
32
33
|
"countries-list": "^3.1.0",
|
33
34
|
"expo-blur": "^13.0.2",
|
34
35
|
"expo-linear-gradient": "~13.0.2",
|
@@ -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>;
|
@@ -61,13 +61,9 @@ export function FormBuilder<T extends z.ZodRawShape>({
|
|
61
61
|
<View className={cn("gap-4", containerClassname)}>
|
62
62
|
<View className={cn("flex-1 gap-2", inputContainerClassname)}>
|
63
63
|
{keys.map((inputKey) => {
|
64
|
-
const Input = inputs[inputKey]
|
65
|
-
type: "text",
|
66
|
-
props: {
|
67
|
-
placeholder: inputKey,
|
68
|
-
},
|
69
|
-
};
|
64
|
+
const Input = inputs[inputKey];
|
70
65
|
const Render = Input.render;
|
66
|
+
if (!Input) return null;
|
71
67
|
if (!Render) {
|
72
68
|
return (
|
73
69
|
<InputComponent
|
@@ -87,7 +83,9 @@ export function FormBuilder<T extends z.ZodRawShape>({
|
|
87
83
|
className="w-full"
|
88
84
|
children={"Submit"}
|
89
85
|
{...submitButtonProps}
|
90
|
-
onPress={form.handleSubmit(
|
86
|
+
onPress={form.handleSubmit((data) => {
|
87
|
+
onSubmit?.(data, form.reset);
|
88
|
+
}, onError)}
|
91
89
|
isLoading={isSubmitting}
|
92
90
|
/>
|
93
91
|
</View>
|