flemingvincent / expo-supabase-starter

A comprehensive starter project for developing Expo applications with Supabase as the backend.
MIT License
223 stars 30 forks source link

Supabase not working with React Expo Web #25

Closed CompileConnected closed 2 months ago

CompileConnected commented 2 months ago

im still searching why it's not working with supabase, did you have similiar problem?

Screenshot 2024-07-01 at 15 16 52
CompileConnected commented 2 months ago

Sorry, mate i found the solutions.

add supabase.web.ts to config folder

import AsyncStorage from "@react-native-async-storage/async-storage";
import { createClient } from "@supabase/supabase-js";

const supabaseUrl = process.env.EXPO_PUBLIC_API_URL as string;
const supabaseKey = process.env.EXPO_PUBLIC_API_KEY as string;

export const supabase = createClient(supabaseUrl, supabaseKey,  {localStorage: AsyncStorage});

it will automatically know what to import for web