@poolse/react-native 2.22.0 → 2.22.1

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ All notable changes to `@poolse/react-native` are documented here.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
5
5
  versions follow [semver](https://semver.org).
6
6
 
7
+ ## [2.22.1] — 2026-10-14
8
+
9
+ ### Fixed
10
+
11
+ - **Bubble text rendered doubled on Android.** The inline timestamp
12
+ reserved its spot with an invisible twin of itself — but
13
+ `color: transparent` on a nested Text does not reliably apply on
14
+ Android, so the twin rendered visibly at the end of every plain
15
+ message, with the real meta overlaid. The reservation trick is gone:
16
+ the last text line and the meta are measured (`onTextLayout`), and
17
+ the meta shares the line only when it provably fits, else takes its
18
+ own flush-right row.
19
+
7
20
  ## [2.22.0] — 2026-10-14
8
21
 
9
22
  ### Added
package/dist/index.cjs CHANGED
@@ -2787,6 +2787,9 @@ function MessageBubble({
2787
2787
  const { width: screenWidth } = reactNative.useWindowDimensions();
2788
2788
  const isSelf = currentUserId !== null && message.sender_id === currentUserId;
2789
2789
  const [expanded, setExpanded] = react.useState(false);
2790
+ const [lastLineWidth, setLastLineWidth] = react.useState(null);
2791
+ const [textBoxWidth, setTextBoxWidth] = react.useState(null);
2792
+ const [metaWidth, setMetaWidth] = react.useState(null);
2790
2793
  const bubbleMaxWidth = Math.floor(screenWidth * 0.78);
2791
2794
  const mediaWidth = Math.min(bubbleMaxWidth - 6, 420);
2792
2795
  const sender = react$1.useUser(!isSelf ? message.sender_external_id : null);
@@ -2822,7 +2825,7 @@ function MessageBubble({
2822
2825
  const jumboCount = hasBody && !hasMedia && !hasFiles && !message.quoted_message_id ? emojiOnlyCount(body) : 0;
2823
2826
  const inlineMeta = hasBody && jumboCount === 0 && !trimmable && (!markdown || !hasMarkdown(truncated));
2824
2827
  const sectionAbove = hasMedia || hasFiles || !!message.quoted_message || isDeleted;
2825
- const ghost = ` ${isEdited ? "edited " : ""}${time}${isSelf && readState ? " \u2713\u2713" : ""}`;
2828
+ const metaFits = lastLineWidth !== null && textBoxWidth !== null && metaWidth !== null && lastLineWidth + metaWidth + 14 <= textBoxWidth;
2826
2829
  const metaRow = (variant) => {
2827
2830
  const color = variant === "overlay" ? "#FFFFFF" : variant === "jumbo" ? theme.colors.ink3 : mutedOnBubble;
2828
2831
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2831,6 +2834,7 @@ function MessageBubble({
2831
2834
  style: [
2832
2835
  styles15.metaRow,
2833
2836
  variant === "inline" && styles15.metaInline,
2837
+ variant === "wrapped" && styles15.metaWrapped,
2834
2838
  variant === "overlay" && styles15.metaOverlay,
2835
2839
  variant === "block" && styles15.metaBlock,
2836
2840
  // File-only bubble: the meta row follows the cards directly —
@@ -2838,6 +2842,7 @@ function MessageBubble({
2838
2842
  variant === "block" && hasFiles && !hasBody && styles15.metaBlockAfterFiles,
2839
2843
  variant === "jumbo" && styles15.metaJumbo
2840
2844
  ],
2845
+ onLayout: variant === "inline" || variant === "wrapped" ? (e) => setMetaWidth(e.nativeEvent.layout.width) : void 0,
2841
2846
  pointerEvents: "none",
2842
2847
  children: [
2843
2848
  isEdited ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.editedTag, { color, opacity: 0.8 }], children: "edited" }) : null,
@@ -2935,51 +2940,53 @@ function MessageBubble({
2935
2940
  children: body
2936
2941
  }
2937
2942
  ) }) : null,
2938
- hasBody && jumboCount === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles15.textBlock, sectionAbove && styles15.textBlockAfter], children: [
2939
- markdown && !inlineMeta ? renderMarkdown(truncated, {
2940
- textColor,
2941
- linkColor: isSelf ? theme.colors.onBrand : theme.colors.brand,
2942
- fontFamily: theme.type.fontBody,
2943
- fontSize: theme.type.bodySize,
2944
- lineHeight: theme.type.lineHeight,
2945
- onLinkPress: (url) => {
2946
- void reactNative.Linking.openURL(url).catch(() => void 0);
2947
- return false;
2948
- }
2949
- }) : /* @__PURE__ */ jsxRuntime.jsxs(
2950
- reactNative.Text,
2951
- {
2952
- style: {
2953
- color: textColor,
2943
+ hasBody && jumboCount === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
2944
+ reactNative.View,
2945
+ {
2946
+ style: [styles15.textBlock, sectionAbove && styles15.textBlockAfter],
2947
+ onLayout: inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : void 0,
2948
+ children: [
2949
+ markdown && !inlineMeta ? renderMarkdown(truncated, {
2950
+ textColor,
2951
+ linkColor: isSelf ? theme.colors.onBrand : theme.colors.brand,
2954
2952
  fontFamily: theme.type.fontBody,
2955
2953
  fontSize: theme.type.bodySize,
2956
- lineHeight: theme.type.lineHeight
2957
- },
2958
- children: [
2959
- truncated,
2960
- inlineMeta ? (
2961
- // The invisible twin: reserves the meta's footprint
2962
- // at the end of the last line so the absolutely-
2963
- // positioned real meta never covers a glyph — and
2964
- // when the line is full, the reservation wraps and
2965
- // the meta drops down, flush right.
2966
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles15.ghost, children: ghost })
2967
- ) : null
2968
- ]
2969
- }
2970
- ),
2971
- trimmable ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsxRuntime.jsx(
2972
- reactNative.Text,
2973
- {
2974
- style: [
2975
- styles15.readMore,
2976
- { color: isSelf ? theme.colors.onBrand : theme.colors.brand }
2977
- ],
2978
- children: expanded ? "Show less" : "Read more"
2979
- }
2980
- ) }) : null,
2981
- inlineMeta ? metaRow("inline") : null
2982
- ] }) : null,
2954
+ lineHeight: theme.type.lineHeight,
2955
+ onLinkPress: (url) => {
2956
+ void reactNative.Linking.openURL(url).catch(() => void 0);
2957
+ return false;
2958
+ }
2959
+ }) : /* @__PURE__ */ jsxRuntime.jsx(
2960
+ reactNative.Text,
2961
+ {
2962
+ style: {
2963
+ color: textColor,
2964
+ fontFamily: theme.type.fontBody,
2965
+ fontSize: theme.type.bodySize,
2966
+ lineHeight: theme.type.lineHeight
2967
+ },
2968
+ onTextLayout: inlineMeta ? (e) => {
2969
+ const lines = e.nativeEvent.lines;
2970
+ const last = lines[lines.length - 1];
2971
+ setLastLineWidth(last ? Math.ceil(last.width) : 0);
2972
+ } : void 0,
2973
+ children: truncated
2974
+ }
2975
+ ),
2976
+ trimmable ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsxRuntime.jsx(
2977
+ reactNative.Text,
2978
+ {
2979
+ style: [
2980
+ styles15.readMore,
2981
+ { color: isSelf ? theme.colors.onBrand : theme.colors.brand }
2982
+ ],
2983
+ children: expanded ? "Show less" : "Read more"
2984
+ }
2985
+ ) }) : null,
2986
+ inlineMeta ? metaRow(metaFits ? "inline" : "wrapped") : null
2987
+ ]
2988
+ }
2989
+ ) : null,
2983
2990
  !inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow("block") : null,
2984
2991
  actionsTrigger ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles15.actionsSlot, children: actionsTrigger }) : null
2985
2992
  ]
@@ -3075,9 +3082,11 @@ var styles15 = reactNative.StyleSheet.create({
3075
3082
  jumboBlock: {
3076
3083
  paddingVertical: 2
3077
3084
  },
3078
- ghost: {
3079
- color: "transparent",
3080
- fontSize: 11
3085
+ // The meta on its own line inside the text block, flush right —
3086
+ // the fallback whenever the last text line has no room for it.
3087
+ metaWrapped: {
3088
+ alignSelf: "flex-end",
3089
+ marginTop: 3
3081
3090
  },
3082
3091
  readMore: {
3083
3092
  fontSize: 12,