@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.
- package/README.md +26 -67
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +2 -1
- package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoView.java +796 -0
- package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoViewManager.java +172 -0
- package/android/src/main/java/com/scalablevideoview/BuildConfig.java +10 -0
- package/android/src/main/java/com/scalablevideoview/PivotPoint.java +13 -0
- package/android/src/main/java/com/scalablevideoview/ScalableType.java +34 -0
- package/android/src/main/java/com/scalablevideoview/ScalableVideoView.java +255 -0
- package/android/src/main/java/com/scalablevideoview/ScaleManager.java +188 -0
- package/android/src/main/java/com/scalablevideoview/Size.java +20 -0
- package/android/src/main/java/com/zipfile/APEZProvider.java +287 -0
- package/android/src/main/java/com/zipfile/APKExpansionSupport.java +81 -0
- package/android/src/main/java/com/zipfile/ZipResourceFile.java +428 -0
- package/android/src/main/res/values/attrs.xml +37 -0
- package/ios/FileManager.m +75 -5
- package/ios/Video/CCRCTVideo.h +67 -0
- package/ios/Video/CCRCTVideo.m +2031 -0
- package/ios/Video/CCRCTVideoManager.h +6 -0
- package/ios/Video/CCRCTVideoManager.m +133 -0
- package/ios/Video/CCRCTVideoPlayerViewController.h +20 -0
- package/ios/Video/CCRCTVideoPlayerViewController.m +43 -0
- package/ios/Video/CCRCTVideoPlayerViewControllerDelegate.h +7 -0
- package/ios/Video/UIView+FindUIViewController.h +15 -0
- package/ios/Video/UIView+FindUIViewController.m +21 -0
- package/ios/VideoCaching/RCTVideoCache.h +38 -0
- package/ios/VideoCaching/RCTVideoCache.m +174 -0
- package/ios/VideoPickerModule.h +7 -0
- package/ios/VideoPickerModule.mm +95 -0
- package/package.json +3 -4
- package/react-native-cometchat-ui-kit.podspec +24 -10
- package/src/CometChatContacts/CometChatContacts.tsx +12 -9
- package/src/CometChatConversations/CometChatConversations.tsx +84 -64
- package/src/CometChatDetails/CometChatDetails.tsx +14 -12
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +8 -4
- package/src/CometChatGroupMembers/resources/check.png +0 -0
- package/src/CometChatGroupMembers/resources/index.ts +2 -0
- package/src/CometChatGroups/CometChatGroups.tsx +4 -4
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +57 -15
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +9 -2
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +1 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +596 -181
- package/src/CometChatMessageList/MessageListConfiguration.ts +55 -4
- package/src/CometChatMessageList/resources/index.ts +5 -1
- package/src/CometChatMessageList/resources/leftarrowcurve.png +0 -0
- package/src/CometChatMessageList/resources/rightarrowcurve.png +0 -0
- package/src/CometChatMessages/CometChatMessages.tsx +1 -1
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +4 -12
- package/src/CometChatThreadedMessages/style.ts +3 -1
- package/src/CometChatUsers/CometChatUsers.tsx +1 -1
- package/src/calls/CallUtils.ts +4 -8
- package/src/calls/CallingExtentionDecorator.tsx +5 -2
- package/src/calls/CometChatCallBubble/styles.ts +2 -1
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +14 -3
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +9 -9
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +80 -73
- package/src/extensions/CollaborativeBubble/styles.ts +2 -0
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +11 -0
- package/src/extensions/index.ts +0 -4
- package/src/index.ts +53 -8
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +14 -2
- package/src/shared/constants/UIKitConstants.ts +1 -0
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +6 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +8 -0
- package/src/shared/events/ListenerInitializer.ts +6 -0
- package/src/shared/events/messages.ts +2 -0
- package/src/shared/framework/MessageDataSource.tsx +29 -25
- package/src/shared/index.ts +49 -1
- package/src/shared/libs/VideoPlayer/DRMType.js +6 -0
- package/src/shared/libs/VideoPlayer/FilterType.js +18 -0
- package/src/shared/libs/VideoPlayer/TextTrackType.js +5 -0
- package/src/shared/libs/VideoPlayer/Video.js +519 -0
- package/src/shared/libs/VideoPlayer/VideoResizeMode.js +5 -0
- package/src/shared/libs/VideoPlayerControls/OSSupport/PlatformSupport.tsx +43 -0
- package/src/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.tsx +16 -0
- package/src/shared/libs/VideoPlayerControls/OSSupport/index.tsx +1 -0
- package/src/shared/libs/VideoPlayerControls/VideoPlayer.tsx +511 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/error-icon.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/expand.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/expand@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/expand@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/forward.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/forward@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/forward@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/pause.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/pause@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/pause@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/play.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/play@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/play@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/rewind.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/rewind@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/rewind@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/shrink.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/shrink@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/shrink@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/volume.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/volume@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/volume@3x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +28 -0
- package/src/shared/libs/VideoPlayerControls/components/Back/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/BottomControls.tsx +142 -0
- package/src/shared/libs/VideoPlayerControls/components/Control.tsx +45 -0
- package/src/shared/libs/VideoPlayerControls/components/Error/Error.tsx +22 -0
- package/src/shared/libs/VideoPlayerControls/components/Error/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Error/styles.ts +21 -0
- package/src/shared/libs/VideoPlayerControls/components/Fullscreen.tsx +36 -0
- package/src/shared/libs/VideoPlayerControls/components/Loader/Loader.tsx +15 -0
- package/src/shared/libs/VideoPlayerControls/components/Loader/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Loader/styles.ts +16 -0
- package/src/shared/libs/VideoPlayerControls/components/NullControl.tsx +7 -0
- package/src/shared/libs/VideoPlayerControls/components/Overlay.tsx +23 -0
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +109 -0
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/styles.ts +21 -0
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/Seekbar.tsx +47 -0
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Seekbar/styles.ts +37 -0
- package/src/shared/libs/VideoPlayerControls/components/Timer/Timer.tsx +28 -0
- package/src/shared/libs/VideoPlayerControls/components/Timer/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Timer/styles.ts +12 -0
- package/src/shared/libs/VideoPlayerControls/components/Title.tsx +35 -0
- package/src/shared/libs/VideoPlayerControls/components/TopControls.tsx +110 -0
- package/src/shared/libs/VideoPlayerControls/components/Volume/Volume.tsx +37 -0
- package/src/shared/libs/VideoPlayerControls/components/Volume/index.ts +1 -0
- package/src/shared/libs/VideoPlayerControls/components/Volume/styles.ts +31 -0
- package/src/shared/libs/VideoPlayerControls/components/index.ts +14 -0
- package/src/shared/libs/VideoPlayerControls/components/styles.ts +30 -0
- package/src/shared/libs/VideoPlayerControls/hooks/index.ts +3 -0
- package/src/shared/libs/VideoPlayerControls/hooks/useAnimations.ts +68 -0
- package/src/shared/libs/VideoPlayerControls/hooks/useControlTimeout.tsx +67 -0
- package/src/shared/libs/VideoPlayerControls/hooks/usePanResponders.tsx +96 -0
- package/src/shared/libs/VideoPlayerControls/index.ts +4 -0
- package/src/shared/libs/VideoPlayerControls/styles.ts +19 -0
- package/src/shared/libs/VideoPlayerControls/types.ts +290 -0
- package/src/shared/libs/VideoPlayerControls/utils.ts +76 -0
- package/src/shared/modals/CometChatMessageTemplate.ts +113 -9
- package/src/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.ts +23 -21
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +6 -3
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +4 -1
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +4 -1
- package/src/shared/resources/CometChatTheme/Palette.ts +79 -45
- package/src/shared/resources/CometChatTheme/Typography.ts +18 -0
- package/src/shared/utils/CommonUtils.ts +71 -0
- package/src/shared/utils/PermissionUtilIOS.ts +104 -0
- package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +3 -1
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +6 -6
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +28 -5
- package/src/shared/views/CometChatAudioBubble/style.ts +4 -2
- package/src/shared/views/CometChatAvatar/AvatarStyle.ts +1 -1
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -3
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +47 -31
- package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.ts +5 -5
- package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.ts +12 -13
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +52 -5
- package/src/shared/views/CometChatFileBubble/style.ts +4 -2
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +25 -2
- package/src/shared/views/CometChatList/CometChatList.tsx +2 -1
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +51 -2
- package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +76 -0
- package/src/shared/views/CometChatQuickReactions/QuickReactionsConfiguration.tsx +12 -0
- package/src/shared/views/CometChatQuickReactions/QuickReactionsStyle.tsx +35 -0
- package/src/shared/views/CometChatQuickReactions/index.ts +12 -0
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +166 -0
- package/src/shared/views/CometChatReactions/ReactionsConfiguration.tsx +12 -0
- package/src/shared/views/CometChatReactions/ReactionsStyle.tsx +43 -0
- package/src/shared/views/CometChatReactions/index.ts +12 -0
- package/src/{extensions/Reactions/CometChatMessageReactions → shared/views/CometChatReactions}/style.ts +7 -7
- package/src/shared/views/CometChatReactionsList/CometChatReactionsList.tsx +335 -0
- package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +14 -0
- package/src/shared/views/CometChatReactionsList/ReactionsListStyle.tsx +67 -0
- package/src/shared/views/CometChatReactionsList/index.ts +12 -0
- package/src/shared/views/CometChatReactionsList/resources/Spineer.png +0 -0
- package/src/shared/views/CometChatReactionsList/resources/index.ts +5 -0
- package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +21 -4
- package/src/shared/views/CometChatReceipt/MessageConfiguration.ts +12 -0
- package/src/shared/views/CometChatReceipt/resources/error.png +0 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +1 -1
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +78 -12
- package/src/shared/views/CometChatVideoBubble/VideoBubbleStyle.ts +52 -2
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +134 -0
- package/src/shared/views/CometChatVideoPlayer/index.tsx +1 -0
- package/src/shared/views/index.ts +30 -0
- package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4.2/gc.properties +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.idea/gradle.xml +0 -13
- package/android/.idea/misc.xml +0 -8
- package/android/.idea/modules/android.iml +0 -18
- package/android/.idea/modules.xml +0 -8
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/src/extensions/Reactions/CometChatMessageReactions/CometChatMessageReactions.tsx +0 -249
- package/src/extensions/Reactions/CometChatMessageReactions/index.ts +0 -3
- package/src/extensions/Reactions/ReactionsDecorator.tsx +0 -164
- package/src/extensions/Reactions/ReactionsExtension.tsx +0 -48
- package/src/extensions/Reactions/index.ts +0 -4
- /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/AddReactions.png +0 -0
- /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/index.ts +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React, {memo} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ImageBackground,
|
|
4
|
+
SafeAreaView,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
View,
|
|
7
|
+
GestureResponderHandlers,
|
|
8
|
+
ImageSourcePropType,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import {Volume} from './Volume';
|
|
11
|
+
import {Back} from './Back';
|
|
12
|
+
import {NullControl} from './NullControl';
|
|
13
|
+
import {styles} from './styles';
|
|
14
|
+
import type {VideoAnimations} from '../types';
|
|
15
|
+
|
|
16
|
+
interface TopControlProps {
|
|
17
|
+
showControls: boolean;
|
|
18
|
+
panHandlers: GestureResponderHandlers;
|
|
19
|
+
animations: VideoAnimations;
|
|
20
|
+
disableBack: boolean;
|
|
21
|
+
disableVolume: boolean;
|
|
22
|
+
volumeFillWidth: number;
|
|
23
|
+
volumeTrackWidth: number;
|
|
24
|
+
volumePosition: number;
|
|
25
|
+
onBack: () => void;
|
|
26
|
+
resetControlTimeout: () => void;
|
|
27
|
+
backIcon?: ImageSourcePropType
|
|
28
|
+
backIconColor?: string
|
|
29
|
+
volumeIcon?: ImageSourcePropType
|
|
30
|
+
volumeIconColor?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const TopControls = memo(
|
|
34
|
+
({
|
|
35
|
+
backIcon,
|
|
36
|
+
backIconColor,
|
|
37
|
+
volumeIcon,
|
|
38
|
+
volumeIconColor,
|
|
39
|
+
showControls,
|
|
40
|
+
panHandlers,
|
|
41
|
+
animations: {AnimatedView, controlsOpacity, topControl},
|
|
42
|
+
disableBack,
|
|
43
|
+
disableVolume,
|
|
44
|
+
volumeFillWidth,
|
|
45
|
+
volumePosition,
|
|
46
|
+
volumeTrackWidth,
|
|
47
|
+
onBack,
|
|
48
|
+
resetControlTimeout,
|
|
49
|
+
}: TopControlProps) => {
|
|
50
|
+
const backControl = disableBack ? (
|
|
51
|
+
<NullControl />
|
|
52
|
+
) : (
|
|
53
|
+
<Back
|
|
54
|
+
showControls={showControls}
|
|
55
|
+
onBack={onBack}
|
|
56
|
+
resetControlTimeout={resetControlTimeout}
|
|
57
|
+
backIcon={backIcon}
|
|
58
|
+
backIconColor={backIconColor}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const volumeControl = disableVolume ? (
|
|
63
|
+
<NullControl />
|
|
64
|
+
) : (
|
|
65
|
+
<Volume
|
|
66
|
+
volumeFillWidth={volumeFillWidth}
|
|
67
|
+
volumeTrackWidth={volumeTrackWidth}
|
|
68
|
+
volumePosition={volumePosition}
|
|
69
|
+
volumePanHandlers={panHandlers}
|
|
70
|
+
volumeIcon={volumeIcon}
|
|
71
|
+
volumeIconColor={volumeIconColor}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<AnimatedView style={[_styles.top, controlsOpacity, topControl]}>
|
|
77
|
+
<ImageBackground
|
|
78
|
+
source={require('../assets/img/top-vignette.png')}
|
|
79
|
+
style={[styles.column]}
|
|
80
|
+
imageStyle={[styles.vignette]}>
|
|
81
|
+
<SafeAreaView style={_styles.topControlGroup}>
|
|
82
|
+
{backControl}
|
|
83
|
+
<View style={_styles.pullRight}>{volumeControl}</View>
|
|
84
|
+
</SafeAreaView>
|
|
85
|
+
</ImageBackground>
|
|
86
|
+
</AnimatedView>
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const _styles = StyleSheet.create({
|
|
92
|
+
pullRight: {
|
|
93
|
+
flexDirection: 'row',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
},
|
|
97
|
+
top: {
|
|
98
|
+
flex: 1,
|
|
99
|
+
alignItems: 'stretch',
|
|
100
|
+
justifyContent: 'flex-start',
|
|
101
|
+
},
|
|
102
|
+
topControlGroup: {
|
|
103
|
+
alignSelf: 'stretch',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
justifyContent: 'space-between',
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
margin: 12,
|
|
108
|
+
marginBottom: 18,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {View, Image, GestureResponderHandlers, ImageSourcePropType} from 'react-native';
|
|
3
|
+
import {styles} from './styles';
|
|
4
|
+
|
|
5
|
+
interface VolumeProps {
|
|
6
|
+
volumeFillWidth: number;
|
|
7
|
+
volumeTrackWidth: number;
|
|
8
|
+
volumePosition: number;
|
|
9
|
+
volumePanHandlers: GestureResponderHandlers;
|
|
10
|
+
volumeIcon?: ImageSourcePropType
|
|
11
|
+
volumeIconColor?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Volume = ({
|
|
15
|
+
volumeFillWidth,
|
|
16
|
+
volumePosition,
|
|
17
|
+
volumeTrackWidth,
|
|
18
|
+
volumePanHandlers,
|
|
19
|
+
volumeIcon,
|
|
20
|
+
volumeIconColor
|
|
21
|
+
}: VolumeProps) => {
|
|
22
|
+
return (
|
|
23
|
+
<View style={styles.container}>
|
|
24
|
+
<View style={[styles.fill, {width: volumeFillWidth}]} />
|
|
25
|
+
<View style={[styles.track, {width: volumeTrackWidth}]} />
|
|
26
|
+
<View
|
|
27
|
+
style={[styles.handle, {left: volumePosition - 15}]}
|
|
28
|
+
{...volumePanHandlers}>
|
|
29
|
+
<Image
|
|
30
|
+
style={[styles.icon, volumeIconColor ? {tintColor: volumeIconColor} : {}]}
|
|
31
|
+
resizeMode='contain'
|
|
32
|
+
source={volumeIcon ? volumeIcon :require('../../assets/img/volume.png')}
|
|
33
|
+
/>
|
|
34
|
+
</View>
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Volume';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
alignItems: 'center',
|
|
6
|
+
justifyContent: 'flex-start',
|
|
7
|
+
flexDirection: 'row',
|
|
8
|
+
height: 1,
|
|
9
|
+
marginLeft: 20,
|
|
10
|
+
marginRight: 20,
|
|
11
|
+
width: 150,
|
|
12
|
+
},
|
|
13
|
+
track: {
|
|
14
|
+
backgroundColor: '#333',
|
|
15
|
+
height: 1,
|
|
16
|
+
marginLeft: 7,
|
|
17
|
+
},
|
|
18
|
+
fill: {
|
|
19
|
+
backgroundColor: '#FFF',
|
|
20
|
+
height: 1,
|
|
21
|
+
},
|
|
22
|
+
handle: {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
marginTop: -24,
|
|
25
|
+
marginLeft: -24,
|
|
26
|
+
padding: 16,
|
|
27
|
+
},
|
|
28
|
+
icon: {
|
|
29
|
+
marginLeft: 7,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './Loader';
|
|
2
|
+
export * from './Error';
|
|
3
|
+
export * from './Seekbar';
|
|
4
|
+
export * from './Volume';
|
|
5
|
+
export * from './Control';
|
|
6
|
+
export * from './Back';
|
|
7
|
+
export * from './Timer';
|
|
8
|
+
export * from './Title';
|
|
9
|
+
export * from './Fullscreen';
|
|
10
|
+
export * from './NullControl';
|
|
11
|
+
export * from './BottomControls';
|
|
12
|
+
export * from './TopControls';
|
|
13
|
+
export * from './PlayPause';
|
|
14
|
+
export * from './Overlay';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
row: {
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'space-between',
|
|
8
|
+
},
|
|
9
|
+
column: {
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'space-between',
|
|
13
|
+
},
|
|
14
|
+
vignette: {
|
|
15
|
+
resizeMode: 'stretch',
|
|
16
|
+
},
|
|
17
|
+
control: {
|
|
18
|
+
padding: 16,
|
|
19
|
+
opacity: 0.6,
|
|
20
|
+
},
|
|
21
|
+
text: {
|
|
22
|
+
backgroundColor: 'transparent',
|
|
23
|
+
color: '#FFF',
|
|
24
|
+
fontSize: 14,
|
|
25
|
+
textAlign: 'center',
|
|
26
|
+
},
|
|
27
|
+
seekBarContainer: {
|
|
28
|
+
width: '100%',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {useRef} from 'react';
|
|
2
|
+
import {Animated} from 'react-native';
|
|
3
|
+
import type {VideoAnimations} from '../types';
|
|
4
|
+
|
|
5
|
+
export const useJSAnimations = (
|
|
6
|
+
controlAnimationTiming: number = 450,
|
|
7
|
+
): VideoAnimations => {
|
|
8
|
+
const bottomControlMarginBottom = useRef(new Animated.Value(0)).current;
|
|
9
|
+
const controlsOpacity = useRef(new Animated.Value(1)).current;
|
|
10
|
+
const topControlMarginTop = useRef(new Animated.Value(0)).current;
|
|
11
|
+
|
|
12
|
+
const hideControlAnimation = () => {
|
|
13
|
+
Animated.parallel([
|
|
14
|
+
Animated.timing(controlsOpacity, {
|
|
15
|
+
toValue: 0,
|
|
16
|
+
duration: controlAnimationTiming,
|
|
17
|
+
useNativeDriver: false,
|
|
18
|
+
}),
|
|
19
|
+
Animated.timing(topControlMarginTop, {
|
|
20
|
+
toValue: -100,
|
|
21
|
+
duration: controlAnimationTiming,
|
|
22
|
+
useNativeDriver: false,
|
|
23
|
+
}),
|
|
24
|
+
Animated.timing(bottomControlMarginBottom, {
|
|
25
|
+
toValue: -100,
|
|
26
|
+
duration: controlAnimationTiming,
|
|
27
|
+
useNativeDriver: false,
|
|
28
|
+
}),
|
|
29
|
+
]).start();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const showControlAnimation = () => {
|
|
33
|
+
Animated.parallel([
|
|
34
|
+
Animated.timing(controlsOpacity, {
|
|
35
|
+
toValue: 1,
|
|
36
|
+
duration: controlAnimationTiming,
|
|
37
|
+
useNativeDriver: false,
|
|
38
|
+
}),
|
|
39
|
+
Animated.timing(topControlMarginTop, {
|
|
40
|
+
toValue: 0,
|
|
41
|
+
duration: controlAnimationTiming,
|
|
42
|
+
useNativeDriver: false,
|
|
43
|
+
}),
|
|
44
|
+
Animated.timing(bottomControlMarginBottom, {
|
|
45
|
+
toValue: 0,
|
|
46
|
+
duration: controlAnimationTiming,
|
|
47
|
+
useNativeDriver: false,
|
|
48
|
+
}),
|
|
49
|
+
]).start();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const animations = {
|
|
53
|
+
bottomControl: {
|
|
54
|
+
marginBottom: bottomControlMarginBottom,
|
|
55
|
+
},
|
|
56
|
+
topControl: {
|
|
57
|
+
marginTop: topControlMarginTop,
|
|
58
|
+
},
|
|
59
|
+
controlsOpacity: {
|
|
60
|
+
opacity: controlsOpacity,
|
|
61
|
+
},
|
|
62
|
+
showControlAnimation,
|
|
63
|
+
hideControlAnimation,
|
|
64
|
+
AnimatedView: Animated.View,
|
|
65
|
+
} as unknown as VideoAnimations;
|
|
66
|
+
|
|
67
|
+
return animations;
|
|
68
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {Dispatch, SetStateAction, useEffect, useState} from 'react';
|
|
2
|
+
|
|
3
|
+
interface ControlTimeoutProps {
|
|
4
|
+
controlTimeout: ReturnType<typeof setTimeout>;
|
|
5
|
+
controlTimeoutDelay: number;
|
|
6
|
+
mounted: boolean;
|
|
7
|
+
showControls: boolean;
|
|
8
|
+
setShowControls: Dispatch<SetStateAction<boolean>>;
|
|
9
|
+
alwaysShowControls: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const useControlTimeout = ({
|
|
13
|
+
controlTimeout,
|
|
14
|
+
controlTimeoutDelay,
|
|
15
|
+
mounted,
|
|
16
|
+
showControls,
|
|
17
|
+
setShowControls,
|
|
18
|
+
alwaysShowControls,
|
|
19
|
+
}: ControlTimeoutProps) => {
|
|
20
|
+
const [_controlTimeout, _setControlTimeout] = useState<boolean>();
|
|
21
|
+
const [_clearTimeout, setClearTimeout] = useState<boolean>();
|
|
22
|
+
|
|
23
|
+
const setControlTimeout = () => {
|
|
24
|
+
_setControlTimeout((prevState) => !prevState);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const clearControlTimeout = () => {
|
|
28
|
+
setClearTimeout(true);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const resetControlTimeout = () => {
|
|
32
|
+
clearControlTimeout();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const hideControls = () => {
|
|
36
|
+
if (mounted && showControls && !alwaysShowControls) {
|
|
37
|
+
setShowControls(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
controlTimeout = setTimeout(() => {
|
|
44
|
+
hideControls();
|
|
45
|
+
}, controlTimeoutDelay);
|
|
46
|
+
|
|
47
|
+
return () => {
|
|
48
|
+
clearTimeout(controlTimeout);
|
|
49
|
+
};
|
|
50
|
+
}, [_controlTimeout]);
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (_clearTimeout) {
|
|
54
|
+
clearTimeout(controlTimeout);
|
|
55
|
+
setClearTimeout(false);
|
|
56
|
+
}
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, [_clearTimeout]);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
clearControlTimeout,
|
|
62
|
+
resetControlTimeout,
|
|
63
|
+
hideControls,
|
|
64
|
+
setClearTimeout,
|
|
65
|
+
setControlTimeout,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {Dispatch, SetStateAction, useEffect} from 'react';
|
|
2
|
+
import {PanResponder} from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface PanRespondersProps {
|
|
5
|
+
duration: number;
|
|
6
|
+
seekerOffset: number;
|
|
7
|
+
volumeOffset: number;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
seeking: boolean;
|
|
10
|
+
seekerPosition: number;
|
|
11
|
+
seek?: (time: number, tolerance?: number) => void;
|
|
12
|
+
seekerWidth: number;
|
|
13
|
+
clearControlTimeout: () => void;
|
|
14
|
+
setVolumePosition: (position: number) => void;
|
|
15
|
+
setSeekerPosition: (position: number) => void;
|
|
16
|
+
setSeeking: Dispatch<SetStateAction<boolean>>;
|
|
17
|
+
setControlTimeout: () => void;
|
|
18
|
+
onEnd: () => void;
|
|
19
|
+
horizontal?: boolean;
|
|
20
|
+
inverted?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const usePanResponders = ({
|
|
24
|
+
duration,
|
|
25
|
+
seekerOffset,
|
|
26
|
+
volumeOffset,
|
|
27
|
+
loading,
|
|
28
|
+
seeking,
|
|
29
|
+
seekerPosition,
|
|
30
|
+
seek,
|
|
31
|
+
seekerWidth,
|
|
32
|
+
clearControlTimeout,
|
|
33
|
+
setVolumePosition,
|
|
34
|
+
setSeekerPosition,
|
|
35
|
+
setSeeking,
|
|
36
|
+
setControlTimeout,
|
|
37
|
+
onEnd,
|
|
38
|
+
horizontal = true,
|
|
39
|
+
inverted = false,
|
|
40
|
+
}: PanRespondersProps) => {
|
|
41
|
+
const volumePanResponder = PanResponder.create({
|
|
42
|
+
onStartShouldSetPanResponder: () => true,
|
|
43
|
+
onMoveShouldSetPanResponder: () => true,
|
|
44
|
+
onPanResponderGrant: () => {
|
|
45
|
+
clearControlTimeout();
|
|
46
|
+
},
|
|
47
|
+
onPanResponderMove: (_evt, gestureState) => {
|
|
48
|
+
const diff = horizontal ? gestureState.dx : gestureState.dy;
|
|
49
|
+
const position = volumeOffset + diff * (inverted ? -1 : 1);
|
|
50
|
+
setVolumePosition(position);
|
|
51
|
+
},
|
|
52
|
+
onPanResponderRelease: () => {
|
|
53
|
+
setControlTimeout();
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const seekPanResponder = PanResponder.create({
|
|
58
|
+
onStartShouldSetPanResponder: () => true,
|
|
59
|
+
onMoveShouldSetPanResponder: () => true,
|
|
60
|
+
onPanResponderGrant: (evt) => {
|
|
61
|
+
setSeeking(true);
|
|
62
|
+
clearControlTimeout();
|
|
63
|
+
const position = evt.nativeEvent.locationX;
|
|
64
|
+
setSeekerPosition(position);
|
|
65
|
+
},
|
|
66
|
+
onPanResponderMove: (_evt, gestureState) => {
|
|
67
|
+
const diff = horizontal ? gestureState.dx : gestureState.dy;
|
|
68
|
+
const position = seekerOffset + diff * (inverted ? -1 : 1);
|
|
69
|
+
setSeekerPosition(position);
|
|
70
|
+
setSeeking(true);
|
|
71
|
+
},
|
|
72
|
+
onPanResponderRelease: () => {
|
|
73
|
+
const percent = seekerPosition / seekerWidth;
|
|
74
|
+
const time = duration * percent;
|
|
75
|
+
|
|
76
|
+
if (time >= duration && !loading) {
|
|
77
|
+
if (typeof onEnd === 'function') {
|
|
78
|
+
onEnd();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
setSeeking(false);
|
|
83
|
+
seek && seek(time);
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (seeking) {
|
|
89
|
+
const percent = seekerPosition / seekerWidth;
|
|
90
|
+
const time = duration * percent;
|
|
91
|
+
seek && seek(time);
|
|
92
|
+
}
|
|
93
|
+
}, [duration, seek, seekerPosition, seekerWidth, seeking]);
|
|
94
|
+
|
|
95
|
+
return {volumePanResponder, seekPanResponder};
|
|
96
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const _styles = {
|
|
4
|
+
player: StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
overflow: 'hidden',
|
|
7
|
+
backgroundColor: '#000',
|
|
8
|
+
flex: 1,
|
|
9
|
+
},
|
|
10
|
+
video: {
|
|
11
|
+
overflow: 'hidden',
|
|
12
|
+
position: 'absolute',
|
|
13
|
+
top: 0,
|
|
14
|
+
right: 0,
|
|
15
|
+
bottom: 0,
|
|
16
|
+
left: 0,
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
};
|