AgoraIO-Community / VideoUIKit-ReactNative

A React Native package to simply integrate Agora Video Calling or Live Video Streaming to your app with just a few lines of code.
MIT License
93 stars 43 forks source link

Error when ending call #133

Closed xeroxoid closed 11 months ago

xeroxoid commented 1 year ago

Target device: (Note: simulators are not supported for running the UIKit)

App Info

Describe the issue When ending call an error appears. Using the example code from your UIKit example in react native, when ending a call the following error appears:

Warning: Cannot update a component (`App`) while rendering a different component (`RtcConfigure`). To locate the bad setState() call inside `RtcConfigure`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render

My code is as follows:

import React, { useEffect, useState } from 'react';
import AgoraUIKit from 'agora-rn-uikit';
import { Text, View } from 'react-native';

const appId = 'APP_ID_HERE';
const channel = 'Test';
const token = 'TOKEN_HERE';

const connectionData = {
  appId,
  channel,
  token,
};

const Call = () => {
  const [videoCall, setVideoCall] = useState(true);

  const callbacks = {
    EndCall: () => setVideoCall(false),
  };

  return videoCall ? (
    <AgoraUIKit
      settings={{
        disableRtm: true,
      }}
      connectionData={connectionData}
      rtcCallbacks={callbacks}
    />
  ) : (
    <Text onPress={() => setVideoCall(true)}>Start Call</Text>
  );
};

export default Call;

To Reproduce Steps to reproduce the behavior:

  1. Tap End Call button
  2. See error

Screenshots simulator_screenshot_55DD0F51-B52F-41E7-9859-0009AA7AA11B

Screenshot 2023-05-10 at 12 45 14

xeroxoid commented 1 year ago

Is this library being maintained? @EkaanshArora