标签: react-native-gifted-chat

不变违规:尝试注册两个同名的视图 RNCSafeAreaProvider,js 引擎:hermes

当尝试从“react-native-gifted-chat”导入和使用 GiftedChat 组件时,我收到此错误:

Invariant Violation: Tried to register two views with the same name RNCSafeAreaProvider, js engine: hermes

我已经尝试过这里列出的几件事。人们似乎对与“react-native-safe-area-context”相关的其他软件包也有类似的问题。

  • 我已经更新了“react-native-safe-area-context”(本文发布时为 4.2.5)
  • 卸载了“react-native-safe-area-context”
    • rm 节点模块
    • rm -rf ios/Pods && ios/Podfile.lock
    • rm package-lock.json
    • npm 安装
    • 重新安装 pods -> npx pod-install
    • 再次build项目还是同样的错误

我没有使用 expo,但我使用的是 React Native CLI。

在我看来,问题出在“react-native-gifted-chat”上。

细节:

  • “反应本机”:“0.66.4”
  • “反应本机安全区域上下文”:“^3.1.9”
  • “react-native-gifted-chat”:“^1.0.0”

如果有人有任何想法或见解,我将不胜感激。如果我找到解决方案,我会将其作为评论发布。

react-native react-native-gifted-chat react-native-safe-area-view

7
推荐指数
1
解决办法
3478
查看次数

如何在 React Native 0.61 中自定义 react-native-gifted-chat

只是想分享。

我发现很难为这个包自定义默认 UI。官方文档没有那么有用。

幸运的是,我能够解决它。

查看答案

javascript react-native react-native-gifted-chat

6
推荐指数
1
解决办法
6632
查看次数

React Native Gifted Chat 附加多个图像

我正在为我的一个项目使用 React Native Gifted Chat。我知道有一个图像选项可用,我可以将单个图像附加到聊天中。但是,有没有办法可以将多个图像附加到单个聊天中?

react-native react-native-gifted-chat

5
推荐指数
1
解决办法
903
查看次数

你如何在气泡聊天下渲染物品时间反应原生天才聊天?

我使用 React Native Gifted Chat 创建 UI 聊天,我想在气泡聊天下渲染聊天时间和符号。

我想要像这样的图像: 在此处输入图片说明

我曾尝试使用渲染消息,但没有成功,请帮忙。

javascript chat react-native react-native-gifted-chat

3
推荐指数
1
解决办法
2640
查看次数

如何更改时间文本颜色?

我使用react-native-gifted-chat 进行聊天。我想更改时间字体颜色。我按照医生说的改变了它,但它没有改变。我希望两个时间的颜色都是黑色。使用“react-native-gifted-chat”:“^0.16.1”

  const renderTime = (props) => {
    return (
      <Time
      {...props}
        textStyle={{
          left: {
            color: 'black',
          },
          right: {
            color: 'black',
          },
        }}
      />
    );
  };
Run Code Online (Sandbox Code Playgroud)

react-native react-native-gifted-chat

3
推荐指数
1
解决办法
1979
查看次数

你如何在 react-native-gifted-chat 中自动聚焦输入框

我正在使用有天赋的聊天库,并希望在初始渲染时使用键盘自动聚焦于输入。我看到有一个命令式函数,focusTextInput但我该如何调用它?

<GiftedChat
  {...props}
  messages={this.state.messages}
  ref={(chat) => this.chat = chat }
  onSend={messages => this.onSend(messages)}
  user={{
      _id: 1,
  }}
/>
Run Code Online (Sandbox Code Playgroud)

Github 仓库

我尝试设置ref并直接在 do mount 上调用它,但这没有用。

react-native react-native-gifted-chat

2
推荐指数
1
解决办法
1611
查看次数

您如何修改他人的图书馆/模块?

我想将Card组件添加到此模块:https : //snack.expo.io/@xcarpentier/gifted-chat(演示)

例如,如果onLongPress()在气泡消息上使用,我希望显示其他信息(在气泡消息的正下方,作为小卡片,例如Tinder卡)。

我怎么做?我是否需要克隆源代码,然后对其进行修改以适合我的需要?

react-native react-native-gifted-chat

2
推荐指数
1
解决办法
1842
查看次数

1
推荐指数
1
解决办法
668
查看次数

如何在单击气泡触摸时删除消息?React Native 天才聊天库

我已经使用天才聊天库在 React Native 中开发了聊天视图。但我想在点击聊天气泡时执行删除操作。

我尝试过自定义 renderCustomView 、lightboxProps 和 onLongPress 道具,但都没有工作。

chat react-native react-native-gifted-chat

0
推荐指数
1
解决办法
1407
查看次数