@ethora/chat-component-rn 26.10.4 → 26.10.5

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 (100) hide show
  1. package/lib/commonjs/components/VideoCalls/ActiveCallBar.js +61 -16
  2. package/lib/commonjs/components/VideoCalls/ActiveCallBar.js.map +1 -1
  3. package/lib/commonjs/components/VideoCalls/CallIcons.js +41 -16
  4. package/lib/commonjs/components/VideoCalls/CallIcons.js.map +1 -1
  5. package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js +183 -9
  6. package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js.map +1 -1
  7. package/lib/commonjs/components/VideoCalls/VideoCallSession.js +40 -15
  8. package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
  9. package/lib/commonjs/components/VideoCalls/callSessionController.js +49 -26
  10. package/lib/commonjs/components/VideoCalls/callSessionController.js.map +1 -1
  11. package/lib/commonjs/components/VideoCalls/callUiStore.js +33 -4
  12. package/lib/commonjs/components/VideoCalls/callUiStore.js.map +1 -1
  13. package/lib/commonjs/components/VideoCalls/livekitRuntime.js +9 -1
  14. package/lib/commonjs/components/VideoCalls/livekitRuntime.js.map +1 -1
  15. package/lib/commonjs/components/VideoCalls/useCallKeep.js +197 -28
  16. package/lib/commonjs/components/VideoCalls/useCallKeep.js.map +1 -1
  17. package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js +88 -0
  18. package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js.map +1 -0
  19. package/lib/commonjs/components/VideoCalls/usePipTile.js +232 -0
  20. package/lib/commonjs/components/VideoCalls/usePipTile.js.map +1 -0
  21. package/lib/commonjs/helpers/updateMessagesTillLast.js +3 -1
  22. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  23. package/lib/commonjs/i18n/strings.js +48 -0
  24. package/lib/commonjs/i18n/strings.js.map +1 -1
  25. package/lib/commonjs/main.js.map +1 -1
  26. package/lib/commonjs/version.js +1 -1
  27. package/lib/module/components/VideoCalls/ActiveCallBar.js +63 -18
  28. package/lib/module/components/VideoCalls/ActiveCallBar.js.map +1 -1
  29. package/lib/module/components/VideoCalls/CallIcons.js +38 -15
  30. package/lib/module/components/VideoCalls/CallIcons.js.map +1 -1
  31. package/lib/module/components/VideoCalls/VideoCallOverlay.js +185 -11
  32. package/lib/module/components/VideoCalls/VideoCallOverlay.js.map +1 -1
  33. package/lib/module/components/VideoCalls/VideoCallSession.js +41 -16
  34. package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
  35. package/lib/module/components/VideoCalls/callSessionController.js +46 -24
  36. package/lib/module/components/VideoCalls/callSessionController.js.map +1 -1
  37. package/lib/module/components/VideoCalls/callUiStore.js +30 -3
  38. package/lib/module/components/VideoCalls/callUiStore.js.map +1 -1
  39. package/lib/module/components/VideoCalls/livekitRuntime.js +9 -1
  40. package/lib/module/components/VideoCalls/livekitRuntime.js.map +1 -1
  41. package/lib/module/components/VideoCalls/useCallKeep.js +198 -29
  42. package/lib/module/components/VideoCalls/useCallKeep.js.map +1 -1
  43. package/lib/module/components/VideoCalls/useOngoingCallNotification.js +84 -0
  44. package/lib/module/components/VideoCalls/useOngoingCallNotification.js.map +1 -0
  45. package/lib/module/components/VideoCalls/usePipTile.js +228 -0
  46. package/lib/module/components/VideoCalls/usePipTile.js.map +1 -0
  47. package/lib/module/helpers/updateMessagesTillLast.js +3 -1
  48. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  49. package/lib/module/i18n/strings.js +48 -0
  50. package/lib/module/i18n/strings.js.map +1 -1
  51. package/lib/module/main.js.map +1 -1
  52. package/lib/module/version.js +1 -1
  53. package/lib/typescript/components/VideoCalls/ActiveCallBar.d.ts +9 -3
  54. package/lib/typescript/components/VideoCalls/ActiveCallBar.d.ts.map +1 -1
  55. package/lib/typescript/components/VideoCalls/CallIcons.d.ts +9 -0
  56. package/lib/typescript/components/VideoCalls/CallIcons.d.ts.map +1 -1
  57. package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts.map +1 -1
  58. package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
  59. package/lib/typescript/components/VideoCalls/callSessionController.d.ts +7 -0
  60. package/lib/typescript/components/VideoCalls/callSessionController.d.ts.map +1 -1
  61. package/lib/typescript/components/VideoCalls/callUiStore.d.ts +13 -0
  62. package/lib/typescript/components/VideoCalls/callUiStore.d.ts.map +1 -1
  63. package/lib/typescript/components/VideoCalls/livekitRuntime.d.ts +5 -0
  64. package/lib/typescript/components/VideoCalls/livekitRuntime.d.ts.map +1 -1
  65. package/lib/typescript/components/VideoCalls/useCallKeep.d.ts +12 -0
  66. package/lib/typescript/components/VideoCalls/useCallKeep.d.ts.map +1 -1
  67. package/lib/typescript/components/VideoCalls/useOngoingCallNotification.d.ts +10 -0
  68. package/lib/typescript/components/VideoCalls/useOngoingCallNotification.d.ts.map +1 -0
  69. package/lib/typescript/components/VideoCalls/usePipTile.d.ts +46 -0
  70. package/lib/typescript/components/VideoCalls/usePipTile.d.ts.map +1 -0
  71. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  72. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  73. package/lib/typescript/main.d.ts +1 -1
  74. package/lib/typescript/main.d.ts.map +1 -1
  75. package/lib/typescript/types/types.d.ts +40 -0
  76. package/lib/typescript/types/types.d.ts.map +1 -1
  77. package/lib/typescript/version.d.ts +1 -1
  78. package/package.json +1 -1
  79. package/src/components/VideoCalls/ActiveCallBar.tsx +56 -10
  80. package/src/components/VideoCalls/CallIcons.tsx +36 -12
  81. package/src/components/VideoCalls/VideoCallOverlay.tsx +205 -8
  82. package/src/components/VideoCalls/VideoCallSession.tsx +45 -13
  83. package/src/components/VideoCalls/callSessionController.ts +51 -20
  84. package/src/components/VideoCalls/callUiStore.ts +33 -3
  85. package/src/components/VideoCalls/livekitRuntime.ts +13 -0
  86. package/src/components/VideoCalls/useCallKeep.ts +204 -33
  87. package/src/components/VideoCalls/useOngoingCallNotification.ts +113 -0
  88. package/src/components/VideoCalls/usePipTile.ts +214 -0
  89. package/src/helpers/updateMessagesTillLast.tsx +2 -1
  90. package/src/i18n/strings.ts +48 -0
  91. package/src/main.ts +3 -0
  92. package/src/types/types.ts +48 -0
  93. package/src/version.ts +1 -1
  94. package/lib/commonjs/components/VideoCalls/useDraggable.js +0 -59
  95. package/lib/commonjs/components/VideoCalls/useDraggable.js.map +0 -1
  96. package/lib/module/components/VideoCalls/useDraggable.js +0 -55
  97. package/lib/module/components/VideoCalls/useDraggable.js.map +0 -1
  98. package/lib/typescript/components/VideoCalls/useDraggable.d.ts +0 -19
  99. package/lib/typescript/components/VideoCalls/useDraggable.d.ts.map +0 -1
  100. package/src/components/VideoCalls/useDraggable.ts +0 -46
