@poolse/react-native 2.22.0 → 2.23.0
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 +27 -0
- package/dist/index.cjs +65 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +65 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -243,9 +243,9 @@ interface MessageBubbleProps {
|
|
|
243
243
|
/**
|
|
244
244
|
* One message bubble, structured as stacked sections rather than one
|
|
245
245
|
* padded box: media bleeds to a 3px frame, text carries its own
|
|
246
|
-
* padding, and the timestamp
|
|
247
|
-
*
|
|
248
|
-
*
|
|
246
|
+
* padding, and the timestamp shares the last text line when measured
|
|
247
|
+
* room allows — which is what makes "ok" a one-line bubble instead of
|
|
248
|
+
* a squat rectangle.
|
|
249
249
|
*/
|
|
250
250
|
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, actionsTrigger, showAttachments, markdown, onLongPress, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
251
251
|
|
package/dist/index.d.ts
CHANGED
|
@@ -243,9 +243,9 @@ interface MessageBubbleProps {
|
|
|
243
243
|
/**
|
|
244
244
|
* One message bubble, structured as stacked sections rather than one
|
|
245
245
|
* padded box: media bleeds to a 3px frame, text carries its own
|
|
246
|
-
* padding, and the timestamp
|
|
247
|
-
*
|
|
248
|
-
*
|
|
246
|
+
* padding, and the timestamp shares the last text line when measured
|
|
247
|
+
* room allows — which is what makes "ok" a one-line bubble instead of
|
|
248
|
+
* a squat rectangle.
|
|
249
249
|
*/
|
|
250
250
|
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, actionsTrigger, showAttachments, markdown, onLongPress, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
251
251
|
|
package/dist/index.js
CHANGED
|
@@ -2759,6 +2759,9 @@ function MessageBubble({
|
|
|
2759
2759
|
const { width: screenWidth } = useWindowDimensions();
|
|
2760
2760
|
const isSelf = currentUserId !== null && message.sender_id === currentUserId;
|
|
2761
2761
|
const [expanded, setExpanded] = useState(false);
|
|
2762
|
+
const [lastLineWidth, setLastLineWidth] = useState(null);
|
|
2763
|
+
const [textBoxWidth, setTextBoxWidth] = useState(null);
|
|
2764
|
+
const [metaWidth, setMetaWidth] = useState(null);
|
|
2762
2765
|
const bubbleMaxWidth = Math.floor(screenWidth * 0.78);
|
|
2763
2766
|
const mediaWidth = Math.min(bubbleMaxWidth - 6, 420);
|
|
2764
2767
|
const sender = useUser(!isSelf ? message.sender_external_id : null);
|
|
@@ -2794,7 +2797,7 @@ function MessageBubble({
|
|
|
2794
2797
|
const jumboCount = hasBody && !hasMedia && !hasFiles && !message.quoted_message_id ? emojiOnlyCount(body) : 0;
|
|
2795
2798
|
const inlineMeta = hasBody && jumboCount === 0 && !trimmable && (!markdown || !hasMarkdown(truncated));
|
|
2796
2799
|
const sectionAbove = hasMedia || hasFiles || !!message.quoted_message || isDeleted;
|
|
2797
|
-
const
|
|
2800
|
+
const metaFits = lastLineWidth !== null && textBoxWidth !== null && metaWidth !== null && lastLineWidth + metaWidth + 14 <= textBoxWidth;
|
|
2798
2801
|
const metaRow = (variant) => {
|
|
2799
2802
|
const color = variant === "overlay" ? "#FFFFFF" : variant === "jumbo" ? theme.colors.ink3 : mutedOnBubble;
|
|
2800
2803
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2803,6 +2806,7 @@ function MessageBubble({
|
|
|
2803
2806
|
style: [
|
|
2804
2807
|
styles15.metaRow,
|
|
2805
2808
|
variant === "inline" && styles15.metaInline,
|
|
2809
|
+
variant === "wrapped" && styles15.metaWrapped,
|
|
2806
2810
|
variant === "overlay" && styles15.metaOverlay,
|
|
2807
2811
|
variant === "block" && styles15.metaBlock,
|
|
2808
2812
|
// File-only bubble: the meta row follows the cards directly —
|
|
@@ -2810,6 +2814,7 @@ function MessageBubble({
|
|
|
2810
2814
|
variant === "block" && hasFiles && !hasBody && styles15.metaBlockAfterFiles,
|
|
2811
2815
|
variant === "jumbo" && styles15.metaJumbo
|
|
2812
2816
|
],
|
|
2817
|
+
onLayout: variant === "inline" || variant === "wrapped" ? (e) => setMetaWidth(e.nativeEvent.layout.width) : void 0,
|
|
2813
2818
|
pointerEvents: "none",
|
|
2814
2819
|
children: [
|
|
2815
2820
|
isEdited ? /* @__PURE__ */ jsx(Text, { style: [styles15.editedTag, { color, opacity: 0.8 }], children: "edited" }) : null,
|
|
@@ -2907,51 +2912,53 @@ function MessageBubble({
|
|
|
2907
2912
|
children: body
|
|
2908
2913
|
}
|
|
2909
2914
|
) }) : null,
|
|
2910
|
-
hasBody && jumboCount === 0 ? /* @__PURE__ */ jsxs(
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
return false;
|
|
2920
|
-
}
|
|
2921
|
-
}) : /* @__PURE__ */ jsxs(
|
|
2922
|
-
Text,
|
|
2923
|
-
{
|
|
2924
|
-
style: {
|
|
2925
|
-
color: textColor,
|
|
2915
|
+
hasBody && jumboCount === 0 ? /* @__PURE__ */ jsxs(
|
|
2916
|
+
View,
|
|
2917
|
+
{
|
|
2918
|
+
style: [styles15.textBlock, sectionAbove && styles15.textBlockAfter],
|
|
2919
|
+
onLayout: inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : void 0,
|
|
2920
|
+
children: [
|
|
2921
|
+
markdown && !inlineMeta ? renderMarkdown(truncated, {
|
|
2922
|
+
textColor,
|
|
2923
|
+
linkColor: isSelf ? theme.colors.onBrand : theme.colors.brand,
|
|
2926
2924
|
fontFamily: theme.type.fontBody,
|
|
2927
2925
|
fontSize: theme.type.bodySize,
|
|
2928
|
-
lineHeight: theme.type.lineHeight
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2926
|
+
lineHeight: theme.type.lineHeight,
|
|
2927
|
+
onLinkPress: (url) => {
|
|
2928
|
+
void Linking.openURL(url).catch(() => void 0);
|
|
2929
|
+
return false;
|
|
2930
|
+
}
|
|
2931
|
+
}) : /* @__PURE__ */ jsx(
|
|
2932
|
+
Text,
|
|
2933
|
+
{
|
|
2934
|
+
style: {
|
|
2935
|
+
color: textColor,
|
|
2936
|
+
fontFamily: theme.type.fontBody,
|
|
2937
|
+
fontSize: theme.type.bodySize,
|
|
2938
|
+
lineHeight: theme.type.lineHeight
|
|
2939
|
+
},
|
|
2940
|
+
onTextLayout: inlineMeta ? (e) => {
|
|
2941
|
+
const lines = e.nativeEvent.lines;
|
|
2942
|
+
const last = lines[lines.length - 1];
|
|
2943
|
+
setLastLineWidth(last ? Math.ceil(last.width) : 0);
|
|
2944
|
+
} : void 0,
|
|
2945
|
+
children: truncated
|
|
2946
|
+
}
|
|
2947
|
+
),
|
|
2948
|
+
trimmable ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsx(
|
|
2949
|
+
Text,
|
|
2950
|
+
{
|
|
2951
|
+
style: [
|
|
2952
|
+
styles15.readMore,
|
|
2953
|
+
{ color: isSelf ? theme.colors.onBrand : theme.colors.brand }
|
|
2954
|
+
],
|
|
2955
|
+
children: expanded ? "Show less" : "Read more"
|
|
2956
|
+
}
|
|
2957
|
+
) }) : null,
|
|
2958
|
+
inlineMeta ? metaRow(metaFits ? "inline" : "wrapped") : null
|
|
2959
|
+
]
|
|
2960
|
+
}
|
|
2961
|
+
) : null,
|
|
2955
2962
|
!inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow("block") : null,
|
|
2956
2963
|
actionsTrigger ? /* @__PURE__ */ jsx(View, { style: styles15.actionsSlot, children: actionsTrigger }) : null
|
|
2957
2964
|
]
|
|
@@ -3047,9 +3054,11 @@ var styles15 = StyleSheet.create({
|
|
|
3047
3054
|
jumboBlock: {
|
|
3048
3055
|
paddingVertical: 2
|
|
3049
3056
|
},
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3057
|
+
// The meta on its own line inside the text block, flush right —
|
|
3058
|
+
// the fallback whenever the last text line has no room for it.
|
|
3059
|
+
metaWrapped: {
|
|
3060
|
+
alignSelf: "flex-end",
|
|
3061
|
+
marginTop: 3
|
|
3053
3062
|
},
|
|
3054
3063
|
readMore: {
|
|
3055
3064
|
fontSize: 12,
|
|
@@ -6105,10 +6114,14 @@ function CallScreen({
|
|
|
6105
6114
|
[wakeChrome]
|
|
6106
6115
|
);
|
|
6107
6116
|
const hangUp = useCallback(() => {
|
|
6117
|
+
const othersOnCall = (usingSfu ? sfu.participants : mesh.participants).filter(
|
|
6118
|
+
(p) => !p.isSelf
|
|
6119
|
+
).length;
|
|
6108
6120
|
sfu.leave();
|
|
6109
6121
|
mesh.leave();
|
|
6110
|
-
|
|
6111
|
-
|
|
6122
|
+
if (calls.phase === "active" && othersOnCall >= 2) calls.reset();
|
|
6123
|
+
else void calls.hangUp();
|
|
6124
|
+
}, [sfu, mesh, calls, usingSfu]);
|
|
6112
6125
|
const alone = usingSfu ? sfu.alone : mesh.alone;
|
|
6113
6126
|
const endedOnEmpty = useRef(false);
|
|
6114
6127
|
if (calls.phase !== "active") endedOnEmpty.current = false;
|
|
@@ -6149,10 +6162,11 @@ function CallScreen({
|
|
|
6149
6162
|
const statusText = duration ?? statusLine(calls, status);
|
|
6150
6163
|
const subtitle = convName && !duration && peerIds.length > 0 ? `${peerTitle} \xB7 ${statusText}` : statusText;
|
|
6151
6164
|
const showStage = connected && usingSfu && participants.length > 0;
|
|
6152
|
-
const
|
|
6165
|
+
const rawError = calls.error ?? (usingSfu ? sfu.error : mesh.error);
|
|
6166
|
+
const error = connected ? null : rawError;
|
|
6153
6167
|
const chromeInsets = {
|
|
6154
6168
|
top: insets.top + 72,
|
|
6155
|
-
bottom: insets.bottom +
|
|
6169
|
+
bottom: insets.bottom + 236
|
|
6156
6170
|
};
|
|
6157
6171
|
return /* @__PURE__ */ jsxs(
|
|
6158
6172
|
Modal,
|