GiftedChat 中出现错误,警告:超出最大更新深度

问题描述 投票:0回答:1

我想使用

react-native-gifted-chat
,然后当我尝试调用它时,它不断收到此错误:

Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either
doesn't have a dependency array, or one of the dependencies changes on
every render.
    in GiftedChat (created by Chat)
    in Chat (created by SceneView)
    in StaticContainer
    in EnsureSingleNavigator (created by SceneView)
    in SceneView (created by CardContainer)
    in RCTView (created by View)
    in View (created by CardContainer)
    in RCTView (created by View)
    in View (created by CardContainer)
    in RCTView (created by View)
    in View
    in CardSheet (created by Card)
    in RCTView (created by View)
    ...
import React from "react";
import { GiftedChat } from 'react-native-gifted-chat';

export default function Chat() {
  return (
    <View>
      <GiftedChat />
    </View>
  )
}

如何解决这个问题?

react-native expo react-native-gifted-chat
1个回答
0
投票

正确阅读文档并添加所有必要的道具以使其正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.