@@ -74,7 +74,8 @@ export const updateMessagesTillLast = async (
74
74
  { coalesceRoom: true, source: 'background', selfApplied: true }
75
75
  );
76
76
 
77
- if (!fetchedMessages.length) {break;}
77
+ // undefined when the stanza was dropped (e.g. reconnecting).
78
+ if (!fetchedMessages?.length) {break;}
78
79
 
79
80
  counter++;
80
81
 
@@ -116,6 +116,14 @@ const en: UiStringTable = {
116
116
  'call.action.startCamera': 'Turn camera on',
117
117
  'call.action.switchCamera': 'Switch camera',
118
118
  'call.action.swapVideo': 'Swap videos',
119
+ 'call.action.fillVideo': 'Stretch video',
120
+ 'call.action.fitVideo': 'Show whole video',
121
+ 'call.notification.ongoing': 'Ongoing call',
122
+ 'call.notification.ongoingVideo': 'Ongoing video call',
123
+ 'call.notification.mute': 'Mute',
124
+ 'call.notification.unmute': 'Unmute',
125
+ 'call.notification.cameraOn': 'Camera on',
126
+ 'call.notification.cameraOff': 'Camera off',
119
127
  'call.action.speakerOn': 'Turn speaker on',
120
128
  'call.action.speakerOff': 'Turn speaker off',
121
129
  'call.action.startAudioCall': 'Start audio call',
@@ -497,6 +505,14 @@ const fr: UiStringTable = {
497
505
  'call.action.startCamera': 'Activer la caméra',
498
506
  'call.action.switchCamera': 'Changer de caméra',
499
507
  'call.action.swapVideo': 'Inverser les vidéos',
508
+ 'call.action.fillVideo': 'Étirer la vidéo',
509
+ 'call.action.fitVideo': 'Afficher toute la vidéo',
510
+ 'call.notification.ongoing': 'Appel en cours',
511
+ 'call.notification.ongoingVideo': 'Appel vidéo en cours',
512
+ 'call.notification.mute': 'Couper',
513
+ 'call.notification.unmute': 'Réactiver',
514
+ 'call.notification.cameraOn': 'Caméra on',
515
+ 'call.notification.cameraOff': 'Caméra off',
500
516
  'call.action.speakerOn': 'Activer le haut-parleur',
501
517
  'call.action.speakerOff': 'Désactiver le haut-parleur',
502
518
  'call.action.startAudioCall': 'Démarrer un appel audio',
@@ -878,6 +894,14 @@ const es: UiStringTable = {
878
894
  'call.action.startCamera': 'Encender la cámara',
879
895
  'call.action.switchCamera': 'Cambiar de cámara',
880
896
  'call.action.swapVideo': 'Intercambiar vídeos',
897
+ 'call.action.fillVideo': 'Ampliar vídeo',
898
+ 'call.action.fitVideo': 'Ver vídeo completo',
899
+ 'call.notification.ongoing': 'Llamada en curso',
900
+ 'call.notification.ongoingVideo': 'Videollamada en curso',
901
+ 'call.notification.mute': 'Silenciar',
902
+ 'call.notification.unmute': 'Activar',
903
+ 'call.notification.cameraOn': 'Cámara on',
904
+ 'call.notification.cameraOff': 'Cámara off',
881
905
  'call.action.speakerOn': 'Activar el altavoz',
882
906
  'call.action.speakerOff': 'Desactivar el altavoz',
883
907
  'call.action.startAudioCall': 'Iniciar llamada de audio',
@@ -1259,6 +1283,14 @@ const pt: UiStringTable = {
1259
1283
  'call.action.startCamera': 'Ligar a câmara',
1260
1284
  'call.action.switchCamera': 'Mudar de câmara',
1261
1285
  'call.action.swapVideo': 'Trocar vídeos',
1286
+ 'call.action.fillVideo': 'Esticar vídeo',
1287
+ 'call.action.fitVideo': 'Mostrar vídeo inteiro',
1288
+ 'call.notification.ongoing': 'Chamada em andamento',
1289
+ 'call.notification.ongoingVideo': 'Videochamada em andamento',
1290
+ 'call.notification.mute': 'Silenciar',
1291
+ 'call.notification.unmute': 'Ativar som',
1292
+ 'call.notification.cameraOn': 'Ligar câmera',
1293
+ 'call.notification.cameraOff': 'Desligar câmera',
1262
1294
  'call.action.speakerOn': 'Ligar o altifalante',
1263
1295
  'call.action.speakerOff': 'Desligar o altifalante',
1264
1296
  'call.action.startAudioCall': 'Iniciar chamada de áudio',
@@ -1640,6 +1672,14 @@ const ht: UiStringTable = {
1640
1672
  'call.action.startCamera': 'Limen kamera a',
1641
1673
  'call.action.switchCamera': 'Chanje kamera',
1642
1674
  'call.action.swapVideo': 'Chanje videyo yo',
1675
+ 'call.action.fillVideo': 'Lonje videyo a',
1676
+ 'call.action.fitVideo': 'Montre tout videyo a',
1677
+ 'call.notification.ongoing': 'Apèl k ap fèt',
1678
+ 'call.notification.ongoingVideo': 'Apèl videyo k ap fèt',
1679
+ 'call.notification.mute': 'Fèmen mikwo',
1680
+ 'call.notification.unmute': 'Louvri mikwo',
1681
+ 'call.notification.cameraOn': 'Limen kamera',
1682
+ 'call.notification.cameraOff': 'Etenn kamera',
1643
1683
  'call.action.speakerOn': 'Limen opalè a',
1644
1684
  'call.action.speakerOff': 'Etenn opalè a',
1645
1685
  'call.action.startAudioCall': 'Kòmanse yon apèl odyo',
@@ -2021,6 +2061,14 @@ const zh: UiStringTable = {
2021
2061
  'call.action.startCamera': '打开摄像头',
2022
2062
  'call.action.switchCamera': '切换摄像头',
2023
2063
  'call.action.swapVideo': '切换画面',
2064
+ 'call.action.fillVideo': '铺满画面',
2065
+ 'call.action.fitVideo': '显示完整画面',
2066
+ 'call.notification.ongoing': '通话中',
2067
+ 'call.notification.ongoingVideo': '视频通话中',
2068
+ 'call.notification.mute': '静音',
2069
+ 'call.notification.unmute': '取消静音',
2070
+ 'call.notification.cameraOn': '开启摄像头',
2071
+ 'call.notification.cameraOff': '关闭摄像头',
2024
2072
  'call.action.speakerOn': '打开扬声器',
2025
2073
  'call.action.speakerOff': '关闭扬声器',
2026
2074
  'call.action.startAudioCall': '发起语音通话',
package/src/main.ts CHANGED
@@ -91,6 +91,9 @@ export type {
91
91
  ChatTextStyle,
92
92
  VideoCallsConfig,
93
93
  VideoCallIcons,
94
+ OngoingCallNotification,
95
+ OngoingCallNotificationAction,
96
+ OngoingCallNotificationState,
94
97
  } from './types/types';
95
98
  export type { Iso639_1Codes } from './types/models/language.model';
96
99
  export type { TranslateMode } from './utils/translateModePolicy';
@@ -1023,6 +1023,54 @@ export interface VideoCallsConfig {
1023
1023
  showScreenShare?: boolean;
1024
1024
  /** Custom icons for the call control bar / ring screen. */
1025
1025
  icons?: VideoCallIcons;
1026
+ /**
1027
+ * The system "call in progress" surface outside the app, typically an
1028
+ * Android ongoing-call notification (a foreground service, which Android
1029
+ * also needs to keep the microphone and camera alive in the background).
1030
+ * Native code, so the host supplies it; the SDK drives it from the call
1031
+ * state and handles its buttons. On iOS the same role is played by
1032
+ * CallKit (`react-native-callkeep`), which the SDK uses on its own.
1033
+ */
1034
+ ongoingCallNotification?: OngoingCallNotification;
1035
+ }
1036
+
1037
+ /** What the ongoing-call notification should show. Sent on every change. */
1038
+ export interface OngoingCallNotificationState {
1039
+ callId: string;
1040
+ /** The peer's display name. */
1041
+ title: string;
1042
+ /** Localized second line, e.g. "Ongoing video call" or "Connecting...". */
1043
+ text: string;
1044
+ kind: 'audio' | 'video';
1045
+ /** Epoch ms the call connected, for a running timer; null before. */
1046
+ connectedAt: number | null;
1047
+ micOn: boolean;
1048
+ cameraOn: boolean;
1049
+ /** Localized button labels. */
1050
+ labels: {
1051
+ hangUp: string;
1052
+ mute: string;
1053
+ unmute: string;
1054
+ cameraOn: string;
1055
+ cameraOff: string;
1056
+ };
1057
+ }
1058
+
1059
+ export type OngoingCallNotificationAction =
1060
+ | 'hangUp'
1061
+ | 'toggleMic'
1062
+ | 'toggleCamera'
1063
+ /** The notification itself was tapped and brought the app forward. */
1064
+ | 'open';
1065
+
1066
+ export interface OngoingCallNotification {
1067
+ /** Create the notification, or update it if it is already shown. */
1068
+ show: (state: OngoingCallNotificationState) => void;
1069
+ hide: () => void;
1070
+ /** Returns the unsubscribe function. */
1071
+ addActionListener: (
1072
+ listener: (action: OngoingCallNotificationAction) => void
1073
+ ) => () => void;
1026
1074
  }
1027
1075
 
1028
1076
  interface ConfigRoom {
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated by scripts/sync-version.mjs on `npm version`.
2
2
  // Edit package.json's version instead of this file.
3
- export const ETHORA_CHAT_COMPONENT_VERSION = '26.10.4';
3
+ export const ETHORA_CHAT_COMPONENT_VERSION = '26.10.5';
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useDraggable = void 0;
7
- var _react = require("react");
8
- var _reactNative = require("react-native");
9
- /**
10
- * Drag a floating element around (web's useDraggable, for the self-view
11
- * tile and the minimized call panel). The offset is kept between drags.
12
- *
13
- * The responder only claims the gesture once the finger actually moves a
14
- * few points, so taps still reach the buttons inside the dragged element.
15
- */
16
- const useDraggable = () => {
17
- const position = (0, _react.useRef)(new _reactNative.Animated.ValueXY({
18
- x: 0,
19
- y: 0
20
- })).current;
21
- const offset = (0, _react.useRef)({
22
- x: 0,
23
- y: 0
24
- });
25
- const panHandlers = (0, _react.useMemo)(() => _reactNative.PanResponder.create({
26
- onMoveShouldSetPanResponder: (_event, gesture) => Math.abs(gesture.dx) > 4 || Math.abs(gesture.dy) > 4,
27
- onPanResponderGrant: () => {
28
- position.setOffset(offset.current);
29
- position.setValue({
30
- x: 0,
31
- y: 0
32
- });
33
- },
34
- onPanResponderMove: _reactNative.Animated.event([null, {
35
- dx: position.x,
36
- dy: position.y
37
- }], {
38
- useNativeDriver: false
39
- }),
40
- onPanResponderRelease: (_event, gesture) => {
41
- offset.current = {
42
- x: offset.current.x + gesture.dx,
43
- y: offset.current.y + gesture.dy
44
- };
45
- position.flattenOffset();
46
- },
47
- onPanResponderTerminate: () => {
48
- position.flattenOffset();
49
- }
50
- }).panHandlers, [position]);
51
- return {
52
- panHandlers,
53
- style: {
54
- transform: position.getTranslateTransform()
55
- }
56
- };
57
- };
58
- exports.useDraggable = useDraggable;
59
- //# sourceMappingURL=useDraggable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_reactNative","useDraggable","position","useRef","Animated","ValueXY","x","y","current","offset","panHandlers","useMemo","PanResponder","create","onMoveShouldSetPanResponder","_event","gesture","Math","abs","dx","dy","onPanResponderGrant","setOffset","setValue","onPanResponderMove","event","useNativeDriver","onPanResponderRelease","flattenOffset","onPanResponderTerminate","style","transform","getTranslateTransform","exports"],"sourceRoot":"../../../../src","sources":["components/VideoCalls/useDraggable.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,YAAY,GAAGA,CAAA,KAAM;EAChC,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAAC,IAAIC,qBAAQ,CAACC,OAAO,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC,CAAC,CAAC,CAACC,OAAO;EACrE,MAAMC,MAAM,GAAG,IAAAN,aAAM,EAAC;IAAEG,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC,CAAC;EAErC,MAAMG,WAAW,GAAG,IAAAC,cAAO,EACzB,MACEC,yBAAY,CAACC,MAAM,CAAC;IAClBC,2BAA2B,EAAEA,CAACC,MAAM,EAAEC,OAAO,KAC3CC,IAAI,CAACC,GAAG,CAACF,OAAO,CAACG,EAAE,CAAC,GAAG,CAAC,IAAIF,IAAI,CAACC,GAAG,CAACF,OAAO,CAACI,EAAE,CAAC,GAAG,CAAC;IACtDC,mBAAmB,EAAEA,CAAA,KAAM;MACzBnB,QAAQ,CAACoB,SAAS,CAACb,MAAM,CAACD,OAAO,CAAC;MAClCN,QAAQ,CAACqB,QAAQ,CAAC;QAAEjB,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC,CAAC;IACnC,CAAC;IACDiB,kBAAkB,EAAEpB,qBAAQ,CAACqB,KAAK,CAChC,CAAC,IAAI,EAAE;MAAEN,EAAE,EAAEjB,QAAQ,CAACI,CAAC;MAAEc,EAAE,EAAElB,QAAQ,CAACK;IAAE,CAAC,CAAC,EAC1C;MAAEmB,eAAe,EAAE;IAAM,CAC3B,CAAC;IACDC,qBAAqB,EAAEA,CAACZ,MAAM,EAAEC,OAAO,KAAK;MAC1CP,MAAM,CAACD,OAAO,GAAG;QACfF,CAAC,EAAEG,MAAM,CAACD,OAAO,CAACF,CAAC,GAAGU,OAAO,CAACG,EAAE;QAChCZ,CAAC,EAAEE,MAAM,CAACD,OAAO,CAACD,CAAC,GAAGS,OAAO,CAACI;MAChC,CAAC;MACDlB,QAAQ,CAAC0B,aAAa,CAAC,CAAC;IAC1B,CAAC;IACDC,uBAAuB,EAAEA,CAAA,KAAM;MAC7B3B,QAAQ,CAAC0B,aAAa,CAAC,CAAC;IAC1B;EACF,CAAC,CAAC,CAAClB,WAAW,EAChB,CAACR,QAAQ,CACX,CAAC;EAED,OAAO;IACLQ,WAAW;IACXoB,KAAK,EAAE;MAAEC,SAAS,EAAE7B,QAAQ,CAAC8B,qBAAqB,CAAC;IAAE;EACvD,CAAC;AACH,CAAC;AAACC,OAAA,CAAAhC,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- import { useMemo, useRef } from 'react';
4
- import { Animated, PanResponder } from 'react-native';
5
-
6
- /**
7
- * Drag a floating element around (web's useDraggable, for the self-view
8
- * tile and the minimized call panel). The offset is kept between drags.
9
- *
10
- * The responder only claims the gesture once the finger actually moves a
11
- * few points, so taps still reach the buttons inside the dragged element.
12
- */
13
- export const useDraggable = () => {
14
- const position = useRef(new Animated.ValueXY({
15
- x: 0,
16
- y: 0
17
- })).current;
18
- const offset = useRef({
19
- x: 0,
20
- y: 0
21
- });
22
- const panHandlers = useMemo(() => PanResponder.create({
23
- onMoveShouldSetPanResponder: (_event, gesture) => Math.abs(gesture.dx) > 4 || Math.abs(gesture.dy) > 4,
24
- onPanResponderGrant: () => {
25
- position.setOffset(offset.current);
26
- position.setValue({
27
- x: 0,
28
- y: 0
29
- });
30
- },
31
- onPanResponderMove: Animated.event([null, {
32
- dx: position.x,
33
- dy: position.y
34
- }], {
35
- useNativeDriver: false
36
- }),
37
- onPanResponderRelease: (_event, gesture) => {
38
- offset.current = {
39
- x: offset.current.x + gesture.dx,
40
- y: offset.current.y + gesture.dy
41
- };
42
- position.flattenOffset();
43
- },
44
- onPanResponderTerminate: () => {
45
- position.flattenOffset();
46
- }
47
- }).panHandlers, [position]);
48
- return {
49
- panHandlers,
50
- style: {
51
- transform: position.getTranslateTransform()
52
- }
53
- };
54
- };
55
- //# sourceMappingURL=useDraggable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useMemo","useRef","Animated","PanResponder","useDraggable","position","ValueXY","x","y","current","offset","panHandlers","create","onMoveShouldSetPanResponder","_event","gesture","Math","abs","dx","dy","onPanResponderGrant","setOffset","setValue","onPanResponderMove","event","useNativeDriver","onPanResponderRelease","flattenOffset","onPanResponderTerminate","style","transform","getTranslateTransform"],"sourceRoot":"../../../../src","sources":["components/VideoCalls/useDraggable.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACvC,SAASC,QAAQ,EAAEC,YAAY,QAAQ,cAAc;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAChC,MAAMC,QAAQ,GAAGJ,MAAM,CAAC,IAAIC,QAAQ,CAACI,OAAO,CAAC;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC,CAAC,CAAC,CAACC,OAAO;EACrE,MAAMC,MAAM,GAAGT,MAAM,CAAC;IAAEM,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC,CAAC;EAErC,MAAMG,WAAW,GAAGX,OAAO,CACzB,MACEG,YAAY,CAACS,MAAM,CAAC;IAClBC,2BAA2B,EAAEA,CAACC,MAAM,EAAEC,OAAO,KAC3CC,IAAI,CAACC,GAAG,CAACF,OAAO,CAACG,EAAE,CAAC,GAAG,CAAC,IAAIF,IAAI,CAACC,GAAG,CAACF,OAAO,CAACI,EAAE,CAAC,GAAG,CAAC;IACtDC,mBAAmB,EAAEA,CAAA,KAAM;MACzBf,QAAQ,CAACgB,SAAS,CAACX,MAAM,CAACD,OAAO,CAAC;MAClCJ,QAAQ,CAACiB,QAAQ,CAAC;QAAEf,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAC,CAAC;IACnC,CAAC;IACDe,kBAAkB,EAAErB,QAAQ,CAACsB,KAAK,CAChC,CAAC,IAAI,EAAE;MAAEN,EAAE,EAAEb,QAAQ,CAACE,CAAC;MAAEY,EAAE,EAAEd,QAAQ,CAACG;IAAE,CAAC,CAAC,EAC1C;MAAEiB,eAAe,EAAE;IAAM,CAC3B,CAAC;IACDC,qBAAqB,EAAEA,CAACZ,MAAM,EAAEC,OAAO,KAAK;MAC1CL,MAAM,CAACD,OAAO,GAAG;QACfF,CAAC,EAAEG,MAAM,CAACD,OAAO,CAACF,CAAC,GAAGQ,OAAO,CAACG,EAAE;QAChCV,CAAC,EAAEE,MAAM,CAACD,OAAO,CAACD,CAAC,GAAGO,OAAO,CAACI;MAChC,CAAC;MACDd,QAAQ,CAACsB,aAAa,CAAC,CAAC;IAC1B,CAAC;IACDC,uBAAuB,EAAEA,CAAA,KAAM;MAC7BvB,QAAQ,CAACsB,aAAa,CAAC,CAAC;IAC1B;EACF,CAAC,CAAC,CAAChB,WAAW,EAChB,CAACN,QAAQ,CACX,CAAC;EAED,OAAO;IACLM,WAAW;IACXkB,KAAK,EAAE;MAAEC,SAAS,EAAEzB,QAAQ,CAAC0B,qBAAqB,CAAC;IAAE;EACvD,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,19 +0,0 @@
1
- import { Animated } from 'react-native';
2
- /**
3
- * Drag a floating element around (web's useDraggable, for the self-view
4
- * tile and the minimized call panel). The offset is kept between drags.
5
- *
6
- * The responder only claims the gesture once the finger actually moves a
7
- * few points, so taps still reach the buttons inside the dragged element.
8
- */
9
- export declare const useDraggable: () => {
10
- panHandlers: import("react-native").GestureResponderHandlers;
11
- style: {
12
- transform: [{
13
- translateX: Animated.AnimatedValue;
14
- }, {
15
- translateY: Animated.AnimatedValue;
16
- }];
17
- };
18
- };
19
- //# sourceMappingURL=useDraggable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../../../src/components/VideoCalls/useDraggable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;;CAmCxB,CAAC"}
@@ -1,46 +0,0 @@
1
- import { useMemo, useRef } from 'react';
2
- import { Animated, PanResponder } from 'react-native';
3
-
4
- /**
5
- * Drag a floating element around (web's useDraggable, for the self-view
6
- * tile and the minimized call panel). The offset is kept between drags.
7
- *
8
- * The responder only claims the gesture once the finger actually moves a
9
- * few points, so taps still reach the buttons inside the dragged element.
10
- */
11
- export const useDraggable = () => {
12
- const position = useRef(new Animated.ValueXY({ x: 0, y: 0 })).current;
13
- const offset = useRef({ x: 0, y: 0 });
14
-
15
- const panHandlers = useMemo(
16
- () =>
17
- PanResponder.create({
18
- onMoveShouldSetPanResponder: (_event, gesture) =>
19
- Math.abs(gesture.dx) > 4 || Math.abs(gesture.dy) > 4,
20
- onPanResponderGrant: () => {
21
- position.setOffset(offset.current);
22
- position.setValue({ x: 0, y: 0 });
23
- },
24
- onPanResponderMove: Animated.event(
25
- [null, { dx: position.x, dy: position.y }],
26
- { useNativeDriver: false }
27
- ),
28
- onPanResponderRelease: (_event, gesture) => {
29
- offset.current = {
30
- x: offset.current.x + gesture.dx,
31
- y: offset.current.y + gesture.dy,
32
- };
33
- position.flattenOffset();
34
- },
35
- onPanResponderTerminate: () => {
36
- position.flattenOffset();
37
- },
38
- }).panHandlers,
39
- [position]
40
- );
41
-
42
- return {
43
- panHandlers,
44
- style: { transform: position.getTranslateTransform() },
45
- };
46
- };