voximplant / react-native-voximplant

Voximplant mobile SDK for React Native (iOS/Android)
http://voximplant.com
205 stars 39 forks source link

Render Error : null is not an object (evaluating 'ClientModule.init') #165

Open Yashg2001 opened 2 years ago

Yashg2001 commented 2 years ago

So, I was trying to get instance from voximplant and I encountered this problem. Any solution to this problem?

This is my code: import {Voximplant} from 'react-native-voximplant'; import {useNavigation} from '@react-navigation/core'; import React, {useState, useEffect} from 'react'; import { View, TextInput, StyleSheet, Pressable, Text, Alert, } from 'react-native';

import {APP_NAME, ACC_NAME} from '../../Constants';

const LoginScreen = () => { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const voximplant = Voximplant.getInstance(); const navigation = useNavigation();

useEffect(() => { const connect = async () => { const status = await voximplant.getClientState(); if (status === Voximplant.ClientState.DISCONNECTED) { await voximplant.connect(); } else if (status === Voximplant.ClientState.LOGGED_IN) { redirectHome(); } };

connect();

}, []);

const signIn = async () => { try { const fqUsername = ${username}@${APP_NAME}.${ACC_NAME}.voximplant.com; await voximplant.login(fqUsername, password);

  redirectHome();
}

image

pe1ros commented 2 years ago

Hello @Yashg2001

Do you use Expo or pure react-native flow?

Yashg2001 commented 2 years ago

Hello @Yashg2001

Do you use Expo or pure react-native flow?

Pure react-native

pe1ros commented 2 years ago

Hello @Yashg2001

Please try to do these steps: 1) In YouRNProject/android directory run command ./gradlew clean 2) In YouRNProject directory run command rm -rf node_modules 3) Check that you have last version react-native-voximplant 4) Install again node_modules (yarn install or npm install) 5) Run your project again

badal-ag commented 2 years ago

Hello @Yashg2001

Do you use Expo or pure react-native flow?

Hey, I am using expo but facing the same issue. Installed the node modules again too. But, the error still persists.

pe1ros commented 2 years ago

Hello @badal-ag

Expo provides two workflows (Managed and Bare) Voximplant React Native SDK uses native modules, that's why React Native application (based on Expo) should use only Bare workflow. It means you need to "eject". If you are using Expo SDK 40 or below, please follow the instruction on this page For Expo SDK 41, please follow the instruction on this page

Please consider that moving to the bare workflow may cause the issues such as: