[React native expo + Express] Warning: TypeError: (maybeServerData ?? data)?.find is not a function

im using react native expo + express as backend services and im facing issues with the uploadButton.


uploadButton.tsx
import { useImageUploader } from "@/libs/uploadthing";
import { openSettings } from "expo-linking"; 

export default function UploadButton() {
  const { openImagePicker, isUploading } = useImageUploader("selfieUploader", {
    onClientUploadComplete: () => Alert.alert("Upload Completed"),

    onUploadError: (error) => Alert.alert("Upload Error", error.message),
  });

  return (
    <View>
      <Pressable
        style={styles.button}
        disabled={isUploading}
        onPress={() => {
          openImagePicker({
            source: "camera", // or "camera"
            onInsufficientPermissions: () => {
              Alert.alert(
                "No Permissions",
                "You need to grant permission to your Photos to use this",
                [
                  { text: "Dismiss" },
                  { text: "Open Settings", onPress: openSettings },
                ]
              );
            },
          });
        }}
      >
        <Text>{isUploading ? "Uploading..." : "Select Image"}</Text>
      </Pressable>
    </View>
  );
}

libs/uploadThing.ts
import { generateReactNativeHelpers } from "@uploadthing/expo";
import type { OurFileRouter } from "../../server/src/routes/fileUploadRoute";

export const { useImageUploader, useDocumentUploader } =
  generateReactNativeHelpers<OurFileRouter>({
    url: process.env.EXPO_PUBLIC_BACKEND_URL || "http://localhost:8000",
  });
Was this page helpful?