react-native-voximplant icon indicating copy to clipboard operation
react-native-voximplant copied to clipboard

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

Open Yashg2001 opened this issue 2 years ago • 5 comments

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

Yashg2001 avatar Jul 10 '22 11:07 Yashg2001

Hello @Yashg2001

Do you use Expo or pure react-native flow?

pe1ros avatar Jul 12 '22 16:07 pe1ros

Hello @Yashg2001

Do you use Expo or pure react-native flow?

Pure react-native

Yashg2001 avatar Jul 13 '22 01:07 Yashg2001

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

pe1ros avatar Jul 14 '22 09:07 pe1ros

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.

badal-ag avatar Jul 31 '22 04:07 badal-ag

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:

  •   You need Xcode and Android Studio to develop or build the native code.
    
  •   React native version should be upgraded manually.
    
  •   and others described here => https://docs.expo.dev/expokit/eject/#should-i-eject-to-expokit
    

pe1ros avatar Aug 01 '22 15:08 pe1ros