From 450ebbea0c1ec459f0ebf82b6a3be3fed2f442bc Mon Sep 17 00:00:00 2001 From: HUI Date: Tue, 17 Nov 2020 15:38:18 +0800 Subject: [PATCH] fix: ts build error --- example/agora.config.json | 5 +++++ example/src/App.tsx | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 example/agora.config.json diff --git a/example/agora.config.json b/example/agora.config.json new file mode 100644 index 0000000..f95ac6d --- /dev/null +++ b/example/agora.config.json @@ -0,0 +1,5 @@ +{ + "appId": YOUR_APP_ID, + "channelId": "APIExample", + "token": YOUR_TOEKN +} diff --git a/example/src/App.tsx b/example/src/App.tsx index 8d85d05..1747c35 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -3,6 +3,8 @@ import { PermissionsAndroid, StyleSheet, Text, View } from 'react-native'; import AgoraRawdata from 'react-native-agora-rawdata'; import Agora, { RtcLocalView, RtcRemoteView } from 'react-native-agora'; +const config = require('../../../agora.config.json'); + export default function App() { const [joined, setJoined] = React.useState(); @@ -12,7 +14,7 @@ export default function App() { PermissionsAndroid.PERMISSIONS.CAMERA, PermissionsAndroid.PERMISSIONS.RECORD_AUDIO, ]); - const agora = await Agora.create(YOUR_APP_ID); + const agora = await Agora.create(config.appId); agora.addListener('JoinChannelSuccess', () => { setJoined(true); }); @@ -23,7 +25,7 @@ export default function App() { await AgoraRawdata.registerVideoFrameObserver( await agora.getNativeHandle() ); - await agora.joinChannel(undefined, '123', undefined, 456); + await agora.joinChannel(config.token, config.channelId, undefined, 456); }; // eslint-disable-next-line jest/no-disabled-tests