stream-chat-react-native-core 9.3.1-beta.3 → 9.3.1-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/lib/commonjs/components/Message/MessageItemView/MessageBubble.js +2 -3
  2. package/lib/commonjs/components/Message/MessageItemView/MessageBubble.js.map +1 -1
  3. package/lib/commonjs/components/Message/MessageItemView/MessageContent.js +18 -29
  4. package/lib/commonjs/components/Message/MessageItemView/MessageContent.js.map +1 -1
  5. package/lib/commonjs/components/Message/MessageItemView/MessageWrapper.js +2 -3
  6. package/lib/commonjs/components/Message/MessageItemView/MessageWrapper.js.map +1 -1
  7. package/lib/commonjs/components/Message/MessageItemView/utils/renderText.js +24 -0
  8. package/lib/commonjs/components/Message/MessageItemView/utils/renderText.js.map +1 -1
  9. package/lib/commonjs/components/Message/hooks/useMessageDeliveryData.js +10 -5
  10. package/lib/commonjs/components/Message/hooks/useMessageDeliveryData.js.map +1 -1
  11. package/lib/commonjs/components/Message/hooks/useMessageReadData.js +10 -5
  12. package/lib/commonjs/components/Message/hooks/useMessageReadData.js.map +1 -1
  13. package/lib/commonjs/version.json +1 -1
  14. package/lib/module/components/Message/MessageItemView/MessageBubble.js +2 -3
  15. package/lib/module/components/Message/MessageItemView/MessageBubble.js.map +1 -1
  16. package/lib/module/components/Message/MessageItemView/MessageContent.js +18 -29
  17. package/lib/module/components/Message/MessageItemView/MessageContent.js.map +1 -1
  18. package/lib/module/components/Message/MessageItemView/MessageWrapper.js +2 -3
  19. package/lib/module/components/Message/MessageItemView/MessageWrapper.js.map +1 -1
  20. package/lib/module/components/Message/MessageItemView/utils/renderText.js +24 -0
  21. package/lib/module/components/Message/MessageItemView/utils/renderText.js.map +1 -1
  22. package/lib/module/components/Message/hooks/useMessageDeliveryData.js +10 -5
  23. package/lib/module/components/Message/hooks/useMessageDeliveryData.js.map +1 -1
  24. package/lib/module/components/Message/hooks/useMessageReadData.js +10 -5
  25. package/lib/module/components/Message/hooks/useMessageReadData.js.map +1 -1
  26. package/lib/module/version.json +1 -1
  27. package/lib/typescript/components/Message/MessageItemView/MessageBubble.d.ts +1 -1
  28. package/lib/typescript/components/Message/MessageItemView/MessageBubble.d.ts.map +1 -1
  29. package/lib/typescript/components/Message/MessageItemView/MessageContent.d.ts.map +1 -1
  30. package/lib/typescript/components/Message/MessageItemView/MessageWrapper.d.ts +1 -1
  31. package/lib/typescript/components/Message/MessageItemView/MessageWrapper.d.ts.map +1 -1
  32. package/lib/typescript/components/Message/MessageItemView/utils/renderText.d.ts.map +1 -1
  33. package/lib/typescript/components/Message/hooks/useMessageDeliveryData.d.ts.map +1 -1
  34. package/lib/typescript/components/Message/hooks/useMessageReadData.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/components/Message/MessageItemView/MessageBubble.tsx +3 -1
  37. package/src/components/Message/MessageItemView/MessageContent.tsx +32 -36
  38. package/src/components/Message/MessageItemView/MessageWrapper.tsx +1 -1
  39. package/src/components/Message/MessageItemView/utils/renderText.tsx +31 -0
  40. package/src/components/Message/hooks/useMessageDeliveryData.ts +11 -6
  41. package/src/components/Message/hooks/useMessageReadData.ts +11 -6
  42. package/src/components/Thread/__tests__/__snapshots__/Thread.test.tsx.snap +4 -4
  43. package/src/version.json +1 -1
@@ -7,6 +7,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
7
7
  var _react = require("react");
8
8
  var _ChannelContext = require("../../../contexts/channelContext/ChannelContext");
