Giter Site home page Giter Site logo

tencentcloud / chat-uikit-react Goto Github PK

View Code? Open in Web Editor NEW
65.0 65.0 12.0 1.76 MB

Build In-App Chat & Audio/Video Call & Live Streaming in minutes with UIKit components for React

License: Apache License 2.0

JavaScript 1.08% TypeScript 87.33% SCSS 11.59%

chat-uikit-react's Issues

demo 出现以下错误

ant design pro 接入demo时,报以下错误

Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.

import React, { useEffect, useState } from 'react';
import { TUIKit } from '@tencentcloud/chat-uikit-react';
import '@tencentcloud/chat-uikit-react/dist/cjs/index.css';
import TIM, { ChatSDK } from 'tim-js-sdk/tim-js-friendship';
import TIMUploadPlugin from 'tim-upload-plugin';


const init = async () => {
   return new Promise((resolve, reject) => {
      const tim = TIM.create({ SDKAppID: 0 });
      tim?.registerPlugin({ 'tim-upload-plugin': TIMUploadPlugin });
      const onReady = () => { resolve(tim); };
      tim.on(TIM.EVENT.SDK_READY, onReady);
      tim.login({
         userID: 'xxx',
         userSig: 'xxx',
      });
   });
}

export function SampleChat() {
   const [tim, setTim] = useState<ChatSDK>();
   useEffect(() => {
      (async ()=>{
         const tim = await init()
         setTim(tim)
      })()
   }, [])

   return (
           <div style={{height: '100vh',width: '100vw'}}>
              <TUIKit tim={tim}></TUIKit>
           </div>
   );
}

process.env throw an error when searching to add a contact

It's not working when searching to add a contact using Vite.

Error:

useConversationCreate.js:1 Uncaught (in promise) ReferenceError: process is not defined
    at useConversationCreate.js:1:2258
    at step (tslib.es6.mjs:147:21)
    at Object.next (tslib.es6.mjs:128:51)
    at fulfilled (tslib.es6.mjs:118:56)
(anonymous) @ useConversationCreate.js:1
step @ tslib.es6.mjs:147
(anonymous) @ tslib.es6.mjs:128
fulfilled @ tslib.es6.mjs:118
Promise.then (async)
step @ tslib.es6.mjs:120
(anonymous) @ tslib.es6.mjs:121
__awaiter @ tslib.es6.mjs:117
onChange @ ConversationCreateUserSelectList.js:1
onChange @ Input.js:1
callCallback2 @ react-dom.development.js:4164
invokeGuardedCallbackDev @ react-dom.development.js:4213
invokeGuardedCallback @ react-dom.development.js:4277
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4291
executeDispatch @ react-dom.development.js:9041
processDispatchQueueItemsInOrder @ react-dom.development.js:9073
processDispatchQueue @ react-dom.development.js:9086
dispatchEventsForPlugins @ react-dom.development.js:9097
(anonymous) @ react-dom.development.js:9288
batchedUpdates$1 @ react-dom.development.js:26140
batchedUpdates @ react-dom.development.js:3991
dispatchEventForPluginEventSystem @ react-dom.development.js:9287
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay @ react-dom.development.js:6465
dispatchEvent @ react-dom.development.js:6457
dispatchDiscreteEvent @ react-dom.development.js:6430

if (process.env?.REACT_APP_ONLINE === 'TencentCloudDemo') {

There is only import.meta.env as I'm using Vite. And the process.env would have error and crash this functionality to add contact.

However, I have to pre define a process before use chat-uikit-react to make it works:

globalThis.process = globalThis.process || {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.