@cometchat/chat-uikit-react-native 4.2.2 → 4.3.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.
Files changed (227) hide show
  1. package/README.md +26 -67
  2. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +2 -1
  6. package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoView.java +796 -0
  7. package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoViewManager.java +172 -0
  8. package/android/src/main/java/com/scalablevideoview/BuildConfig.java +10 -0
  9. package/android/src/main/java/com/scalablevideoview/PivotPoint.java +13 -0
  10. package/android/src/main/java/com/scalablevideoview/ScalableType.java +34 -0
  11. package/android/src/main/java/com/scalablevideoview/ScalableVideoView.java +255 -0
  12. package/android/src/main/java/com/scalablevideoview/ScaleManager.java +188 -0
  13. package/android/src/main/java/com/scalablevideoview/Size.java +20 -0
  14. package/android/src/main/java/com/zipfile/APEZProvider.java +287 -0
  15. package/android/src/main/java/com/zipfile/APKExpansionSupport.java +81 -0
  16. package/android/src/main/java/com/zipfile/ZipResourceFile.java +428 -0
  17. package/android/src/main/res/values/attrs.xml +37 -0
  18. package/ios/FileManager.m +75 -5
  19. package/ios/Video/CCRCTVideo.h +67 -0
  20. package/ios/Video/CCRCTVideo.m +2031 -0
  21. package/ios/Video/CCRCTVideoManager.h +6 -0
  22. package/ios/Video/CCRCTVideoManager.m +133 -0
  23. package/ios/Video/CCRCTVideoPlayerViewController.h +20 -0
  24. package/ios/Video/CCRCTVideoPlayerViewController.m +43 -0
  25. package/ios/Video/CCRCTVideoPlayerViewControllerDelegate.h +7 -0
  26. package/ios/Video/UIView+FindUIViewController.h +15 -0
  27. package/ios/Video/UIView+FindUIViewController.m +21 -0
  28. package/ios/VideoCaching/RCTVideoCache.h +38 -0
  29. package/ios/VideoCaching/RCTVideoCache.m +174 -0
  30. package/ios/VideoPickerModule.h +7 -0
  31. package/ios/VideoPickerModule.mm +95 -0
  32. package/package.json +3 -4
  33. package/react-native-cometchat-ui-kit.podspec +24 -10
  34. package/src/CometChatContacts/CometChatContacts.tsx +12 -9
  35. package/src/CometChatConversations/CometChatConversations.tsx +84 -64
  36. package/src/CometChatDetails/CometChatDetails.tsx +14 -12
  37. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +8 -4
  38. package/src/CometChatGroupMembers/resources/check.png +0 -0
  39. package/src/CometChatGroupMembers/resources/index.ts +2 -0
  40. package/src/CometChatGroups/CometChatGroups.tsx +4 -4
  41. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +57 -15
  42. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +9 -2
  43. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +1 -1
  44. package/src/CometChatMessageList/CometChatMessageList.tsx +596 -181
  45. package/src/CometChatMessageList/MessageListConfiguration.ts +55 -4
  46. package/src/CometChatMessageList/resources/index.ts +5 -1
  47. package/src/CometChatMessageList/resources/leftarrowcurve.png +0 -0
  48. package/src/CometChatMessageList/resources/rightarrowcurve.png +0 -0
  49. package/src/CometChatMessages/CometChatMessages.tsx +1 -1
  50. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +4 -12
  51. package/src/CometChatThreadedMessages/style.ts +3 -1
  52. package/src/CometChatUsers/CometChatUsers.tsx +1 -1
  53. package/src/calls/CallUtils.ts +4 -8
  54. package/src/calls/CallingExtentionDecorator.tsx +5 -2
  55. package/src/calls/CometChatCallBubble/styles.ts +2 -1
  56. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +14 -3
  57. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +9 -9
  58. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +80 -73
  59. package/src/extensions/CollaborativeBubble/styles.ts +2 -0
  60. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +11 -0
  61. package/src/extensions/index.ts +0 -4
  62. package/src/index.ts +53 -8
  63. package/src/shared/CometChatUiKit/CometChatUIKit.ts +14 -2
  64. package/src/shared/constants/UIKitConstants.ts +1 -0
  65. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +6 -0
  66. package/src/shared/events/CometChatUIEventHandler/Listener.ts +8 -0
  67. package/src/shared/events/ListenerInitializer.ts +6 -0
  68. package/src/shared/events/messages.ts +2 -0
  69. package/src/shared/framework/MessageDataSource.tsx +29 -25
  70. package/src/shared/index.ts +49 -1
  71. package/src/shared/libs/VideoPlayer/DRMType.js +6 -0
  72. package/src/shared/libs/VideoPlayer/FilterType.js +18 -0
  73. package/src/shared/libs/VideoPlayer/TextTrackType.js +5 -0
  74. package/src/shared/libs/VideoPlayer/Video.js +519 -0
  75. package/src/shared/libs/VideoPlayer/VideoResizeMode.js +5 -0
  76. package/src/shared/libs/VideoPlayerControls/OSSupport/PlatformSupport.tsx +43 -0
  77. package/src/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.tsx +16 -0
  78. package/src/shared/libs/VideoPlayerControls/OSSupport/index.tsx +1 -0
  79. package/src/shared/libs/VideoPlayerControls/VideoPlayer.tsx +511 -0
  80. package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
  81. package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
  82. package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
  83. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette.png +0 -0
  84. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@2x.png +0 -0
  85. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@3x.png +0 -0
  86. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon.png +0 -0
  87. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@2x.png +0 -0
  88. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@3x.png +0 -0
  89. package/src/shared/libs/VideoPlayerControls/assets/img/expand.png +0 -0
  90. package/src/shared/libs/VideoPlayerControls/assets/img/expand@2x.png +0 -0
  91. package/src/shared/libs/VideoPlayerControls/assets/img/expand@3x.png +0 -0
  92. package/src/shared/libs/VideoPlayerControls/assets/img/forward.png +0 -0
  93. package/src/shared/libs/VideoPlayerControls/assets/img/forward@2x.png +0 -0
  94. package/src/shared/libs/VideoPlayerControls/assets/img/forward@3x.png +0 -0
  95. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon.png +0 -0
  96. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@2x.png +0 -0
  97. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@3x.png +0 -0
  98. package/src/shared/libs/VideoPlayerControls/assets/img/pause.png +0 -0
  99. package/src/shared/libs/VideoPlayerControls/assets/img/pause@2x.png +0 -0
  100. package/src/shared/libs/VideoPlayerControls/assets/img/pause@3x.png +0 -0
  101. package/src/shared/libs/VideoPlayerControls/assets/img/play.png +0 -0
  102. package/src/shared/libs/VideoPlayerControls/assets/img/play@2x.png +0 -0
  103. package/src/shared/libs/VideoPlayerControls/assets/img/play@3x.png +0 -0
  104. package/src/shared/libs/VideoPlayerControls/assets/img/rewind.png +0 -0
  105. package/src/shared/libs/VideoPlayerControls/assets/img/rewind@2x.png +0 -0
  106. package/src/shared/libs/VideoPlayerControls/assets/img/rewind@3x.png +0 -0
  107. package/src/shared/libs/VideoPlayerControls/assets/img/shrink.png +0 -0
  108. package/src/shared/libs/VideoPlayerControls/assets/img/shrink@2x.png +0 -0
  109. package/src/shared/libs/VideoPlayerControls/assets/img/shrink@3x.png +0 -0
  110. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette.png +0 -0
  111. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@2x.png +0 -0
  112. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@3x.png +0 -0
  113. package/src/shared/libs/VideoPlayerControls/assets/img/volume.png +0 -0
  114. package/src/shared/libs/VideoPlayerControls/assets/img/volume@2x.png +0 -0
  115. package/src/shared/libs/VideoPlayerControls/assets/img/volume@3x.png +0 -0
  116. package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +28 -0
  117. package/src/shared/libs/VideoPlayerControls/components/Back/index.ts +1 -0
  118. package/src/shared/libs/VideoPlayerControls/components/BottomControls.tsx +142 -0
  119. package/src/shared/libs/VideoPlayerControls/components/Control.tsx +45 -0
  120. package/src/shared/libs/VideoPlayerControls/components/Error/Error.tsx +22 -0
  121. package/src/shared/libs/VideoPlayerControls/components/Error/index.ts +1 -0
  122. package/src/shared/libs/VideoPlayerControls/components/Error/styles.ts +21 -0
  123. package/src/shared/libs/VideoPlayerControls/components/Fullscreen.tsx +36 -0
  124. package/src/shared/libs/VideoPlayerControls/components/Loader/Loader.tsx +15 -0
  125. package/src/shared/libs/VideoPlayerControls/components/Loader/index.ts +1 -0
  126. package/src/shared/libs/VideoPlayerControls/components/Loader/styles.ts +16 -0
  127. package/src/shared/libs/VideoPlayerControls/components/NullControl.tsx +7 -0
  128. package/src/shared/libs/VideoPlayerControls/components/Overlay.tsx +23 -0
  129. package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +109 -0
  130. package/src/shared/libs/VideoPlayerControls/components/PlayPause/index.ts +1 -0
  131. package/src/shared/libs/VideoPlayerControls/components/PlayPause/styles.ts +21 -0
  132. package/src/shared/libs/VideoPlayerControls/components/Seekbar/Seekbar.tsx +47 -0
  133. package/src/shared/libs/VideoPlayerControls/components/Seekbar/index.ts +1 -0
  134. package/src/shared/libs/VideoPlayerControls/components/Seekbar/styles.ts +37 -0
  135. package/src/shared/libs/VideoPlayerControls/components/Timer/Timer.tsx +28 -0
  136. package/src/shared/libs/VideoPlayerControls/components/Timer/index.ts +1 -0
  137. package/src/shared/libs/VideoPlayerControls/components/Timer/styles.ts +12 -0
  138. package/src/shared/libs/VideoPlayerControls/components/Title.tsx +35 -0
  139. package/src/shared/libs/VideoPlayerControls/components/TopControls.tsx +110 -0
  140. package/src/shared/libs/VideoPlayerControls/components/Volume/Volume.tsx +37 -0
  141. package/src/shared/libs/VideoPlayerControls/components/Volume/index.ts +1 -0
  142. package/src/shared/libs/VideoPlayerControls/components/Volume/styles.ts +31 -0
  143. package/src/shared/libs/VideoPlayerControls/components/index.ts +14 -0
  144. package/src/shared/libs/VideoPlayerControls/components/styles.ts +30 -0
  145. package/src/shared/libs/VideoPlayerControls/hooks/index.ts +3 -0
  146. package/src/shared/libs/VideoPlayerControls/hooks/useAnimations.ts +68 -0
  147. package/src/shared/libs/VideoPlayerControls/hooks/useControlTimeout.tsx +67 -0
  148. package/src/shared/libs/VideoPlayerControls/hooks/usePanResponders.tsx +96 -0
  149. package/src/shared/libs/VideoPlayerControls/index.ts +4 -0
  150. package/src/shared/libs/VideoPlayerControls/styles.ts +19 -0
  151. package/src/shared/libs/VideoPlayerControls/types.ts +290 -0
  152. package/src/shared/libs/VideoPlayerControls/utils.ts +76 -0
  153. package/src/shared/modals/CometChatMessageTemplate.ts +113 -9
  154. package/src/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.ts +23 -21
  155. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +4 -1
  156. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +4 -1
  157. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +6 -3
  158. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +4 -1
  159. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +4 -1
  160. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +4 -1
  161. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +4 -1
  162. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +4 -1
  163. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +4 -1
  164. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +4 -1
  165. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +4 -1
  166. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +4 -1
  167. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +4 -1
  168. package/src/shared/resources/CometChatTheme/Palette.ts +79 -45
  169. package/src/shared/resources/CometChatTheme/Typography.ts +18 -0
  170. package/src/shared/utils/CommonUtils.ts +71 -0
  171. package/src/shared/utils/PermissionUtilIOS.ts +104 -0
  172. package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +3 -1
  173. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +6 -6
  174. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +28 -5
  175. package/src/shared/views/CometChatAudioBubble/style.ts +4 -2
  176. package/src/shared/views/CometChatAvatar/AvatarStyle.ts +1 -1
  177. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -3
  178. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +47 -31
  179. package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.ts +5 -5
  180. package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.ts +12 -13
  181. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +52 -5
  182. package/src/shared/views/CometChatFileBubble/style.ts +4 -2
  183. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +25 -2
  184. package/src/shared/views/CometChatList/CometChatList.tsx +2 -1
  185. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +51 -2
  186. package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +76 -0
  187. package/src/shared/views/CometChatQuickReactions/QuickReactionsConfiguration.tsx +12 -0
  188. package/src/shared/views/CometChatQuickReactions/QuickReactionsStyle.tsx +35 -0
  189. package/src/shared/views/CometChatQuickReactions/index.ts +12 -0
  190. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +166 -0
  191. package/src/shared/views/CometChatReactions/ReactionsConfiguration.tsx +12 -0
  192. package/src/shared/views/CometChatReactions/ReactionsStyle.tsx +43 -0
  193. package/src/shared/views/CometChatReactions/index.ts +12 -0
  194. package/src/{extensions/Reactions/CometChatMessageReactions → shared/views/CometChatReactions}/style.ts +7 -7
  195. package/src/shared/views/CometChatReactionsList/CometChatReactionsList.tsx +335 -0
  196. package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +14 -0
  197. package/src/shared/views/CometChatReactionsList/ReactionsListStyle.tsx +67 -0
  198. package/src/shared/views/CometChatReactionsList/index.ts +12 -0
  199. package/src/shared/views/CometChatReactionsList/resources/Spineer.png +0 -0
  200. package/src/shared/views/CometChatReactionsList/resources/index.ts +5 -0
  201. package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +21 -4
  202. package/src/shared/views/CometChatReceipt/MessageConfiguration.ts +12 -0
  203. package/src/shared/views/CometChatReceipt/resources/error.png +0 -0
  204. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +1 -1
  205. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +78 -12
  206. package/src/shared/views/CometChatVideoBubble/VideoBubbleStyle.ts +52 -2
  207. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +134 -0
  208. package/src/shared/views/CometChatVideoPlayer/index.tsx +1 -0
  209. package/src/shared/views/index.ts +30 -0
  210. package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
  211. package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
  212. package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
  213. package/android/.gradle/7.4.2/gc.properties +0 -0
  214. package/android/.gradle/checksums/checksums.lock +0 -0
  215. package/android/.idea/gradle.xml +0 -13
  216. package/android/.idea/misc.xml +0 -8
  217. package/android/.idea/modules/android.iml +0 -18
  218. package/android/.idea/modules.xml +0 -8
  219. package/android/.idea/vcs.xml +0 -6
  220. package/android/local.properties +0 -8
  221. package/src/extensions/Reactions/CometChatMessageReactions/CometChatMessageReactions.tsx +0 -249
  222. package/src/extensions/Reactions/CometChatMessageReactions/index.ts +0 -3
  223. package/src/extensions/Reactions/ReactionsDecorator.tsx +0 -164
  224. package/src/extensions/Reactions/ReactionsExtension.tsx +0 -48
  225. package/src/extensions/Reactions/index.ts +0 -4
  226. /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/AddReactions.png +0 -0
  227. /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/index.ts +0 -0
