
In react to native
import { Appwrite } from 'appwrite';// appwrite import statement import appwriteConfig from './appwrite';// import statement
//Initializing Appwrite const appwrite = new Appwrite(); appwrite.setEndpoint(appwriteConfig.endpoint).setProject(appwriteConfig.project);
This code works in .jsx file but not working in .tsx

If i do import { Appwrite } from ‘appwrite’
It’s works in jsx file format But did not works in tsx file type

Did it give you any errors?

Do you have your tsconfig setup correctly?

import React from 'react'; import { Appwrite } from 'appwrite'; import appwriteConfig from '../src/appwrite/AppwriteConfig'; import { View, Text, Image, StyleSheet, TouchableOpacity, Linking } from 'react-native'; import Colors from '@/constants/Colors'; import { useRouter } from 'expo-router'; import welcomeImage from '../assets/images/icon.png'; const welcome_image = Image.resolveAssetSource(welcomeImage).uri;
const appwrite = new Appwrite(); appwrite.setEndpoint(appwriteConfig.endpoint).setProject(appwriteConfig.project);
const welcomeScreen = () => {
const router = useRouter();
const openPrivacyPolicy = () => {
Linking.openURL('https://quickgram.in');
};
const openTermsOfService = () => {
Linking.openURL('https://quickgram.in');
};
const handleAgreeAndContinue = () => {
router.push(./authentication/phonenumber/VerifyPhoneScreen
);
};
return (
<View style={styles.container}>
<Image source={{ uri: welcome_image }} style={styles.welcome} />
<Text style={styles.headline}>Welcome to Quickgram</Text>
<Text style={styles.description}>
Read our{' '}
<Text style={styles.link} onPress={openPrivacyPolicy}>
Privacy Policy
</Text>
. {'Tap "Agree & Continue" to accept the '}
<Text style={styles.link} onPress={openTermsOfService}>
Terms of Service
</Text>
.
</Text>
<TouchableOpacity style={styles.button} onPress={handleAgreeAndContinue} >
<Text style={styles.buttonText}>Agree & Continue</Text>
</TouchableOpacity>
</View>
); };
const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20, backgroundColor: '#fff', }, welcome: { width: '80%', height: 280, borderRadius: 60, marginBottom: 80, }, headline: { fontSize: 24, fontWeight: 'bold', marginVertical: 20, }, description: { fontSize: 14, textAlign: 'center', marginBottom: 80, color: Colors.gray, }, link: { color: Colors.primary, }, button: { width: '100%', alignItems: 'center', }, buttonText: { color: Colors.primary, fontSize: 22, fontWeight: '500', }, });
export default welcomeScreen;

tsconfig
{ "extends": "expo/tsconfig.base", "compilerOptions": { "strict": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "paths": { "@/": [ "./" ] } }, "include": [ "/*.ts", "/.tsx", ".expo/types/**/.ts", "expo-env.d.ts" , "app/index.tsx", "app/_layout.tsx" ] }

AppwriteConfig.tsx
import { Client, Account, Databases, Functions, Teams } from 'appwrite';
export const API_ENDPOINT = 'https://cloud.appwrite.io/v1' export const PROJECT_ID = 'my_project_id'
const client = new Client() .setEndpoint(API_ENDPOINT) .setProject(PROJECT_ID);
export const account = new Account(client);
export default client;


@Kenny @Moderator can you help me
i am new to appwrite

shouldn't appwriteconfig.tsx be
import { Client, Account, ID } from 'react-native-appwrite';
You are using react-native right?

Indeed appwrite do not export Appwrite
, you should do import appwrite from "appwrite"

Why is your appwrite config a tsx file, should it not be a ts file?

should be a .ts file yeah

yes i am using react native

yeah i did that

Why are you doing this here
const appwrite = new Appwrite();
appwrite.setEndpoint(appwriteConfig.endpoint).setProject(appwriteConfig.project);
Is this not taken care of in your AppwriteConfig file?

I think you could benefit from reading the docs a bit more and following the getting started tutorial.

https://www.sitepoint.com/appwrite-react-user-authentication/
i am following this guide for auth

yeah
Recommended threads
- Appwrite REST API Docs in LLM-Friendly F...
Is there a version of the Appwrite REST API documentation available in a format suitable for LLM vector embedding? Specifically, I’m referring to the following ...
- OpenAI Whisper on Appwrite Sites
Hey guys, just wondering if I can serve an OpenAI Whisper AI on appwrite / appwrite sites. tiny model is like ~40-50MB
- Google Oauth help
this error pops up (TypeError: (0 , {imported module [project]/src/lib/auth.ts [app-rsc] (ecmascript)}.signIn) is not a function) but cant find a way to solve i...