9
9
  var _ChatContext = require("../../../contexts/chatContext/ChatContext");
10
+ var _hooks = require("../../../hooks");
10
11
  var useMessageReadData = exports.useMessageReadData = function useMessageReadData(_ref) {
11
12
  var _client$user2;
12
13
  var message = _ref.message;
@@ -14,7 +15,8 @@ var useMessageReadData = exports.useMessageReadData = function useMessageReadDat
14
15
  channel = _useChannelContext.channel;
15
16
  var _useChatContext = (0, _ChatContext.useChatContext)(),
16
17
  client = _useChatContext.client;
17
- var calculate = (0, _react.useCallback)(function () {
18
+ var messageIdRef = (0, _react.useRef)(message == null ? void 0 : message.id);
19
+ var calculate = (0, _hooks.useStableCallback)(function () {
18
20
  if (!(message != null && message.created_at)) {
19
21
  return [];
20
22
  }
@@ -23,14 +25,17 @@ var useMessageReadData = exports.useMessageReadData = function useMessageReadDat
23
25
  timestampMs: new Date(message.created_at).getTime()
24
26
  };
25
27
  return channel.messageReceiptsTracker.readersForMessage(messageRef);
26
- }, [channel, message]);
27
- var _useState = (0, _react.useState)([]),
28
+ });
29
+ var _useState = (0, _react.useState)(function () {
30
+ return calculate();
31
+ }),
28
32
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
29
33
  readBy = _useState2[0],
30
34
  setReadBy = _useState2[1];
