@stream-io/video-react-native-sdk 0.0.1-alpha.141

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 (360) hide show
  1. package/CHANGELOG.md +739 -0
  2. package/LICENSE +219 -0
  3. package/README.md +19 -0
  4. package/dist/__tests__/components/ActiveCall.test.d.ts +1 -0
  5. package/dist/__tests__/components/ActiveCall.test.js +89 -0
  6. package/dist/__tests__/components/ActiveCall.test.js.map +1 -0
  7. package/dist/__tests__/components/Avatar.test.d.ts +1 -0
  8. package/dist/__tests__/components/Avatar.test.js +34 -0
  9. package/dist/__tests__/components/Avatar.test.js.map +1 -0
  10. package/dist/__tests__/components/ParticipantView.test.d.ts +1 -0
  11. package/dist/__tests__/components/ParticipantView.test.js +66 -0
  12. package/dist/__tests__/components/ParticipantView.test.js.map +1 -0
  13. package/dist/__tests__/mocks/call.d.ts +2 -0
  14. package/dist/__tests__/mocks/call.js +21 -0
  15. package/dist/__tests__/mocks/call.js.map +1 -0
  16. package/dist/__tests__/mocks/client.d.ts +2 -0
  17. package/dist/__tests__/mocks/client.js +31 -0
  18. package/dist/__tests__/mocks/client.js.map +1 -0
  19. package/dist/__tests__/mocks/participant.d.ts +3 -0
  20. package/dist/__tests__/mocks/participant.js +25 -0
  21. package/dist/__tests__/mocks/participant.js.map +1 -0
  22. package/dist/__tests__/utils/RNTLTools.d.ts +15 -0
  23. package/dist/__tests__/utils/RNTLTools.js +54 -0
  24. package/dist/__tests__/utils/RNTLTools.js.map +1 -0
  25. package/dist/index.d.ts +9 -0
  26. package/dist/index.js +39 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/jest-setup.d.ts +1 -0
  29. package/dist/jest-setup.js +34 -0
  30. package/dist/jest-setup.js.map +1 -0
  31. package/dist/src/components/ActiveCall.d.ts +18 -0
  32. package/dist/src/components/ActiveCall.js +117 -0
  33. package/dist/src/components/ActiveCall.js.map +1 -0
  34. package/dist/src/components/Avatar.d.ts +25 -0
  35. package/dist/src/components/Avatar.js +55 -0
  36. package/dist/src/components/Avatar.js.map +1 -0
  37. package/dist/src/components/CallControlsButton.d.ts +22 -0
  38. package/dist/src/components/CallControlsButton.js +43 -0
  39. package/dist/src/components/CallControlsButton.js.map +1 -0
  40. package/dist/src/components/CallControlsView.d.ts +9 -0
  41. package/dist/src/components/CallControlsView.js +95 -0
  42. package/dist/src/components/CallControlsView.js.map +1 -0
  43. package/dist/src/components/CallParticipantsBadge.d.ts +1 -0
  44. package/dist/src/components/CallParticipantsBadge.js +48 -0
  45. package/dist/src/components/CallParticipantsBadge.js.map +1 -0
  46. package/dist/src/components/CallParticipantsInfoView.d.ts +21 -0
  47. package/dist/src/components/CallParticipantsInfoView.js +213 -0
  48. package/dist/src/components/CallParticipantsInfoView.js.map +1 -0
  49. package/dist/src/components/CallParticipantsList.d.ts +25 -0
  50. package/dist/src/components/CallParticipantsList.js +124 -0
  51. package/dist/src/components/CallParticipantsList.js.map +1 -0
  52. package/dist/src/components/CallParticipantsOptions.d.ts +8 -0
  53. package/dist/src/components/CallParticipantsOptions.js +189 -0
  54. package/dist/src/components/CallParticipantsOptions.js.map +1 -0
  55. package/dist/src/components/CallParticipantsSpotlightView.d.ts +1 -0
  56. package/dist/src/components/CallParticipantsSpotlightView.js +40 -0
  57. package/dist/src/components/CallParticipantsSpotlightView.js.map +1 -0
  58. package/dist/src/components/CallParticipantsView.d.ts +1 -0
  59. package/dist/src/components/CallParticipantsView.js +31 -0
  60. package/dist/src/components/CallParticipantsView.js.map +1 -0
  61. package/dist/src/components/IncomingCallView.d.ts +1 -0
  62. package/dist/src/components/IncomingCallView.js +98 -0
  63. package/dist/src/components/IncomingCallView.js.map +1 -0
  64. package/dist/src/components/LobbyView.d.ts +1 -0
  65. package/dist/src/components/LobbyView.js +215 -0
  66. package/dist/src/components/LobbyView.js.map +1 -0
  67. package/dist/src/components/LocalVideoView.d.ts +34 -0
  68. package/dist/src/components/LocalVideoView.js +100 -0
  69. package/dist/src/components/LocalVideoView.js.map +1 -0
  70. package/dist/src/components/NetworkQualityIndicator.d.ts +8 -0
  71. package/dist/src/components/NetworkQualityIndicator.js +36 -0
  72. package/dist/src/components/NetworkQualityIndicator.js.map +1 -0
  73. package/dist/src/components/OutgoingCallView.d.ts +1 -0
  74. package/dist/src/components/OutgoingCallView.js +103 -0
  75. package/dist/src/components/OutgoingCallView.js.map +1 -0
  76. package/dist/src/components/ParticipantReaction.d.ts +7 -0
  77. package/dist/src/components/ParticipantReaction.js +45 -0
  78. package/dist/src/components/ParticipantReaction.js.map +1 -0
  79. package/dist/src/components/ParticipantView.d.ts +42 -0
  80. package/dist/src/components/ParticipantView.js +256 -0
  81. package/dist/src/components/ParticipantView.js.map +1 -0
  82. package/dist/src/components/ReactionsModal.d.ts +7 -0
  83. package/dist/src/components/ReactionsModal.js +65 -0
  84. package/dist/src/components/ReactionsModal.js.map +1 -0
  85. package/dist/src/components/ToggleAudioButton.d.ts +1 -0
  86. package/dist/src/components/ToggleAudioButton.js +78 -0
  87. package/dist/src/components/ToggleAudioButton.js.map +1 -0
  88. package/dist/src/components/ToggleVideoButton.d.ts +1 -0
  89. package/dist/src/components/ToggleVideoButton.js +78 -0
  90. package/dist/src/components/ToggleVideoButton.js.map +1 -0
  91. package/dist/src/components/UserInfoView.d.ts +13 -0
  92. package/dist/src/components/UserInfoView.js +82 -0
  93. package/dist/src/components/UserInfoView.js.map +1 -0
  94. package/dist/src/components/VideoRenderer.d.ts +65 -0
  95. package/dist/src/components/VideoRenderer.js +18 -0
  96. package/dist/src/components/VideoRenderer.js.map +1 -0
  97. package/dist/src/components/index.d.ts +12 -0
  98. package/dist/src/components/index.js +29 -0
  99. package/dist/src/components/index.js.map +1 -0
  100. package/dist/src/constants/A11yLabels.d.ts +20 -0
  101. package/dist/src/constants/A11yLabels.js +29 -0
  102. package/dist/src/constants/A11yLabels.js.map +1 -0
  103. package/dist/src/constants/index.d.ts +11 -0
  104. package/dist/src/constants/index.js +30 -0
  105. package/dist/src/constants/index.js.map +1 -0
  106. package/dist/src/contexts/StreamVideoContext/createStoreContext.d.ts +14 -0
  107. package/dist/src/contexts/StreamVideoContext/createStoreContext.js +100 -0
  108. package/dist/src/contexts/StreamVideoContext/createStoreContext.js.map +1 -0
  109. package/dist/src/contexts/StreamVideoContext/index.d.ts +30 -0
  110. package/dist/src/contexts/StreamVideoContext/index.js +18 -0
  111. package/dist/src/contexts/StreamVideoContext/index.js.map +1 -0
  112. package/dist/src/contexts/index.d.ts +1 -0
  113. package/dist/src/contexts/index.js +18 -0
  114. package/dist/src/contexts/index.js.map +1 -0
  115. package/dist/src/hooks/index.d.ts +10 -0
  116. package/dist/src/hooks/index.js +27 -0
  117. package/dist/src/hooks/index.js.map +1 -0
  118. package/dist/src/hooks/useCallControls.d.ts +14 -0
  119. package/dist/src/hooks/useCallControls.js +148 -0
  120. package/dist/src/hooks/useCallControls.js.map +1 -0
  121. package/dist/src/hooks/useCallCycleEffect.d.ts +8 -0
  122. package/dist/src/hooks/useCallCycleEffect.js +62 -0
  123. package/dist/src/hooks/useCallCycleEffect.js.map +1 -0
  124. package/dist/src/hooks/useCallKeep.d.ts +11 -0
  125. package/dist/src/hooks/useCallKeep.js +41 -0
  126. package/dist/src/hooks/useCallKeep.js.map +1 -0
  127. package/dist/src/hooks/useCreateStreamVideoClient.d.ts +33 -0
  128. package/dist/src/hooks/useCreateStreamVideoClient.js +40 -0
  129. package/dist/src/hooks/useCreateStreamVideoClient.js.map +1 -0
  130. package/dist/src/hooks/useIncallManager.d.ts +13 -0
  131. package/dist/src/hooks/useIncallManager.js +24 -0
  132. package/dist/src/hooks/useIncallManager.js.map +1 -0
  133. package/dist/src/hooks/useLocalVideoStream.d.ts +7 -0
  134. package/dist/src/hooks/useLocalVideoStream.js +34 -0
  135. package/dist/src/hooks/useLocalVideoStream.js.map +1 -0
  136. package/dist/src/hooks/useMutingState.d.ts +12 -0
  137. package/dist/src/hooks/useMutingState.js +25 -0
  138. package/dist/src/hooks/useMutingState.js.map +1 -0
  139. package/dist/src/hooks/usePermissionNotification.d.ts +18 -0
  140. package/dist/src/hooks/usePermissionNotification.js +33 -0
  141. package/dist/src/hooks/usePermissionNotification.js.map +1 -0
  142. package/dist/src/hooks/usePermissionRequest.d.ts +1 -0
  143. package/dist/src/hooks/usePermissionRequest.js +62 -0
  144. package/dist/src/hooks/usePermissionRequest.js.map +1 -0
  145. package/dist/src/hooks/usePublishMediaStreams.d.ts +6 -0
  146. package/dist/src/hooks/usePublishMediaStreams.js +49 -0
  147. package/dist/src/hooks/usePublishMediaStreams.js.map +1 -0
  148. package/dist/src/icons/ArrowRight.d.ts +5 -0
  149. package/dist/src/icons/ArrowRight.js +9 -0
  150. package/dist/src/icons/ArrowRight.js.map +1 -0
  151. package/dist/src/icons/CameraSwitch.d.ts +5 -0
  152. package/dist/src/icons/CameraSwitch.js +9 -0
  153. package/dist/src/icons/CameraSwitch.js.map +1 -0
  154. package/dist/src/icons/Chat.d.ts +5 -0
  155. package/dist/src/icons/Chat.js +9 -0
  156. package/dist/src/icons/Chat.js.map +1 -0
  157. package/dist/src/icons/Cross.d.ts +5 -0
  158. package/dist/src/icons/Cross.js +9 -0
  159. package/dist/src/icons/Cross.js.map +1 -0
  160. package/dist/src/icons/Mic.d.ts +5 -0
  161. package/dist/src/icons/Mic.js +10 -0
  162. package/dist/src/icons/Mic.js.map +1 -0
  163. package/dist/src/icons/MicOff.d.ts +5 -0
  164. package/dist/src/icons/MicOff.js +9 -0
  165. package/dist/src/icons/MicOff.js.map +1 -0
  166. package/dist/src/icons/Participants.d.ts +5 -0
  167. package/dist/src/icons/Participants.js +9 -0
  168. package/dist/src/icons/Participants.js.map +1 -0
  169. package/dist/src/icons/Phone.d.ts +5 -0
  170. package/dist/src/icons/Phone.js +9 -0
  171. package/dist/src/icons/Phone.js.map +1 -0
  172. package/dist/src/icons/PhoneDown.d.ts +5 -0
  173. package/dist/src/icons/PhoneDown.js +10 -0
  174. package/dist/src/icons/PhoneDown.js.map +1 -0
  175. package/dist/src/icons/Pin.d.ts +5 -0
  176. package/dist/src/icons/Pin.js +9 -0
  177. package/dist/src/icons/Pin.js.map +1 -0
  178. package/dist/src/icons/Reaction.d.ts +5 -0
  179. package/dist/src/icons/Reaction.js +9 -0
  180. package/dist/src/icons/Reaction.js.map +1 -0
  181. package/dist/src/icons/ScreenShare.d.ts +5 -0
  182. package/dist/src/icons/ScreenShare.js +40 -0
  183. package/dist/src/icons/ScreenShare.js.map +1 -0
  184. package/dist/src/icons/Settings.d.ts +5 -0
  185. package/dist/src/icons/Settings.js +34 -0
  186. package/dist/src/icons/Settings.js.map +1 -0
  187. package/dist/src/icons/Spotlight.d.ts +5 -0
  188. package/dist/src/icons/Spotlight.js +9 -0
  189. package/dist/src/icons/Spotlight.js.map +1 -0
  190. package/dist/src/icons/ThreeDots.d.ts +5 -0
  191. package/dist/src/icons/ThreeDots.js +11 -0
  192. package/dist/src/icons/ThreeDots.js.map +1 -0
  193. package/dist/src/icons/Video.d.ts +5 -0
  194. package/dist/src/icons/Video.js +9 -0
  195. package/dist/src/icons/Video.js.map +1 -0
  196. package/dist/src/icons/VideoDisabled.d.ts +5 -0
  197. package/dist/src/icons/VideoDisabled.js +10 -0
  198. package/dist/src/icons/VideoDisabled.js.map +1 -0
  199. package/dist/src/icons/VideoOff.d.ts +5 -0
  200. package/dist/src/icons/VideoOff.js +10 -0
  201. package/dist/src/icons/VideoOff.js.map +1 -0
  202. package/dist/src/icons/VideoSlash.d.ts +5 -0
  203. package/dist/src/icons/VideoSlash.js +10 -0
  204. package/dist/src/icons/VideoSlash.js.map +1 -0
  205. package/dist/src/icons/index.d.ts +19 -0
  206. package/dist/src/icons/index.js +36 -0
  207. package/dist/src/icons/index.js.map +1 -0
  208. package/dist/src/providers/MediaDevices.d.ts +9 -0
  209. package/dist/src/providers/MediaDevices.js +43 -0
  210. package/dist/src/providers/MediaDevices.js.map +1 -0
  211. package/dist/src/providers/StreamCall.d.ts +81 -0
  212. package/dist/src/providers/StreamCall.js +74 -0
  213. package/dist/src/providers/StreamCall.js.map +1 -0
  214. package/dist/src/providers/StreamVideo.d.ts +10 -0
  215. package/dist/src/providers/StreamVideo.js +66 -0
  216. package/dist/src/providers/StreamVideo.js.map +1 -0
  217. package/dist/src/providers/index.d.ts +2 -0
  218. package/dist/src/providers/index.js +19 -0
  219. package/dist/src/providers/index.js.map +1 -0
  220. package/dist/src/theme/avatar.d.ts +2 -0
  221. package/dist/src/theme/avatar.js +11 -0
  222. package/dist/src/theme/avatar.js.map +1 -0
  223. package/dist/src/theme/button.d.ts +2 -0
  224. package/dist/src/theme/button.js +11 -0
  225. package/dist/src/theme/button.js.map +1 -0
  226. package/dist/src/theme/colors.d.ts +3 -0
  227. package/dist/src/theme/colors.js +49 -0
  228. package/dist/src/theme/colors.js.map +1 -0
  229. package/dist/src/theme/constants.d.ts +47 -0
  230. package/dist/src/theme/constants.js +54 -0
  231. package/dist/src/theme/constants.js.map +1 -0
  232. package/dist/src/theme/fonts.d.ts +2 -0
  233. package/dist/src/theme/fonts.js +67 -0
  234. package/dist/src/theme/fonts.js.map +1 -0
  235. package/dist/src/theme/icon.d.ts +2 -0
  236. package/dist/src/theme/icon.js +11 -0
  237. package/dist/src/theme/icon.js.map +1 -0
  238. package/dist/src/theme/index.d.ts +2 -0
  239. package/dist/src/theme/index.js +26 -0
  240. package/dist/src/theme/index.js.map +1 -0
  241. package/dist/src/theme/margin.d.ts +2 -0
  242. package/dist/src/theme/margin.js +11 -0
  243. package/dist/src/theme/margin.js.map +1 -0
  244. package/dist/src/theme/padding.d.ts +2 -0
  245. package/dist/src/theme/padding.js +11 -0
  246. package/dist/src/theme/padding.js.map +1 -0
  247. package/dist/src/theme/rounded.d.ts +2 -0
  248. package/dist/src/theme/rounded.js +11 -0
  249. package/dist/src/theme/rounded.js.map +1 -0
  250. package/dist/src/theme/spacing.d.ts +2 -0
  251. package/dist/src/theme/spacing.js +11 -0
  252. package/dist/src/theme/spacing.js.map +1 -0
  253. package/dist/src/theme/types.d.ts +45 -0
  254. package/dist/src/theme/types.js +3 -0
  255. package/dist/src/theme/types.js.map +1 -0
  256. package/dist/src/utils/StreamVideoRN.d.ts +25 -0
  257. package/dist/src/utils/StreamVideoRN.js +23 -0
  258. package/dist/src/utils/StreamVideoRN.js.map +1 -0
  259. package/dist/src/utils/hooks/index.d.ts +3 -0
  260. package/dist/src/utils/hooks/index.js +20 -0
  261. package/dist/src/utils/hooks/index.js.map +1 -0
  262. package/dist/src/utils/hooks/useAppStateListener.d.ts +1 -0
  263. package/dist/src/utils/hooks/useAppStateListener.js +41 -0
  264. package/dist/src/utils/hooks/useAppStateListener.js.map +1 -0
  265. package/dist/src/utils/hooks/useDebouncedValue.d.ts +7 -0
  266. package/dist/src/utils/hooks/useDebouncedValue.js +22 -0
  267. package/dist/src/utils/hooks/useDebouncedValue.js.map +1 -0
  268. package/dist/src/utils/hooks/usePrevious.d.ts +1 -0
  269. package/dist/src/utils/hooks/usePrevious.js +13 -0
  270. package/dist/src/utils/hooks/usePrevious.js.map +1 -0
  271. package/dist/src/utils/index.d.ts +5 -0
  272. package/dist/src/utils/index.js +53 -0
  273. package/dist/src/utils/index.js.map +1 -0
  274. package/dist/src/utils/verifyAndroidBluetoothPermissions.d.ts +1 -0
  275. package/dist/src/utils/verifyAndroidBluetoothPermissions.js +30 -0
  276. package/dist/src/utils/verifyAndroidBluetoothPermissions.js.map +1 -0
  277. package/index.ts +22 -0
  278. package/package.json +70 -0
  279. package/src/components/ActiveCall.tsx +122 -0
  280. package/src/components/Avatar.tsx +88 -0
  281. package/src/components/CallControlsButton.tsx +72 -0
  282. package/src/components/CallControlsView.tsx +128 -0
  283. package/src/components/CallParticipantsBadge.tsx +57 -0
  284. package/src/components/CallParticipantsInfoView.tsx +287 -0
  285. package/src/components/CallParticipantsList.tsx +172 -0
  286. package/src/components/CallParticipantsOptions.tsx +248 -0
  287. package/src/components/CallParticipantsSpotlightView.tsx +53 -0
  288. package/src/components/CallParticipantsView.tsx +30 -0
  289. package/src/components/IncomingCallView.tsx +133 -0
  290. package/src/components/LobbyView.tsx +236 -0
  291. package/src/components/LocalVideoView.tsx +141 -0
  292. package/src/components/NetworkQualityIndicator.tsx +72 -0
  293. package/src/components/OutgoingCallView.tsx +133 -0
  294. package/src/components/ParticipantReaction.tsx +59 -0
  295. package/src/components/ParticipantView.tsx +315 -0
  296. package/src/components/ReactionsModal.tsx +90 -0
  297. package/src/components/ToggleAudioButton.tsx +103 -0
  298. package/src/components/ToggleVideoButton.tsx +103 -0
  299. package/src/components/UserInfoView.tsx +118 -0
  300. package/src/components/VideoRenderer.tsx +85 -0
  301. package/src/components/index.ts +12 -0
  302. package/src/constants/A11yLabels.ts +24 -0
  303. package/src/constants/index.ts +28 -0
  304. package/src/contexts/StreamVideoContext/createStoreContext.tsx +117 -0
  305. package/src/contexts/StreamVideoContext/index.tsx +37 -0
  306. package/src/contexts/index.ts +1 -0
  307. package/src/hooks/index.ts +10 -0
  308. package/src/hooks/useCallControls.tsx +186 -0
  309. package/src/hooks/useCallCycleEffect.tsx +68 -0
  310. package/src/hooks/useCallKeep.tsx +51 -0
  311. package/src/hooks/useCreateStreamVideoClient.tsx +77 -0
  312. package/src/hooks/useIncallManager.tsx +23 -0
  313. package/src/hooks/useLocalVideoStream.ts +36 -0
  314. package/src/hooks/useMutingState.ts +24 -0
  315. package/src/hooks/usePermissionNotification.tsx +53 -0
  316. package/src/hooks/usePermissionRequest.tsx +67 -0
  317. package/src/hooks/usePublishMediaStreams.ts +59 -0
  318. package/src/icons/ArrowRight.tsx +16 -0
  319. package/src/icons/CameraSwitch.tsx +14 -0
  320. package/src/icons/Chat.tsx +14 -0
  321. package/src/icons/Cross.tsx +14 -0
  322. package/src/icons/Mic.tsx +18 -0
  323. package/src/icons/MicOff.tsx +14 -0
  324. package/src/icons/Participants.tsx +16 -0
  325. package/src/icons/Phone.tsx +14 -0
  326. package/src/icons/PhoneDown.tsx +15 -0
  327. package/src/icons/Pin.tsx +16 -0
  328. package/src/icons/Reaction.tsx +14 -0
  329. package/src/icons/ScreenShare.tsx +32 -0
  330. package/src/icons/Settings.tsx +13 -0
  331. package/src/icons/Spotlight.tsx +16 -0
  332. package/src/icons/ThreeDots.tsx +13 -0
  333. package/src/icons/Video.tsx +14 -0
  334. package/src/icons/VideoDisabled.tsx +22 -0
  335. package/src/icons/VideoOff.tsx +20 -0
  336. package/src/icons/VideoSlash.tsx +15 -0
  337. package/src/icons/index.tsx +19 -0
  338. package/src/providers/MediaDevices.tsx +45 -0
  339. package/src/providers/StreamCall.tsx +136 -0
  340. package/src/providers/StreamVideo.tsx +50 -0
  341. package/src/providers/index.ts +2 -0
  342. package/src/theme/avatar.ts +9 -0
  343. package/src/theme/button.ts +9 -0
  344. package/src/theme/colors.ts +49 -0
  345. package/src/theme/constants.ts +51 -0
  346. package/src/theme/fonts.ts +65 -0
  347. package/src/theme/icon.ts +9 -0
  348. package/src/theme/index.ts +25 -0
  349. package/src/theme/margin.ts +9 -0
  350. package/src/theme/padding.ts +9 -0
  351. package/src/theme/rounded.ts +9 -0
  352. package/src/theme/spacing.ts +9 -0
  353. package/src/theme/types.ts +64 -0
  354. package/src/utils/StreamVideoRN.ts +35 -0
  355. package/src/utils/hooks/index.ts +3 -0
  356. package/src/utils/hooks/useAppStateListener.ts +48 -0
  357. package/src/utils/hooks/useDebouncedValue.ts +21 -0
  358. package/src/utils/hooks/usePrevious.ts +11 -0
  359. package/src/utils/index.ts +45 -0
  360. package/src/utils/verifyAndroidBluetoothPermissions.ts +31 -0
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@stream-io/video-react-native-sdk",
3
+ "packageManager": "yarn@3.2.4",
4
+ "main": "./dist/index.js",
5
+ "types": "./dist/index.d.ts",
6
+ "license": "See license in LICENSE",
7
+ "scripts": {
8
+ "clean": "rimraf dist",
9
+ "start": "tsc --project tsconfig.json --watch",
10
+ "build": "tsc --project tsconfig.json",
11
+ "test": "jest --coverage",
12
+ "generate-docs": "../../scripts/generate-docs.sh reactnative @stream-io/video-react-native-sdk react-native-sdk"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "src",
17
+ "index.ts",
18
+ "package.json",
19
+ "README.md",
20
+ "LICENSE",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "dependencies": {
24
+ "@stream-io/i18n": "^0.0.2",
25
+ "@stream-io/video-client": "^0.0.8",
26
+ "@stream-io/video-react-bindings": "^0.0.8"
27
+ },
28
+ "peerDependencies": {
29
+ "@react-native-community/netinfo": ">=9.0.0",
30
+ "react": ">=17.0.0",
31
+ "react-native": ">=0.67.0",
32
+ "react-native-callkeep": ">=4.3.4",
33
+ "react-native-incall-manager": "^4.0.0",
34
+ "react-native-svg": ">=13.6.0",
35
+ "react-native-webrtc": ">=111.0.1"
36
+ },
37
+ "peerDependenciesMeta": {
38
+ "react-native-callkeep": {
39
+ "optional": true
40
+ }
41
+ },
42
+ "devDependencies": {
43
+ "@babel/preset-typescript": "^7.21.5",
44
+ "@react-native-community/eslint-config": "^3.2.0",
45
+ "@react-native-community/netinfo": "9.3.9",
46
+ "@testing-library/jest-native": "^5.4.2",
47
+ "@testing-library/react-native": "^12.1.2",
48
+ "@types/jest": "^29.5.1",
49
+ "@types/react": "18.0.26",
50
+ "@types/react-native": "^0.70.4",
51
+ "@types/react-native-incall-manager": "^3.2.1",
52
+ "@types/react-test-renderer": "^18",
53
+ "@types/rimraf": "^3.0.2",
54
+ "jest": "^29.5.0",
55
+ "react-native": "^0.71.8",
56
+ "react-native-callkeep": "^4.3.4",
57
+ "react-native-incall-manager": "^4.0.0",
58
+ "react-native-svg": "^13.6.0",
59
+ "react-native-webrtc": "~106.0.4",
60
+ "react-test-renderer": "^18.2.0",
61
+ "replace-in-file": "^6.3.5",
62
+ "rimraf": "^3.0.2",
63
+ "ts-jest": "^29.1.0",
64
+ "ts-node": "^10.9.1",
65
+ "typedoc": "^0.24.7",
66
+ "typedoc-plugin-markdown": "^3.15.3",
67
+ "typescript": "^4.9.5"
68
+ },
69
+ "version": "0.0.1-alpha.141"
70
+ }
@@ -0,0 +1,122 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import {
3
+ useCall,
4
+ useHasOngoingScreenShare,
5
+ } from '@stream-io/video-react-bindings';
6
+ import { StyleSheet, View } from 'react-native';
7
+ import { CallControlsView } from './CallControlsView';
8
+ import { CallParticipantsView } from './CallParticipantsView';
9
+ import { CallParticipantsSpotlightView } from './CallParticipantsSpotlightView';
10
+ import { theme } from '../theme';
11
+ import { useIncallManager } from '../hooks/useIncallManager';
12
+ import { usePublishMediaStreams } from '../hooks/usePublishMediaStreams';
13
+ import { usePermissionRequest } from '../hooks/usePermissionRequest';
14
+ import { CallParticipantsBadge } from './CallParticipantsBadge';
15
+ import { verifyAndroidBluetoothPermissions } from '../utils/verifyAndroidBluetoothPermissions';
16
+ import { CallingState } from '@stream-io/video-client';
17
+
18
+ /**
19
+ * Props to be passed for the ActiveCall component.
20
+ */
21
+ export interface ActiveCallProps {
22
+ /**
23
+ * The mode of the call view. Defaults to 'grid'.
24
+ * Note: when there is atleast one screen share, the mode is automatically set to 'spotlight'.
25
+ */
26
+ mode?: 'grid' | 'spotlight';
27
+ }
28
+ /**
29
+ * View for an active call, includes call controls and participant handling.
30
+ *
31
+ * | 2 Participants | 3 Participants | 4 Participants | 5 Participants |
32
+ * | :--- | :--- | :--- | :----: |
33
+ * |![active-call-2](https://user-images.githubusercontent.com/25864161/217351458-6cb4b0df-6071-45f5-89b6-fe650d950502.png) | ![active-call-3](https://user-images.githubusercontent.com/25864161/217351461-908a1887-7cf0-4945-bedd-d6598902be2d.png) | ![active-call-4](https://user-images.githubusercontent.com/25864161/217351465-b2a22178-7593-4639-96dd-6fb692af2dc5.png) | ![active-call-5](https://user-images.githubusercontent.com/25864161/217351453-6547b0a3-4ecc-435f-b2d9-7d511d5d0328.png) |
34
+ */
35
+
36
+ export const ActiveCall = (props: ActiveCallProps) => {
37
+ const activeCall = useCall();
38
+ const activeCallRef = useRef(activeCall);
39
+ activeCallRef.current = activeCall;
40
+
41
+ useEffect(() => {
42
+ // when the component mounts, we ask for necessary permissions.
43
+ verifyAndroidBluetoothPermissions();
44
+
45
+ return () => {
46
+ if (activeCallRef.current?.state.callingState !== CallingState.LEFT) {
47
+ activeCallRef.current?.leave();
48
+ }
49
+ };
50
+ }, []);
51
+
52
+ if (!activeCall) {
53
+ return null;
54
+ }
55
+ return <InnerActiveCall {...props} />;
56
+ };
57
+
58
+ const InnerActiveCall = (props: ActiveCallProps) => {
59
+ const [height, setHeight] = useState(0);
60
+ const { mode = 'grid' } = props;
61
+ const hasScreenShare = useHasOngoingScreenShare();
62
+
63
+ useIncallManager({ media: 'video', auto: true });
64
+ usePublishMediaStreams();
65
+ usePermissionRequest();
66
+
67
+ const onLayout: React.ComponentProps<typeof View>['onLayout'] = (event) => {
68
+ setHeight(
69
+ // we're saving the CallControlsView height and subtracting an amount of padding.
70
+ // this is done to get the CallParticipants(Screen)View neatly underneath the
71
+ // rounded corners of the CallControlsView.
72
+ Math.trunc(event.nativeEvent.layout.height - theme.spacing.lg * 2),
73
+ );
74
+ };
75
+
76
+ const showSpotLightModeView = mode === 'spotlight' || hasScreenShare;
77
+
78
+ return (
79
+ <View style={styles.container}>
80
+ <View style={styles.iconGroup}>
81
+ <CallParticipantsBadge />
82
+ </View>
83
+
84
+ <View
85
+ style={[
86
+ styles.callParticipantsWrapper,
87
+ { paddingBottom: height + theme.padding.lg },
88
+ ]}
89
+ >
90
+ {showSpotLightModeView ? (
91
+ <CallParticipantsSpotlightView />
92
+ ) : (
93
+ <CallParticipantsView />
94
+ )}
95
+ </View>
96
+ <View onLayout={onLayout} style={styles.callControlsWrapper}>
97
+ <CallControlsView />
98
+ </View>
99
+ </View>
100
+ );
101
+ };
102
+
103
+ const styles = StyleSheet.create({
104
+ container: {
105
+ flex: 1,
106
+ backgroundColor: theme.light.static_grey,
107
+ },
108
+ callParticipantsWrapper: { flex: 1 },
109
+ callControlsWrapper: { position: 'absolute', bottom: 0, left: 0, right: 0 },
110
+ svgContainerStyle: {
111
+ zIndex: 2,
112
+ marginRight: theme.margin.md,
113
+ marginTop: theme.margin.sm,
114
+ },
115
+ iconGroup: {
116
+ display: 'flex',
117
+ flexDirection: 'row',
118
+ alignSelf: 'flex-end',
119
+ alignItems: 'center',
120
+ marginRight: theme.margin.md,
121
+ },
122
+ });
@@ -0,0 +1,88 @@
1
+ import { Image, StyleSheet, Text, View } from 'react-native';
2
+ import React from 'react';
3
+ import type { StreamVideoParticipant } from '@stream-io/video-client';
4
+ import { getInitialsOfName } from '../utils';
5
+ import { theme } from '../theme';
6
+ import { A11yComponents, A11yImages } from '../constants/A11yLabels';
7
+
8
+ /**
9
+ * Props to be passed for the Avatar component.
10
+ */
11
+ export interface AvatarProps {
12
+ /**
13
+ * The participant of which the avatar will be rendered
14
+ */
15
+ participant: StreamVideoParticipant;
16
+ /**
17
+ * The radius of the avatar
18
+ * @defaultValue
19
+ * The default value is `100`
20
+ */
21
+ radius?: number;
22
+ }
23
+
24
+ const DEFAULT_AVATAR_RADIUS = theme.avatar.sm;
25
+
26
+ /**
27
+ * Shows either user's image or initials based on the user state and existence of
28
+ * their image.
29
+ *
30
+ * | User's Image | User's Initials |
31
+ * | :--- | :----: |
32
+ * |![avatar-1](https://user-images.githubusercontent.com/25864161/217467045-2d4c8b4e-d4ec-48c1-8ede-4468854826af.png) | ![avatar-2](https://user-images.githubusercontent.com/25864161/217467043-e7a7f2a1-70a7-4d83-8d1e-6463391194ae.png)|
33
+ */
34
+ export const Avatar = (props: AvatarProps) => {
35
+ const {
36
+ participant: { userId, image, name },
37
+ radius = DEFAULT_AVATAR_RADIUS,
38
+ } = props;
39
+
40
+ const userDetails = name || userId;
41
+ const userLabel = userDetails ? getInitialsOfName(userDetails) : '?';
42
+
43
+ const imageUrl = image;
44
+ return (
45
+ <View
46
+ accessibilityLabel={A11yComponents.PARTICIPANT_AVATAR}
47
+ style={{
48
+ ...styles.container,
49
+ borderRadius: radius / 2,
50
+ height: radius,
51
+ width: radius,
52
+ }}
53
+ >
54
+ {imageUrl ? (
55
+ <Image
56
+ accessibilityLabel={A11yImages.AVATAR}
57
+ source={{
58
+ uri: imageUrl,
59
+ }}
60
+ style={styles.image}
61
+ />
62
+ ) : (
63
+ <Text
64
+ style={{ ...styles.text, fontSize: radius / 2 }}
65
+ numberOfLines={1}
66
+ >
67
+ {userLabel}
68
+ </Text>
69
+ )}
70
+ </View>
71
+ );
72
+ };
73
+
74
+ const styles = StyleSheet.create({
75
+ container: {
76
+ backgroundColor: theme.light.primary,
77
+ justifyContent: 'center',
78
+ overflow: 'hidden',
79
+ },
80
+ image: {
81
+ flex: 1,
82
+ },
83
+ text: {
84
+ color: theme.light.bars,
85
+ textAlign: 'center',
86
+ ...theme.fonts.heading4,
87
+ },
88
+ });
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import {
3
+ Pressable,
4
+ PressableProps,
5
+ StyleProp,
6
+ StyleSheet,
7
+ View,
8
+ ViewStyle,
9
+ } from 'react-native';
10
+ import { theme } from '../theme';
11
+
12
+ interface CallControlsButtonProps {
13
+ /**
14
+ * `onPress` handler called when a single tap gesture is detected.
15
+ */
16
+ onPress?: PressableProps['onPress'];
17
+ /**
18
+ * The background color of the button rendered.
19
+ */
20
+ color?: string;
21
+ /**
22
+ * Style to the Pressable button.
23
+ */
24
+ style?: StyleProp<ViewStyle>;
25
+ /**
26
+ * Style of the SVG rendered inside the button.
27
+ */
28
+ svgContainerStyle?: StyleProp<ViewStyle>;
29
+ }
30
+
31
+ const DEFAULT_ICON_SIZE = theme.icon.md;
32
+ const DEFAULT_BUTTON_SIZE = theme.button.sm;
33
+
34
+ export const CallControlsButton = (
35
+ props: React.PropsWithChildren<CallControlsButtonProps>,
36
+ ) => {
37
+ const { onPress, children, color, style, svgContainerStyle } = props;
38
+
39
+ const pressableStyle: PressableProps['style'] = ({ pressed }) => [
40
+ DEFAULT_BUTTON_SIZE,
41
+ styles.container,
42
+ {
43
+ backgroundColor: color,
44
+ opacity: pressed ? 0.2 : 1,
45
+ },
46
+ style ? style : null,
47
+ ];
48
+
49
+ return (
50
+ <Pressable style={pressableStyle} onPress={onPress}>
51
+ <View
52
+ style={[
53
+ styles.svgContainerStyle,
54
+ DEFAULT_ICON_SIZE,
55
+ svgContainerStyle ?? null,
56
+ ]}
57
+ >
58
+ {children}
59
+ </View>
60
+ </Pressable>
61
+ );
62
+ };
63
+
64
+ const styles = StyleSheet.create({
65
+ container: {
66
+ justifyContent: 'center',
67
+ borderWidth: 1,
68
+ borderColor: theme.light.content_bg,
69
+ alignItems: 'center',
70
+ },
71
+ svgContainerStyle: {},
72
+ });
@@ -0,0 +1,128 @@
1
+ import { StyleSheet, View } from 'react-native';
2
+ import { useCallControls } from '../hooks/useCallControls';
3
+ import { CameraSwitch, Chat, PhoneDown, Reaction } from '../icons';
4
+ import { CallControlsButton } from './CallControlsButton';
5
+ import { theme } from '../theme';
6
+ import { CallingState, OwnCapability } from '@stream-io/video-client';
7
+ import {
8
+ Restricted,
9
+ useCall,
10
+ useCallCallingState,
11
+ } from '@stream-io/video-react-bindings';
12
+ import { useCallback, useState } from 'react';
13
+ import { ReactionModal } from './ReactionsModal';
14
+ import { ToggleAudioButton } from './ToggleAudioButton';
15
+ import { ToggleVideoButton } from './ToggleVideoButton';
16
+
17
+ /**
18
+ * Shows a list/row of controls (mute audio/video, toggle front/back camera, hangup call etc.)
19
+ * the user can trigger within an active call.
20
+ *
21
+ * | Call Controls |
22
+ * | :--- |
23
+ * | ![call-controls-view](https://user-images.githubusercontent.com/25864161/217349666-af0f3278-393e-449d-b30e-2d1b196abe5e.png) |
24
+ */
25
+ export const CallControlsView = () => {
26
+ const [isReactionModalActive, setIsReactionModalActive] =
27
+ useState<boolean>(false);
28
+
29
+ const { isCameraOnFrontFacingMode, toggleCameraFacingMode } =
30
+ useCallControls();
31
+ const call = useCall();
32
+ const callingState = useCallCallingState();
33
+
34
+ const onCallHangup = async () => {
35
+ try {
36
+ if (callingState === CallingState.LEFT) return;
37
+ await call?.leave();
38
+ } catch (err) {
39
+ console.log('Error Leaving call:', err);
40
+ }
41
+ };
42
+
43
+ const muteStatusColor = (status: boolean) => {
44
+ return status ? theme.light.overlay_dark : theme.light.static_white;
45
+ };
46
+
47
+ const onOpenReactionsModalHandler = useCallback(() => {
48
+ setIsReactionModalActive(true);
49
+ }, [setIsReactionModalActive]);
50
+
51
+ return (
52
+ <View style={styles.container}>
53
+ <Restricted requiredGrants={[OwnCapability.CREATE_REACTION]}>
54
+ <CallControlsButton
55
+ onPress={onOpenReactionsModalHandler}
56
+ color={theme.light.static_white}
57
+ style={styles.button}
58
+ >
59
+ <Reaction color={theme.light.static_black} />
60
+ </CallControlsButton>
61
+ </Restricted>
62
+ <ReactionModal
63
+ isReactionModalActive={isReactionModalActive}
64
+ setIsReactionModalActive={setIsReactionModalActive}
65
+ />
66
+ <CallControlsButton
67
+ color={theme.light.static_white}
68
+ onPress={() => null}
69
+ svgContainerStyle={styles.svgContainerStyle}
70
+ style={styles.button}
71
+ >
72
+ <Chat color={theme.light.static_black} />
73
+ </CallControlsButton>
74
+ <ToggleVideoButton />
75
+ <ToggleAudioButton />
76
+ <Restricted requiredGrants={[OwnCapability.SEND_VIDEO]}>
77
+ <CallControlsButton
78
+ onPress={toggleCameraFacingMode}
79
+ color={muteStatusColor(!isCameraOnFrontFacingMode)}
80
+ style={isCameraOnFrontFacingMode ? styles.button : null}
81
+ >
82
+ <CameraSwitch
83
+ color={
84
+ isCameraOnFrontFacingMode
85
+ ? theme.light.static_black
86
+ : theme.light.static_white
87
+ }
88
+ />
89
+ </CallControlsButton>
90
+ </Restricted>
91
+ <CallControlsButton
92
+ onPress={onCallHangup}
93
+ color={theme.light.error}
94
+ style={[styles.button, { shadowColor: theme.light.error }]}
95
+ >
96
+ <PhoneDown color={theme.light.static_white} />
97
+ </CallControlsButton>
98
+ </View>
99
+ );
100
+ };
101
+
102
+ const styles = StyleSheet.create({
103
+ container: {
104
+ flexDirection: 'row',
105
+ justifyContent: 'space-evenly',
106
+ paddingVertical: theme.padding.lg,
107
+ paddingHorizontal: theme.padding.md,
108
+ borderTopLeftRadius: theme.rounded.lg,
109
+ borderTopRightRadius: theme.rounded.lg,
110
+ backgroundColor: theme.light.controls_bg,
111
+ zIndex: 2,
112
+ },
113
+ button: {
114
+ // For iOS
115
+ shadowOffset: {
116
+ width: 0,
117
+ height: 6,
118
+ },
119
+ shadowOpacity: 0.37,
120
+ shadowRadius: 7.49,
121
+
122
+ // For android
123
+ elevation: 6,
124
+ },
125
+ svgContainerStyle: {
126
+ paddingTop: theme.padding.xs,
127
+ },
128
+ });
@@ -0,0 +1,57 @@
1
+ import { Pressable, StyleSheet, Text, View } from 'react-native';
2
+ import { Participants } from '../icons';
3
+ import { useParticipantCount } from '@stream-io/video-react-bindings';
4
+ import { theme } from '../theme';
5
+ import { useCallback, useState } from 'react';
6
+ import { CallParticipantsInfoView } from './CallParticipantsInfoView';
7
+ import { A11yButtons } from '../constants/A11yLabels';
8
+
9
+ export const CallParticipantsBadge = () => {
10
+ const participantCount = useParticipantCount();
11
+ const [isCallParticipantsViewVisible, setIsCallParticipantsViewVisible] =
12
+ useState<boolean>(false);
13
+
14
+ const onOpenCallParticipantsInfoView = useCallback(() => {
15
+ setIsCallParticipantsViewVisible(true);
16
+ }, [setIsCallParticipantsViewVisible]);
17
+
18
+ return (
19
+ <Pressable
20
+ style={styles.participantIcon}
21
+ onPress={onOpenCallParticipantsInfoView}
22
+ accessibilityLabel={A11yButtons.PARTICIPANTS_INFO}
23
+ >
24
+ <View style={styles.badge}>
25
+ <Text style={styles.badgeText}>{participantCount}</Text>
26
+ </View>
27
+ <View style={[styles.svgContainerStyle, theme.icon.md]}>
28
+ <Participants color={theme.light.static_white} />
29
+ </View>
30
+ <CallParticipantsInfoView
31
+ isCallParticipantsViewVisible={isCallParticipantsViewVisible}
32
+ setIsCallParticipantsViewVisible={setIsCallParticipantsViewVisible}
33
+ />
34
+ </Pressable>
35
+ );
36
+ };
37
+
38
+ const styles = StyleSheet.create({
39
+ participantIcon: {
40
+ zIndex: 2,
41
+ },
42
+ svgContainerStyle: {},
43
+ badge: {
44
+ backgroundColor: theme.light.text_low_emphasis,
45
+ borderRadius: theme.rounded.xl,
46
+ padding: theme.padding.xs,
47
+ position: 'relative',
48
+ left: theme.spacing.lg,
49
+ top: theme.spacing.lg,
50
+ zIndex: 2,
51
+ },
52
+ badgeText: {
53
+ color: theme.light.static_white,
54
+ textAlign: 'center',
55
+ ...theme.fonts.caption,
56
+ },
57
+ });