@poolse/react-native 2.21.0 → 2.22.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/dist/index.d.cts CHANGED
@@ -1317,6 +1317,13 @@ interface CallScreenProps {
1317
1317
  onTransportChange?: (transport: 'sfu' | 'mesh' | null) => void;
1318
1318
  /** Called when the call's video state changes. */
1319
1319
  onVideoChange?: (video: boolean) => void;
1320
+ /**
1321
+ * Called when the audio route changes: speaker on/off, or an
1322
+ * external device (headset, Bluetooth) taking over. Hosts use this
1323
+ * to drive the proximity sensor — the screen should only go dark
1324
+ * near an ear when the sound is actually AT the ear.
1325
+ */
1326
+ onSpeakerChange?: (speakerOn: boolean, externalDevice: boolean) => void;
1320
1327
  /**
1321
1328
  * `react-native-incall-manager`, imported by your app.
1322
1329
  *
@@ -1352,7 +1359,7 @@ interface RingToneModule {
1352
1359
  startRingtone?: (...args: never[]) => void;
1353
1360
  stopRingtone?: (...args: never[]) => void;
1354
1361
  }
1355
- declare function CallScreen({ userId, labelFor, conversationLabel, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onTransportChange, onVideoChange, inCallManager, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1362
+ declare function CallScreen({ userId, labelFor, conversationLabel, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onTransportChange, onVideoChange, onSpeakerChange, inCallManager, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1356
1363
 
1357
1364
  interface CallVideoGridProps {
1358
1365
  participants: CallParticipant[];
package/dist/index.d.ts CHANGED
@@ -1317,6 +1317,13 @@ interface CallScreenProps {
1317
1317
  onTransportChange?: (transport: 'sfu' | 'mesh' | null) => void;
1318
1318
  /** Called when the call's video state changes. */
1319
1319
  onVideoChange?: (video: boolean) => void;
1320
+ /**
1321
+ * Called when the audio route changes: speaker on/off, or an
1322
+ * external device (headset, Bluetooth) taking over. Hosts use this
1323
+ * to drive the proximity sensor — the screen should only go dark
1324
+ * near an ear when the sound is actually AT the ear.
1325
+ */
1326
+ onSpeakerChange?: (speakerOn: boolean, externalDevice: boolean) => void;
1320
1327
  /**
1321
1328
  * `react-native-incall-manager`, imported by your app.
1322
1329
  *
@@ -1352,7 +1359,7 @@ interface RingToneModule {
1352
1359
  startRingtone?: (...args: never[]) => void;
1353
1360
  stopRingtone?: (...args: never[]) => void;
1354
1361
  }
1355
- declare function CallScreen({ userId, labelFor, conversationLabel, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onTransportChange, onVideoChange, inCallManager, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1362
+ declare function CallScreen({ userId, labelFor, conversationLabel, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onTransportChange, onVideoChange, onSpeakerChange, inCallManager, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1356
1363
 
1357
1364
  interface CallVideoGridProps {
1358
1365
  participants: CallParticipant[];
package/dist/index.js CHANGED
@@ -1,21 +1,16 @@
1
1
  import { useUser, useMe, useConversations, useAttachmentUpload, useConversation, useMembers, usePresence, useMessages, useTyping, useRealtimeStatus, computeGroupPosition, formatDayLabel, useReactions, sameDay, useThread, useAttachmentUrl, usePoolse, useVoiceRoom, useCalls, useCallRoom } from '@poolse/react';
2
2
  import { createContext, forwardRef, useRef, useState, useEffect, useImperativeHandle, useMemo, useCallback, useContext, createElement } from 'react';
3
- import { StyleSheet, Platform, Keyboard, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Image, ScrollView, ActivityIndicator, FlatList, AppState, KeyboardAvoidingView, Modal, Dimensions, Linking, StatusBar } from 'react-native';
3
+ import { StyleSheet, Keyboard, Platform, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Image, ScrollView, ActivityIndicator, FlatList, AppState, KeyboardAvoidingView, Modal, Dimensions, Linking, StatusBar } from 'react-native';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import Svg2, { SvgXml, Svg, Path, Circle, G, Defs, RadialGradient, Stop, Rect } from 'react-native-svg';
6
6
  import * as ImagePicker from 'expo-image-picker';
7
7
  import * as DocumentPicker from 'expo-document-picker';
8
8
  import { manipulateAsync, SaveFormat } from 'expo-image-manipulator';
9
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
9
10
  import * as Clipboard from 'expo-clipboard';
10
11
  import Markdown, { MarkdownIt } from 'react-native-markdown-display';
11
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
12
12
 
13
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
14
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
15
- }) : x)(function(x) {
16
- if (typeof require !== "undefined") return require.apply(this, arguments);
17
- throw Error('Dynamic require of "' + x + '" is not supported');
18
- });
13
+ // src/PoolseInbox.tsx
19
14
 
20
15
  // src/theme/default.ts
21
16
  var lightColors = {
@@ -1643,22 +1638,7 @@ var styles8 = StyleSheet.create({
1643
1638
  fontWeight: "700"
1644
1639
  }
1645
1640
  });
1646
- var FALLBACK = {
1647
- top: Platform.OS === "ios" ? 50 : 24,
1648
- bottom: Platform.OS === "ios" ? 34 : 0,
1649
- left: 0,
1650
- right: 0
1651
- };
1652
- var realHook = null;
1653
- try {
1654
- const mod = __require("react-native-safe-area-context");
1655
- if (mod && typeof mod.useSafeAreaInsets === "function") {
1656
- realHook = mod.useSafeAreaInsets;
1657
- }
1658
- } catch {
1659
- }
1660
- var useFallback = () => FALLBACK;
1661
- var useSafeInsets = realHook ?? useFallback;
1641
+ var useSafeInsets = useSafeAreaInsets;
1662
1642
  var MessageComposer = forwardRef(
1663
1643
  function MessageComposer2({
1664
1644
  onSend,
@@ -6028,6 +6008,7 @@ function CallScreen({
6028
6008
  onStatusChange,
6029
6009
  onTransportChange,
6030
6010
  onVideoChange,
6011
+ onSpeakerChange,
6031
6012
  inCallManager,
6032
6013
  nativeIncomingUi
6033
6014
  }) {
@@ -6079,6 +6060,9 @@ function CallScreen({
6079
6060
  livekitReactNative
6080
6061
  });
6081
6062
  const [routesOpen, setRoutesOpen] = useState(false);
6063
+ useEffect(() => {
6064
+ onSpeakerChange?.(audio.speakerOn, audio.externalDevice);
6065
+ }, [audio.speakerOn, audio.externalDevice, onSpeakerChange]);
6082
6066
  const showingIncoming = calls.phase === "ringing-in" && !nativeIncomingUi;
6083
6067
  useEffect(() => {
6084
6068
  const ringing = calls.phase === "ringing-out";