Skip to content

Commit

Permalink
fix(expo): use expo-crypto to generate UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
mrevanzak committed Nov 26, 2023
1 parent 9b939f6 commit ed35d3e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"superjson": "1.13.1",
"tus-js-client": "^3.1.1",
"use-tus": "^0.7.3",
"uuid": "^9.0.1",
"zod": "^3.21.4",
"zustand": "^4.4.6"
},
Expand Down
4 changes: 2 additions & 2 deletions apps/expo/src/components/ProductForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Text,
View,
} from "react-native-ui-lib";
import { randomUUID } from "expo-crypto";
import { useLocalSearchParams, useRouter } from "expo-router";
import Input from "@/components/forms/Input";
import Picker from "@/components/forms/Picker";
Expand All @@ -19,7 +20,6 @@ import { useUser } from "@clerk/clerk-expo";
import { MaterialCommunityIcons } from "@expo/vector-icons";
import { zodResolver } from "@hookform/resolvers/zod";
import { FormProvider, useForm } from "react-hook-form";
import { v4 } from "uuid";
import { z } from "zod";

const schema = z.object({
Expand Down Expand Up @@ -64,7 +64,7 @@ export default function ProductForm({ edit }: ProductFormProps) {
});
const { handleSubmit, reset } = methods;
const onSubmit = handleSubmit(async (data) => {
const productId = edit ? productDetail?.id : v4();
const productId = edit ? productDetail?.id : randomUUID();
const filePath = `${user?.id}/${productId}.png`;

const { error } = await onUpload("products", filePath);
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ed35d3e

Please sign in to comment.