crypblizz
05/14/2024, 2:19 PMimport { Pressable, StyleSheet, Text, View } from "react-native";
import Vapi from "@vapi-ai/react-native";
import { useEffect } from "react";
export default function HomeScreen() {
const ASSISTANT_ID = "XXX";
const VAPI_PUBLIC_KEY = "XXX";
let vapi: any;
useEffect(() => {
vapi = new Vapi(VAPI_PUBLIC_KEY);
}, [vapi]);
// const handlePress = async () => {
// vapi.start(ASSISTANT_ID);
// };
return (
<View className="flex-1 items-center justify-center bg-white">
<Text className="text-xl">Vapi</Text>
<Pressable
className="bg-blue-500 p-2 mt-4 rounded-md"
onPress={() => {
console.log("press");
}}
>
<Text className="text-white">Press me</Text>
</Pressable>
</View>
);
}Vapi Support
05/14/2024, 2:19 PMVapi Support
05/14/2024, 2:19 PMTypeError: Super expression must either be null or a function error, please check the following:
1. **Ensure Correct Dependencies**: Make sure you have the required dependencies and versions correctly installed. Here is an example of dependencies from a working setup:
json
{
"dependencies": {
"react": "18.2.0",
"react-native": "0.73.6",
"@vapi-ai/react-native": "^0.1.2"
},
"devDependencies": {
"@babel/core": "^7.20.0"
}
}
2. **Check Your Code**: Ensure that the vapi instance is being created correctly without any conditional dependency:Vapi Support
05/14/2024, 2:19 PMjavascript
import { Pressable, StyleSheet, Text, View } from "react-native";
import Vapi from "@vapi-ai/react-native";
import { useEffect } from "react";
export default function HomeScreen() {
const ASSISTANT_ID = "XXX";
const VAPI_PUBLIC_KEY = "XXX";
let vapi = null;
useEffect(() => {
vapi = new Vapi(VAPI_PUBLIC_KEY);
}, []);
return (
<View style={styles.container}>
<Text style={styles.text}>Vapi</Text>
<Pressable
style={styles.button}
onPress={() => {
console.log("press");
}}
>
<Text style={styles.buttonText}>Press me</Text>
</Pressable>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'white',
},
text: {
fontSize: 24,
},
button: {
backgroundColor: 'blue',
padding: 16,
marginTop: 16,
borderRadius: 8,
},
buttonText: {
color: 'white',
}
});
3. **Review Any Recent Changes**: If your setup was working previously, review any recent changes to your project or its dependencies.
For more specific debugging, you might want to check the official [Vapi React Native SDK]() repository for any recent updates or issues.crypblizz
05/14/2024, 2:19 PMAlso including my package.json
```{
"name": "vapi_ai_mre",
"version": "1.0.0",
"main": "app/App.tsx",
"scripts": {
"start": "expo start",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"@react-native-async-storage/async-storage": "1.23.3",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"@supabase/supabase-js": "^2.43.1",
"expo": "~51.0.2",
"expo-apple-authentication": "~6.4.1",
"expo-status-bar": "~1.12.1",
"nativewind": "^2.0.11",
"react": "18.2.0",
"react-native": "0.74.1",
"react-native-elements": "^3.4.3",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "3.31.1",
"react-native-url-polyfill": "^2.0.0",
"@vapi-ai/react-native": "^0.1.7",
"@config-plugins/react-native-webrtc": "8.0.0",
"@daily-co/config-plugin-rn-daily-js": "0.0.4",
"@daily-co/react-native-daily-js": "0.59.0",
"@daily-co/react-native-webrtc": "118.0.3-daily.1",
"react-native-background-timer": "^2.4.1",
"react-native-get-random-values": "^1.11.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@types/react": "~18.2.45",
"react-native-dotenv": "^3.4.11",
"tailwindcss": "3.3.2",
"typescript": "^5.1.3"
},
"private": true
}
```crypblizz
05/14/2024, 2:20 PMVapi Support
05/14/2024, 2:20 PMSahil
05/14/2024, 2:26 PMPorter
05/24/2024, 5:35 PMSahil
05/24/2024, 5:39 PMAli
02/17/2025, 5:57 PMAli
02/17/2025, 5:58 PMKyle
02/18/2025, 6:47 PM