@@ -0,0 +1,142 @@
1
+ import React, {Dispatch, SetStateAction} from 'react';
2
+ import {
3
+ ImageBackground,
4
+ SafeAreaView,
5
+ StyleSheet,
6
+ GestureResponderHandlers,
7
+ } from 'react-native';
8
+ import {Timer} from './Timer';
9
+ import {Title} from './Title';
10
+ import {NullControl} from './NullControl';
11
+ import {Fullscreen} from './Fullscreen';
12
+ import {Seekbar} from './Seekbar';
13
+ import {calculateTime} from '../utils';
14
+ import type {VideoAnimations} from '../types';
15
+ import {styles} from './styles';
16
+
17
+ interface BottomControlsProps {
18
+ showControls: boolean;
19
+ animations: VideoAnimations;
20
+ panHandlers: GestureResponderHandlers;
21
+ disableTimer: boolean;
22
+ disableSeekbar: boolean;
23
+ showDuration: boolean;
24
+ showHours: boolean;
25
+ paused: boolean;
26
+ showTimeRemaining: boolean;
27
+ currentTime: number;
28
+ duration: number;
29
+ seekColor: string;
30
+ title: string;
31
+ toggleTimer: () => void;
32
+ resetControlTimeout: () => void;
33
+ seekerFillWidth: number;
34
+ seekerPosition: number;
35
+ setSeekerWidth: Dispatch<SetStateAction<number>>;
36
+ isFullscreen: boolean;
37
+ disableFullscreen: boolean;
38
+ toggleFullscreen: () => void;
39
+ }
40
+
41
+ export const BottomControls = ({
42
+ showControls,
43
+ animations: {AnimatedView, ...animations},
44
+ panHandlers,
45
+ disableSeekbar,
46
+ disableTimer,
47
+ duration,
48
+ seekColor,
49
+ showDuration,
50
+ showHours,
51
+ showTimeRemaining,
52
+ currentTime,
53
+ title,
54
+ toggleTimer,
55
+ resetControlTimeout,
56
+ seekerFillWidth,
57
+ seekerPosition,
58
+ setSeekerWidth,
59
+ isFullscreen,
60
+ disableFullscreen,
61
+ toggleFullscreen,
62
+ }: BottomControlsProps) => {
63
+ const timerControl = disableTimer ? (
64
+ <NullControl />
65
+ ) : (
66
+ <Timer
67
+ resetControlTimeout={resetControlTimeout}
68
+ toggleTimer={toggleTimer}
69
+ showControls={showControls}>
70
+ {calculateTime({
71
+ showDuration,
72
+ showHours,
73
+ showTimeRemaining,
74
+ time: currentTime,
75
+ duration,
76
+ })}
77
+ </Timer>
78
+ );
79
+
80
+ const seekbarControl = disableSeekbar ? (
81
+ <NullControl />
82
+ ) : (
83
+ <Seekbar
84
+ seekerFillWidth={seekerFillWidth}
85
+ seekerPosition={seekerPosition}
86
+ seekColor={seekColor}
87
+ seekerPanHandlers={panHandlers}
88
+ setSeekerWidth={setSeekerWidth}
89
+ />
90
+ );
91
+
92
+ const fullscreenControl = disableFullscreen ? (
93
+ <NullControl />
94
+ ) : (
95
+ <Fullscreen
96
+ isFullscreen={isFullscreen}
97
+ toggleFullscreen={toggleFullscreen}
98
+ resetControlTimeout={resetControlTimeout}
99
+ showControls={showControls}
100
+ />
101
+ );
102
+
103
+ return (
104
+ <AnimatedView
105
+ style={[
106
+ _styles.bottom,
107
+ animations.controlsOpacity,
108
+ animations.bottomControl,
109
+ ]}>
110
+ <ImageBackground
111
+ source={require('../assets/img/bottom-vignette.png')}
112
+ style={[styles.column]}
113
+ imageStyle={[styles.vignette]}>
114
+ <SafeAreaView style={[styles.row, _styles.bottomControlGroup]}>
115
+ {timerControl}
116
+ <Title title={title} />
117
+ {fullscreenControl}
118
+ </SafeAreaView>
119
+ <SafeAreaView style={styles.seekBarContainer}>
120
+ {seekbarControl}
121
+ </SafeAreaView>
122
+ </ImageBackground>
123
+ </AnimatedView>
124
+ );
125
+ };
126
+
127
+ const _styles = StyleSheet.create({
128
+ bottom: {
129
+ alignItems: 'stretch',
130
+ flex: 2,
131
+ justifyContent: 'flex-end',
132
+
133
+ },
134
+ bottomControlGroup: {
135
+ alignSelf: 'stretch',
136
+ alignItems: 'center',
137
+ justifyContent: 'space-between',
138
+ marginLeft: 12,
139
+ marginRight: 12,
140
+ marginBottom: 0,
141
+ },
142
+ });
@@ -0,0 +1,45 @@
1
+ import React, {ReactNode, RefObject, useState} from 'react';
2
+ import {TouchableHighlight, ViewProps} from 'react-native';
3
+ import {styles} from './styles';
4
+
5
+ interface ControlProps extends ViewProps {
6
+ children: ReactNode;
7
+ callback?: () => void;
8
+ controlRef?: RefObject<TouchableHighlight>;
9
+ disabled?: boolean;
10
+ style?: any;
11
+ resetControlTimeout?: () => void;
12
+ }
13
+
14
+ export const Control = ({
15
+ children,
16
+ callback,
17
+ controlRef,
18
+ disabled,
19
+ style = {},
20
+ ...props
21
+ }: ControlProps) => {
22
+ const [focused, setFocused] = useState(false);
23
+
24
+ const setFocusedState = () => setFocused(true);
25
+ const cancelFocusedState = () => setFocused(false);
26
+
27
+ const focusedStyle = focused ? {opacity: 1} : {};
28
+
29
+ return (
30
+ <TouchableHighlight
31
+ onFocus={setFocusedState}
32
+ onBlur={cancelFocusedState}
33
+ disabled={disabled}
34
+ ref={controlRef}
35
+ underlayColor="transparent"
36
+ activeOpacity={1}
37
+ onPress={() => {
38
+ callback && callback();
39
+ }}
40
+ style={[styles.control, style, focused && focusedStyle]}
41
+ {...props}>
42
+ {children}
43
+ </TouchableHighlight>
44
+ );
45
+ };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import {Image, Text, View} from 'react-native';
3
+ import {styles} from './styles';
4
+
5
+ interface ErrorProps {
6
+ error: boolean;
7
+ }
8
+
9
+ export const Error = ({error}: ErrorProps) => {
10
+ if (error) {
11
+ return (
12
+ <View style={styles.container}>
13
+ <Image
14
+ source={require('../../assets/img/error-icon.png')}
15
+ style={styles.icon}
16
+ />
17
+ <Text style={styles.text}>Video unavailable</Text>
18
+ </View>
19
+ );
20
+ }
21
+ return null;
22
+ };
@@ -0,0 +1 @@
1
+ export * from './Error';
@@ -0,0 +1,21 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export const styles = StyleSheet.create({
4
+ container: {
5
+ backgroundColor: 'rgba( 0, 0, 0, 0.5 )',
6
+ position: 'absolute',
7
+ top: 0,
8
+ right: 0,
9
+ bottom: 0,
10
+ left: 0,
11
+ justifyContent: 'center',
12
+ alignItems: 'center',
13
+ },
14
+ icon: {
15
+ marginBottom: 16,
16
+ },
17
+ text: {
18
+ backgroundColor: 'transparent',
19
+ color: '#f27474',
20
+ },
21
+ });
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import {Image, StyleSheet} from 'react-native';
3
+ import {Control} from './Control';
4
+
5
+ interface FullscreenProps {
6
+ isFullscreen: boolean;
7
+ toggleFullscreen: () => void;
8
+ resetControlTimeout: () => void;
9
+ showControls: boolean;
10
+ }
11
+
12
+ export const Fullscreen = ({
13
+ isFullscreen,
14
+ toggleFullscreen,
15
+ resetControlTimeout,
16
+ showControls,
17
+ }: FullscreenProps) => {
18
+ let source = isFullscreen
19
+ ? require('../assets/img/shrink.png')
20
+ : require('../assets/img/expand.png');
21
+ return (
22
+ <Control
23
+ callback={toggleFullscreen}
24
+ resetControlTimeout={resetControlTimeout}
25
+ style={styles.fullscreen}
26
+ disabled={!showControls}>
27
+ <Image source={source} />
28
+ </Control>
29
+ );
30
+ };
31
+
32
+ const styles = StyleSheet.create({
33
+ fullscreen: {
34
+ flexDirection: 'row',
35
+ },
36
+ });
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import {View, ActivityIndicator} from 'react-native';
3
+ import {styles} from './styles';
4
+
5
+ interface LoaderProps {
6
+ loadingIconColor?: string
7
+ }
8
+
9
+ export const Loader = ({loadingIconColor}: LoaderProps) => {
10
+ return (
11
+ <View style={styles.container}>
12
+ <ActivityIndicator color={loadingIconColor || '#fff'}/>
13
+ </View>
14
+ );
15
+ };
@@ -0,0 +1 @@
1
+ export * from './Loader';
@@ -0,0 +1,16 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export const styles = StyleSheet.create({
4
+ container: {
5
+ position: 'absolute',
6
+ top: 0,
7
+ right: 0,
8
+ bottom: 0,
9
+ left: 0,
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ },
13
+ icon: {
14
+ marginBottom: 16,
15
+ },
16
+ });
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import {View} from 'react-native';
3
+ import {styles} from './styles';
4
+
5
+ export const NullControl = () => {
6
+ return <View style={[styles.control]} />;
7
+ };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import {StyleSheet} from 'react-native';
3
+ import type {VideoAnimations} from '../types';
4
+
5
+ export const Overlay = ({
6
+ animations: {AnimatedView, controlsOpacity},
7
+ }: {
8
+ animations: VideoAnimations;
9
+ }) => {
10
+ return <AnimatedView style={[_styles.overlay, controlsOpacity]} />;
11
+ };
12
+
13
+ const _styles = StyleSheet.create({
14
+ overlay: {
15
+ position: 'absolute',
16
+ top: 0,
17
+ right: 0,
18
+ left: 0,
19
+ bottom: 0,
20
+ backgroundColor: 'rgba(0,0,0,.6)',
21
+ opacity: 0,
22
+ },
23
+ });
@@ -0,0 +1,109 @@
1
+ import React, {createRef} from 'react';
2
+ import {Image, ImageSourcePropType, Platform, TouchableHighlight} from 'react-native';
3
+ import {Control} from '../Control';
4
+ import {NullControl} from '../NullControl';
5
+ import type {VideoAnimations} from '../../types';
6
+ import {styles} from './styles';
7
+
8
+ export const playPauseRef = createRef<TouchableHighlight>();
9
+
10
+ interface PlayPauseProps {
11
+ animations: VideoAnimations;
12
+ disablePlayPause: boolean;
13
+ disableSeekButtons: boolean;
14
+ paused: boolean;
15
+ togglePlayPause: () => void;
16
+ resetControlTimeout: () => void;
17
+ showControls: boolean;
18
+ onPressForward: () => void;
19
+ onPressRewind: () => void;
20
+ playIcon?: ImageSourcePropType
21
+ playIconColor?: string
22
+ pauseIcon?: ImageSourcePropType
23
+ pauseIconColor?: string
24
+ }
25
+
26
+ const play = require('../../assets/img/play.png');
27
+ const pause = require('../../assets/img/pause.png');
28
+ const rewind = require('../../assets/img/rewind.png');
29
+ const forward = require('../../assets/img/forward.png');
30
+
31
+ export const PlayPause = ({
32
+ playIcon,
33
+ playIconColor,
34
+ pauseIcon,
35
+ pauseIconColor,
36
+ animations: {AnimatedView, ...animations},
37
+ disablePlayPause,
38
+ disableSeekButtons,
39
+ paused,
40
+ togglePlayPause,
41
+ resetControlTimeout,
42
+ showControls,
43
+ onPressForward,
44
+ onPressRewind,
45
+ }: PlayPauseProps) => {
46
+ let source = paused
47
+ ? playIcon
48
+ ? playIcon
49
+ : play
50
+ : pauseIcon
51
+ ? pauseIcon
52
+ : pause;
53
+
54
+ const animatedStyles = {
55
+ zIndex: showControls ? 99999 : 0,
56
+ };
57
+
58
+ if (disablePlayPause) {
59
+ return <NullControl />;
60
+ }
61
+
62
+ return (
63
+ <AnimatedView
64
+ pointerEvents={'box-none'}
65
+ style={[styles.container, animatedStyles, animations.controlsOpacity]}>
66
+ {!disableSeekButtons ? (
67
+ <Control
68
+ disabled={!showControls}
69
+ callback={onPressRewind}
70
+ resetControlTimeout={resetControlTimeout}>
71
+ <Image source={rewind} resizeMode={'contain'} style={styles.rewind} />
72
+ </Control>
73
+ ) : null}
74
+ <Control
75
+ disabled={!showControls}
76
+ callback={togglePlayPause}
77
+ resetControlTimeout={resetControlTimeout}
78
+ style={styles.playContainer}
79
+ controlRef={playPauseRef}
80
+ {...(Platform.isTV ? {hasTVPreferredFocus: showControls} : {})}>
81
+ <Image
82
+ source={source}
83
+ resizeMode={'contain'}
84
+ style={
85
+ paused
86
+ ? pauseIconColor
87
+ ? { tintColor: pauseIconColor }
88
+ : {}
89
+ : playIconColor
90
+ ? { tintColor: playIconColor }
91
+ : {}
92
+ }
93
+ />
94
+ </Control>
95
+ {!disableSeekButtons ? (
96
+ <Control
97
+ disabled={!showControls}
98
+ callback={onPressForward}
99
+ resetControlTimeout={resetControlTimeout}>
100
+ <Image
101
+ source={forward}
102
+ resizeMode={'contain'}
103
+ style={styles.rewind}
104
+ />
105
+ </Control>
106
+ ) : null}
107
+ </AnimatedView>
108
+ );
109
+ };
@@ -0,0 +1 @@
1
+ export * from './PlayPause';
@@ -0,0 +1,21 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export const styles = StyleSheet.create({
4
+ container: {
5
+ position: 'absolute',
6
+ top: 0,
7
+ right: 0,
8
+ bottom: 0,
9
+ left: 0,
10
+ flexDirection: 'row',
11
+ alignItems: 'center',
12
+ justifyContent: 'center',
13
+ zIndex: 99999,
14
+ },
15
+ playContainer: {
16
+ width: '10%',
17
+ alignItems: 'center',
18
+ },
19
+ play: {},
20
+ rewind: {},
21
+ });
@@ -0,0 +1,47 @@
1
+ import React, {Dispatch, SetStateAction} from 'react';
2
+ import {View, GestureResponderHandlers} from 'react-native';
3
+ import {styles} from './styles';
4
+
5
+ interface SeekbarProps {
6
+ seekerFillWidth: number;
7
+ seekerPosition: number;
8
+ seekColor: string;
9
+ seekerPanHandlers: GestureResponderHandlers;
10
+ setSeekerWidth: Dispatch<SetStateAction<number>>;
11
+ }
12
+
13
+ export const Seekbar = ({
14
+ seekColor,
15
+ seekerFillWidth,
16
+ seekerPosition,
17
+ seekerPanHandlers,
18
+ setSeekerWidth,
19
+ }: SeekbarProps) => {
20
+ return (
21
+ <View style={styles.container} collapsable={false} {...seekerPanHandlers}>
22
+ <View
23
+ style={styles.track}
24
+ onLayout={(event) => setSeekerWidth(event.nativeEvent.layout.width)}
25
+ pointerEvents={'none'}>
26
+ <View
27
+ style={[
28
+ styles.fill,
29
+ {
30
+ width: seekerFillWidth,
31
+ backgroundColor: seekColor || '#FFF',
32
+ },
33
+ ]}
34
+ pointerEvents={'none'}
35
+ />
36
+ </View>
37
+ <View
38
+ style={[styles.handle, {left: seekerPosition}]}
39
+ pointerEvents={'none'}>
40
+ <View
41
+ style={[styles.circle, {backgroundColor: seekColor || '#FFF'}]}
42
+ pointerEvents={'none'}
43
+ />
44
+ </View>
45
+ </View>
46
+ );
47
+ };
@@ -0,0 +1 @@
1
+ export * from './Seekbar';
@@ -0,0 +1,37 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export const styles = StyleSheet.create({
4
+ container: {
5
+ alignSelf: 'stretch',
6
+ height: 28,
7
+ marginLeft: 20,
8
+ marginRight: 20,
9
+ marginBottom: 20
10
+ },
11
+ track: {
12
+ backgroundColor: '#333',
13
+ height: 1,
14
+ position: 'relative',
15
+ top: 14,
16
+ width: '100%',
17
+ },
18
+ fill: {
19
+ backgroundColor: '#FFF',
20
+ height: 1,
21
+ width: '100%',
22
+ },
23
+ handle: {
24
+ position: 'absolute',
25
+ marginLeft: -7,
26
+ height: 32,
27
+ width: 32,
28
+ },
29
+ circle: {
30
+ borderRadius: 12,
31
+ position: 'relative',
32
+ top: 8,
33
+ left: -5,
34
+ height: 12,
35
+ width: 12,
36
+ },
37
+ });
@@ -0,0 +1,28 @@
1
+ import React, {ReactNode} from 'react';
2
+ import {Text} from 'react-native';
3
+ import {styles} from './styles';
4
+ import {Control} from '../Control';
5
+
6
+ interface TimerProps {
7
+ toggleTimer: () => void;
8
+ resetControlTimeout: () => void;
9
+ children: ReactNode;
10
+ showControls: boolean;
11
+ }
12
+
13
+ export const Timer = ({
14
+ children,
15
+ toggleTimer,
16
+ resetControlTimeout,
17
+ showControls,
18
+ }: TimerProps) => {
19
+ return (
20
+ <Control
21
+ callback={toggleTimer}
22
+ resetControlTimeout={resetControlTimeout}
23
+ style={styles.timer}
24
+ disabled={!showControls}>
25
+ <Text style={styles.timerText}>{children}</Text>
26
+ </Control>
27
+ );
28
+ };
@@ -0,0 +1 @@
1
+ export * from './Timer';
@@ -0,0 +1,12 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export const styles = StyleSheet.create({
4
+ timer: {
5
+ maxWidth: 160,
6
+ },
7
+ timerText: {
8
+ backgroundColor: 'transparent',
9
+ color: '#FFF',
10
+ fontSize: 11,
11
+ },
12
+ });
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import {Text, View} from 'react-native';
3
+ import {styles} from './styles';
4
+
5
+ interface TitleProps {
6
+ title: string;
7
+ }
8
+
9
+ export const Title = ({title}: TitleProps) => {
10
+ if (title) {
11
+ return (
12
+ <View style={[styles.control, _styles.title]}>
13
+ <Text style={[styles.text, _styles.titleText]} numberOfLines={1}>
14
+ {title || ''}
15
+ </Text>
16
+ </View>
17
+ );
18
+ }
19
+
20
+ return null;
21
+ };
22
+
23
+ import {StyleSheet} from 'react-native';
24
+
25
+ const _styles = StyleSheet.create({
26
+ title: {
27
+ alignItems: 'center',
28
+ flex: 1,
29
+ flexDirection: 'column',
30
+ padding: 0,
31
+ },
32
+ titleText: {
33
+ textAlign: 'center',
34
+ },
35
+ });