31
- (0, _react.useEffect)(function () {
35
+ if (!!messageIdRef.current && !!(message != null && message.id) && messageIdRef.current !== message.id) {
32
36
  setReadBy(calculate());
33
- }, [calculate]);
37
+ messageIdRef.current = message.id;
38
+ }
34
39
  (0, _react.useEffect)(function () {
35
40
  var _channel$on = channel.on('message.read', function (event) {
36
41
  var _event$user, _client$user;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_ChannelContext","_ChatContext","useMessageReadData","exports","_ref","_client$user2","message","_useChannelContext","useChannelContext","channel","_useChatContext","useChatContext","client","calculate","useCallback","created_at","messageRef","msgId","id","timestampMs","Date","getTime","messageReceiptsTracker","readersForMessage","_useState","useState","_useState2","_slicedToArray2","default","readBy","setReadBy","useEffect","_channel$on","on","event","_event$user","_client$user","user","unsubscribe"],"sourceRoot":"../../../../../src","sources":["components/Message/hooks/useMessageReadData.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEO,IAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,SAArBA,kBAAkBA,CAAAE,IAAA,EAAgD;EAAA,IAAAC,aAAA;EAAA,IAA1CC,O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S,CAACjB,SAAS,CAAC,CAAC,CAAC;QACxB;MACF,CAAC,CAAC;MAPMyB,WAAW,GAAAN,WAAA,CAAXM,WAAW;IAQnB,OAAOA,WAAW;EACpB,CAAC,EAAE,CAAC7B,OAAO,EAAEI,SAAS,GAAAR,aAAA,GAAEO,MAAM,CAACyB,IAAI,qBAAXhC,aAAA,CAAaa,EAAE,CAAC,CAAC;EAEzC,OAAOW,MAAM;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_ChannelContext","_ChatContext","_hooks","useMessageReadData","exports","_ref","_client$user2","message","_useChannelContext","useChannelContext","channel","_useChatContext","useChatContext","client","messageIdRef","useRef","id","calculate","useStableCallback","created_at","messageRef","msgId","timestampMs","Date","getTime","messageReceiptsTracker","readersForMessage","_useState","useState","_useState2","_slicedToArray2","default","readBy","setReadBy","current","useEffect","_channel$on","on","event","_event$user","_client$user","user","unsubscribe"],"sourceRoot":"../../../../../src","sources":["components/Message/hooks/useMessageReadData.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,IAAMI,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,SAArBA,kBAAkBA,CAAAE,IAAA,EAAgD;EAAA,IAAAC,aAAA;EAAA,IAA1CC,OAAO,GAAAF,IAAA,CAAPE,OAAO;EAC1C,IAAAC,kBAAA,GAAoB,IAAAC,iCAAiB,EAAC,CAAC;IAA/BC,OAAO,GAAAF,kBAAA,CAAPE,OAAO;EACf,IAAAC,eAAA,GAAmB,IAAAC,2BAAc,EAAC,CAAC;IAA3BC,MAAM,GAAAF,eAAA,CAANE,MAAM;EAEd,IAAMC,YAAY,GAAG,IAAAC,aAAM,EAASR,OAAO,oBAAPA,OAAO,CAAES,EAAE,CAAC;EAEhD,IAAMC,SAAS,GAAG,IAAAC,wBAAiB,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B,CAAC,EAAE,CAAChC,OAAO,EAAEO,SAAS,GAAAX,aAAA,GAAEO,MAAM,CAAC4B,IAAI,qBAAXnC,aAAA,CAAaU,EAAE,CAAC,CAAC;EAEzC,OAAOgB,MAAM;AACf,CAAC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "9.3.1-beta.3"
2
+ "version": "9.3.1-beta.4"
3
3
  }
@@ -4,6 +4,6 @@ type SwipableMessageWrapperProps = Pick<MessageItemViewPropsWithContext, 'messag
4
4
  children: ReactNode;
5
5
  onSwipe: () => void;
6
6
  };
7
- export declare const SwipableMessageWrapper: React.MemoExoticComponent<(props: SwipableMessageWrapperProps) => React.JSX.Element>;
7
+ export declare const SwipableMessageWrapper: React.NamedExoticComponent<SwipableMessageWrapperProps>;
8
8
  export {};
9
9
  //# sourceMappingURL=MessageBubble.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/MessageItemView/MessageBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAY5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AASpE,KAAK,2BAA2B,GAAG,IAAI,CACrC,+BAA+B,EAC/B,4BAA4B,CAC7B,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,oCAAsB,2BAA2B,uBA6GlF,CAAC"}
1
+ {"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/MessageItemView/MessageBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAY5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AASpE,KAAK,2BAA2B,GAAG,IAAI,CACrC,+BAA+B,EAC/B,4BAA4B,CAC7B,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,yDA+GjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/MessageItemView/MessageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAA0B,UAAU,EAA+B,MAAM,cAAc,CAAC;AAM/F,OAAO,EACL,mBAAmB,EAEpB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,oBAAoB,EAErB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EACL,uBAAuB,EAExB,MAAM,yDAAyD,CAAC;AA+BjE,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,mBAAmB,EACjB,WAAW,GACX,aAAa,GACb,aAAa,GACb,aAAa,GACb,SAAS,GACT,qBAAqB,GACrB,aAAa,GACb,SAAS,GACT,WAAW,GACX,kBAAkB,GAClB,cAAc,GACd,YAAY,GACZ,sBAAsB,CACzB,GACC,IAAI,CACF,oBAAoB,EAClB,0BAA0B,GAC1B,6BAA6B,GAC7B,mBAAmB,GACnB,gBAAgB,CACnB,GACD,IAAI,CAAC,uBAAuB,EAAE,GAAG,CAAC,GAAG;IACnC;;OAEG;IACH,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IAEvC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAscJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,sBA2FxD,CAAC"}
1
+ {"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/MessageItemView/MessageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,UAAU,EAA0C,MAAM,cAAc,CAAC;AAMlF,OAAO,EACL,mBAAmB,EAEpB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,oBAAoB,EAErB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EACL,uBAAuB,EAExB,MAAM,yDAAyD,CAAC;AA+BjE,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,mBAAmB,EACjB,WAAW,GACX,aAAa,GACb,aAAa,GACb,aAAa,GACb,SAAS,GACT,qBAAqB,GACrB,aAAa,GACb,SAAS,GACT,WAAW,GACX,kBAAkB,GAClB,cAAc,GACd,YAAY,GACZ,sBAAsB,CACzB,GACC,IAAI,CACF,oBAAoB,EAClB,0BAA0B,GAC1B,6BAA6B,GAC7B,mBAAmB,GACnB,gBAAgB,CACnB,GACD,IAAI,CAAC,uBAAuB,EAAE,GAAG,CAAC,GAAG;IACnC;;OAEG;IACH,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IAEvC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAicJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,sBA2FxD,CAAC"}
@@ -5,5 +5,5 @@ export type MessageWrapperProps = {
5
5
  previousMessage?: LocalMessage;
6
6
  nextMessage?: LocalMessage;
7
7
  };
8
- export declare const MessageWrapper: React.MemoExoticComponent<(props: MessageWrapperProps) => React.JSX.Element | null>;
8
+ export declare const MessageWrapper: React.NamedExoticComponent<MessageWrapperProps>;
9
9
  //# sourceMappingURL=MessageWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessageWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/MessageItemView/MessageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAsB3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,WAAW,CAAC,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,cAAc,oCAAsB,mBAAmB,8BAoGlE,CAAC"}
1
+ {"version":3,"file":"MessageWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/MessageItemView/MessageWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAsB3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,WAAW,CAAC,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,cAAc,iDAoGzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderText.d.ts","sourceRoot":"","sources":["../../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e;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACjC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,iCAAiC,eAAe,sBAsC1E,CAAC;AAoBF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChC,CAAC;AA2BF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChC,CAAC"}
1
+ {"version":3,"file":"renderText.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Message/MessageItemView/utils/renderText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAqB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAiBlF,OAAO,EACL,YAAY,EAIZ,MAAM,EAGN,aAAa,EACb,KAAK,EACN,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,aAAa,CAAC;AAI9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAGnF,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAI1E,KAAK,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAE3C,eAAO,MAAM,0BAA0B,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,sBAkD/E,CAA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,CAAC;CAChC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useMessageDeliveryData.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/hooks/useMessageDeliveryData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhE,eAAO,MAAM,uBAAuB,GAAI,aAAa;IAAE,OAAO,CAAC,EAAE,YAAY,CAAA;CAAE,mBAiC9E,CAAC"}
1
+ {"version":3,"file":"useMessageDeliveryData.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/hooks/useMessageDeliveryData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhE,eAAO,MAAM,uBAAuB,GAAI,aAAa;IAAE,OAAO,CAAC,EAAE,YAAY,CAAA;CAAE,mBAqC9E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useMessageReadData.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/hooks/useMessageReadData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhE,eAAO,MAAM,kBAAkB,GAAI,aAAa;IAAE,OAAO,CAAC,EAAE,YAAY,CAAA;CAAE,mBAkCzE,CAAC"}
1
+ {"version":3,"file":"useMessageReadData.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/hooks/useMessageReadData.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhE,eAAO,MAAM,kBAAkB,GAAI,aAAa;IAAE,OAAO,CAAC,EAAE,YAAY,CAAA;CAAE,mBAsCzE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native-core",
3
3
  "description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
4
- "version": "9.3.1-beta.3",
4
+ "version": "9.3.1-beta.4",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -27,7 +27,9 @@ type SwipableMessageWrapperProps = Pick<
27
27
  onSwipe: () => void;
28
28
  };
29
29
 
30
- export const SwipableMessageWrapper = React.memo((props: SwipableMessageWrapperProps) => {
30
+ export const SwipableMessageWrapper = React.memo(function SwipableMessageWrapper(
31
+ props: SwipableMessageWrapperProps,
32
+ ) {
31
33
  const { children, messageSwipeToReplyHitSlop, onSwipe } = props;
32
34
  const { MessageSwipeContent } = useComponentsContext();
33
35
  const isRTL = I18nManager.isRTL;
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
- import { AnimatableNumericValue, ColorValue, Pressable, StyleSheet, View } from 'react-native';
2
+ import { ColorValue, Pressable, StyleSheet, View, ViewStyle } from 'react-native';
3
3
 
4
4
  import { MessageTextContainer } from './MessageTextContainer';
5
5
 
@@ -169,47 +169,46 @@ const MessageContentWithContext = (props: MessageContentPropsWithContext) => {
169
169
  [message, isMessageAIGenerated],
170
170
  );
171
171
 
172
- const getBorderRadius = () => {
172
+ // Merged background-color + border-radius object passed directly into the
173
+ // bubble's style array (no spread at the call site). Theme-defined radii
174
+ // override the group-position-computed defaults; theme-undefined radii are
175
+ // omitted so they don't override the computed defaults.
176
+ const bubbleColorAndRadius = useMemo<ViewStyle>(() => {
173
177
  // enum('top', 'middle', 'bottom', 'single')
174
178
  const groupPosition = groupStyles?.[0];
175
-
176
179
  const isBottomOrSingle = groupPosition === 'single' || groupPosition === 'bottom';
177
- let borderBottomLeftRadius = components.messageBubbleRadiusGroupBottom;
178
- let borderBottomRightRadius = components.messageBubbleRadiusGroupBottom;
179
180
 
181
+ let computedBottomLeftRadius = components.messageBubbleRadiusGroupBottom;
182
+ let computedBottomRightRadius = components.messageBubbleRadiusGroupBottom;
180
183
  if (isBottomOrSingle) {
181
- // add relevant sharp corner
184
+ // add relevant sharp corner (the "tail")
182
185
  if (isMyMessage) {
183
- borderBottomRightRadius = components.messageBubbleRadiusTail;
186
+ computedBottomRightRadius = components.messageBubbleRadiusTail;
184
187
  } else {
185
- borderBottomLeftRadius = components.messageBubbleRadiusTail;
188
+ computedBottomLeftRadius = components.messageBubbleRadiusTail;
186
189
  }
187
190
  }
188
191
 
189
- return {
190
- borderBottomLeftRadius,
191
- borderBottomRightRadius,
192
- };
193
- };
194
-
195
- const getBorderRadiusFromTheme = () => {
196
- const bordersFromTheme: Record<string, string | AnimatableNumericValue | undefined> = {
197
- borderBottomLeftRadius,
198
- borderBottomRightRadius,
199
- borderRadius,
200
- borderTopLeftRadius,
201
- borderTopRightRadius,
192
+ const style: ViewStyle = {
193
+ backgroundColor,
194
+ borderBottomLeftRadius: borderBottomLeftRadius ?? computedBottomLeftRadius,
195
+ borderBottomRightRadius: borderBottomRightRadius ?? computedBottomRightRadius,
202
196
  };
197
+ if (borderRadius !== undefined) style.borderRadius = borderRadius;
198
+ if (borderTopLeftRadius !== undefined) style.borderTopLeftRadius = borderTopLeftRadius;
199
+ if (borderTopRightRadius !== undefined) style.borderTopRightRadius = borderTopRightRadius;
203
200
 
204
- // filter out undefined values
205
- for (const key in bordersFromTheme) {
206
- if (bordersFromTheme[key] === undefined) {
207
- delete bordersFromTheme[key];
208
- }
209
- }
210
-
211
- return bordersFromTheme;
212
- };
201
+ return style;
202
+ }, [
203
+ backgroundColor,
204
+ borderBottomLeftRadius,
205
+ borderBottomRightRadius,
206
+ borderRadius,
207
+ borderTopLeftRadius,
208
+ borderTopRightRadius,
209
+ groupStyles,
210
+ isMyMessage,
211
+ ]);
213
212
 
214
213
  const { setNativeScrollability } = useMessageListItemContext();
215
214
  const hasContentSideViews = !!(MessageContentLeadingView || MessageContentTrailingView);
@@ -357,12 +356,8 @@ const MessageContentWithContext = (props: MessageContentPropsWithContext) => {
357
356
  <View
358
357
  style={[
359
358
  styles.containerInner,
360
- {
361
- backgroundColor,
362
- ...getBorderRadius(),
363
- ...getBorderRadiusFromTheme(),
364
- },
365
- noBorder ? { borderWidth: 0 } : {},
359
+ bubbleColorAndRadius,
360
+ noBorder ? styles.noBorder : null,
366
361
  containerInner,
367
362
  messageGroupedSingleOrBottom
368
363
  ? isVeryLastMessage && enableMessageGroupingByUser
@@ -684,6 +679,7 @@ const styles = StyleSheet.create({
684
679
  alignSelf: 'center',
685
680
  },
686
681
  galleryContainer: {},
682
+ noBorder: { borderWidth: 0 },
687
683
  rightAlignContent: {
688
684
  justifyContent: 'flex-end',
689
685
  },
@@ -30,7 +30,7 @@ export type MessageWrapperProps = {
30
30
  nextMessage?: LocalMessage;
31
31
  };
32
32
 
33
- export const MessageWrapper = React.memo((props: MessageWrapperProps) => {
33
+ export const MessageWrapper = React.memo(function MessageWrapper(props: MessageWrapperProps) {
34
34
  const { message, previousMessage, nextMessage } = props;
35
35
  const { client } = useChatContext();
36
36
  const {
@@ -101,6 +101,37 @@ const defaultMarkdownStyles: MarkdownStyle = {
101
101
  fontSize: primitives.typographyFontSizeMd,
102
102
  lineHeight: primitives.typographyLineHeightNormal,
103
103
  },
104
+ // Heading sizes are derived from the body font size (`typographyFontSizeMd`) so they
105
+ // scale with the integrator's typography settings. lineHeight = fontSize × 1.25 to
106
+ // give headings room to breathe. Both fields are required here: without lineHeight,
107
+ // the inherited `lineHeight: typographyLineHeightNormal` (20) from `styles.text` (set
108
+ // in renderText below) leaks into the heading's inner Text via the markdown library's
109
+ // text rule (`{...styles.text, ...state.style}`) and squishes larger heading fontSizes
110
+ // into a 20px line box.
111
+ heading1: {
112
+ fontSize: primitives.typographyFontSizeMd * 2,
113
+ lineHeight: primitives.typographyFontSizeMd * 2 * 1.25,
114
+ },
115
+ heading2: {
116
+ fontSize: primitives.typographyFontSizeMd * 1.5,
117
+ lineHeight: primitives.typographyFontSizeMd * 1.5 * 1.25,
118
+ },
119
+ heading3: {
120
+ fontSize: primitives.typographyFontSizeMd * 1.25,
121
+ lineHeight: primitives.typographyFontSizeMd * 1.25 * 1.25,
122
+ },
123
+ heading4: {
124
+ fontSize: primitives.typographyFontSizeMd,
125
+ lineHeight: primitives.typographyFontSizeMd * 1.25,
126
+ },
127
+ heading5: {
128
+ fontSize: primitives.typographyFontSizeMd * 0.875,
129
+ lineHeight: primitives.typographyFontSizeMd * 0.875 * 1.25,
130
+ },
131
+ heading6: {
132
+ fontSize: primitives.typographyFontSizeMd * 0.75,
133
+ lineHeight: primitives.typographyFontSizeMd * 0.75 * 1.25,
134
+ },
104
135
  inlineCode: {
105
136
  padding: primitives.spacingXxs,
106
137
  paddingHorizontal: primitives.spacingXxs,
@@ -1,14 +1,18 @@
1
- import { useCallback, useEffect, useState } from 'react';
1
+ import { useEffect, useRef, useState } from 'react';
2
2
 
3
3
  import { Event, LocalMessage, UserResponse } from 'stream-chat';
4
4
 
5
5
  import { useChannelContext } from '../../../contexts/channelContext/ChannelContext';
6
6
  import { useChatContext } from '../../../contexts/chatContext/ChatContext';
7
+ import { useStableCallback } from '../../../hooks';
7
8
 
8
9
  export const useMessageDeliveredData = ({ message }: { message?: LocalMessage }) => {
9
10
  const { channel } = useChannelContext();
10
11
  const { client } = useChatContext();
11
- const calculate = useCallback(() => {
12
+
13
+ const messageIdRef = useRef<string>(message?.id);
14
+
15
+ const calculate = useStableCallback(() => {
12
16
  if (!message?.created_at) {
13
17
  return [];
14
18
  }
@@ -17,13 +21,14 @@ export const useMessageDeliveredData = ({ message }: { message?: LocalMessage })
17
21
  timestampMs: new Date(message.created_at).getTime(),
18
22
  };
19
23
  return channel.messageReceiptsTracker.deliveredForMessage(messageRef);
20
- }, [channel, message]);
24
+ });
21
25
 
22
- const [deliveredTo, setDeliveredTo] = useState<UserResponse[]>([]);
26
+ const [deliveredTo, setDeliveredTo] = useState<UserResponse[]>(() => calculate());
23
27
 
24
- useEffect(() => {
28
+ if (!!messageIdRef.current && !!message?.id && messageIdRef.current !== message.id) {
25
29
  setDeliveredTo(calculate());
26
- }, [calculate]);
30
+ messageIdRef.current = message.id;
31
+ }
27
32
 
28
33
  useEffect(() => {
29
34
  const { unsubscribe } = channel.on('message.delivered', (event: Event) => {
@@ -1,14 +1,18 @@
1
- import { useCallback, useEffect, useState } from 'react';
1
+ import { useEffect, useRef, useState } from 'react';
2
2
 
3
3
  import { Event, LocalMessage, UserResponse } from 'stream-chat';
4
4
 
5
5
  import { useChannelContext } from '../../../contexts/channelContext/ChannelContext';
6
6
  import { useChatContext } from '../../../contexts/chatContext/ChatContext';
7
+ import { useStableCallback } from '../../../hooks';
7
8
 
8
9
  export const useMessageReadData = ({ message }: { message?: LocalMessage }) => {
9
10
  const { channel } = useChannelContext();
10
11
  const { client } = useChatContext();
11
- const calculate = useCallback(() => {
12
+
13
+ const messageIdRef = useRef<string>(message?.id);
14
+
15
+ const calculate = useStableCallback(() => {
12
16
  if (!message?.created_at) {
13
17
  return [];
14
18
  }
@@ -18,13 +22,14 @@ export const useMessageReadData = ({ message }: { message?: LocalMessage }) => {
18
22
  };
19
23
 
20
24
  return channel.messageReceiptsTracker.readersForMessage(messageRef);
21
- }, [channel, message]);
25
+ });
22
26
 
23
- const [readBy, setReadBy] = useState<UserResponse[]>([]);
27
+ const [readBy, setReadBy] = useState<UserResponse[]>(() => calculate());
24
28
 
25
- useEffect(() => {
29
+ if (!!messageIdRef.current && !!message?.id && messageIdRef.current !== message.id) {
26
30
  setReadBy(calculate());
27
- }, [calculate]);
31
+ messageIdRef.current = message.id;
32
+ }
28
33
 
29
34
  useEffect(() => {
30
35
  const { unsubscribe } = channel.on('message.read', (event: Event) => {
@@ -511,7 +511,7 @@ exports[`Thread should match thread snapshot 1`] = `
511
511
  "borderBottomLeftRadius": 0,
512
512
  "borderBottomRightRadius": 20,
513
513
  },
514
- {},
514
+ null,
515
515
  {},
516
516
  {},
517
517
  ]
@@ -843,7 +843,7 @@ exports[`Thread should match thread snapshot 1`] = `
843
843
  "borderBottomLeftRadius": 0,
844
844
  "borderBottomRightRadius": 20,
845
845
  },
846
- {},
846
+ null,
847
847
  {},
848
848
  {},
849
849
  ]
@@ -1208,7 +1208,7 @@ exports[`Thread should match thread snapshot 1`] = `
1208
1208
  "borderBottomLeftRadius": 0,
1209
1209
  "borderBottomRightRadius": 20,
1210
1210
  },
1211
- {},
1211
+ null,
1212
1212
  {},
1213
1213
  {},
1214
1214
  ]
@@ -1534,7 +1534,7 @@ exports[`Thread should match thread snapshot 1`] = `
1534
1534
  "borderBottomLeftRadius": 0,
1535
1535
  "borderBottomRightRadius": 20,
1536
1536
  },
1537
- {},
1537
+ null,
1538
1538
  {},
1539
1539
  {},
1540
1540
  ]
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "9.3.1-beta.3"
2
+ "version": "9.3.1-beta.4"
3
3
  }