Skip to content

Commit

Permalink
chore: optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Jun 25, 2024
1 parent 9cd8407 commit 70f380a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions example/src/advanced/UseRTC/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
import React, { useCallback, useEffect, useState } from 'react';

import { KeyboardAvoidingView, Platform, ScrollView } from 'react-native';
import { ChannelProfileType, createAgoraRtcEngine } from 'react-native-agora';
import {
ChannelProfileType,
SDKBuildInfo,
createAgoraRtcEngine,
} from 'react-native-agora';

import {
AgoraButton,
Expand All @@ -24,7 +28,10 @@ import * as log from '../../utils/log';

export default function UseRTC() {
const [uid, setUid] = useState(Config.uid);
const [rtcVersion, setRtcVersion] = useState(Config.uid);
const [rtcVersion, setRtcVersion] = useState<SDKBuildInfo>({
version: '',
build: 0,
});
const [loginSuccess, setLoginSuccess] = useState(false);
const [initResult, setInitResult] = useState<number>(0);
const onLoginResult = useCallback((errorCode: RTM_ERROR_CODE) => {
Expand Down Expand Up @@ -126,13 +133,14 @@ export default function UseRTC() {

useEffect(() => {
let engine = createAgoraRtcEngine();
engine.initialize({
appId: Config.appId,
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
});
setRtcVersion(engine.getVersion());
console.log(6666);
// engine.initialize({
// appId: Config.appId,
// channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
// });
// setRtcVersion(engine.getVersion());
return () => {
engine.release();
// engine.release();
};
}, []);

Expand All @@ -142,7 +150,7 @@ export default function UseRTC() {
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
>
<ScrollView style={AgoraStyle.fullSize}>
<AgoraText>{`RTC version:${rtcVersion.version},build: ${rtcVersion.build}`}</AgoraText>
{/* <AgoraText>{`RTC version:${rtcVersion.version},build: ${rtcVersion.build}`}</AgoraText> */}
{loginSuccess ? (
<AgoraText>{`current login userId:\n${uid}`}</AgoraText>
) : (
Expand Down

0 comments on commit 70f380a

Please sign in to comment.