@amityco/react-native-social-uikit 4.1.0 → 4.1.1-11cdc854.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/core/assets/icons/xml.js +55 -1
- package/lib/commonjs/core/assets/icons/xml.js.map +1 -1
- package/lib/commonjs/core/hooks/usePostByIds.js +38 -0
- package/lib/commonjs/core/hooks/usePostByIds.js.map +1 -0
- package/lib/commonjs/social/components/LoadingImage/index.js +4 -3
- package/lib/commonjs/social/components/LoadingImage/index.js.map +1 -1
- package/lib/commonjs/social/components/LoadingImage/styles.js +4 -0
- package/lib/commonjs/social/components/LoadingImage/styles.js.map +1 -1
- package/lib/commonjs/social/components/LoadingVideo/index.js +12 -6
- package/lib/commonjs/social/components/LoadingVideo/index.js.map +1 -1
- package/lib/commonjs/social/components/LoadingVideo/styles.js +4 -0
- package/lib/commonjs/social/components/LoadingVideo/styles.js.map +1 -1
- package/lib/commonjs/social/components/MediaViewer/MediaViewer.js +266 -0
- package/lib/commonjs/social/components/MediaViewer/MediaViewer.js.map +1 -0
- package/lib/commonjs/social/components/MediaViewer/index.js +13 -0
- package/lib/commonjs/social/components/MediaViewer/index.js.map +1 -0
- package/lib/commonjs/social/components/MediaViewer/styles.js +116 -0
- package/lib/commonjs/social/components/MediaViewer/styles.js.map +1 -0
- package/lib/commonjs/social/components/PostContent/index.js +75 -120
- package/lib/commonjs/social/components/PostContent/index.js.map +1 -1
- package/lib/commonjs/social/components/SelectedMediaComponent/SelectedMediaComponent.js +180 -0
- package/lib/commonjs/social/components/SelectedMediaComponent/SelectedMediaComponent.js.map +1 -0
- package/lib/commonjs/social/components/SelectedMediaComponent/index.js +13 -0
- package/lib/commonjs/social/components/SelectedMediaComponent/index.js.map +1 -0
- package/lib/commonjs/social/components/SelectedMediaComponent/styles.js +43 -0
- package/lib/commonjs/social/components/SelectedMediaComponent/styles.js.map +1 -0
- package/lib/commonjs/social/constants/index.js +11 -0
- package/lib/commonjs/social/constants/index.js.map +1 -0
- package/lib/commonjs/social/elements/PostMediaElement/PostMediaElement.js +280 -0
- package/lib/commonjs/social/elements/PostMediaElement/PostMediaElement.js.map +1 -0
- package/lib/commonjs/social/elements/PostMediaElement/index.js +13 -0
- package/lib/commonjs/social/elements/PostMediaElement/index.js.map +1 -0
- package/lib/commonjs/social/elements/PostMediaElement/styles.js +117 -0
- package/lib/commonjs/social/elements/PostMediaElement/styles.js.map +1 -0
- package/lib/commonjs/social/features/post/Composer/PostComposer.js +91 -106
- package/lib/commonjs/social/features/post/Composer/PostComposer.js.map +1 -1
- package/lib/commonjs/social/features/post/components/DetailedMediaAttachment/DetailedMediaAttachment.js +17 -7
- package/lib/commonjs/social/features/post/components/DetailedMediaAttachment/DetailedMediaAttachment.js.map +1 -1
- package/lib/commonjs/social/features/post/components/MediaAttachment/MediaAttachment.js +17 -7
- package/lib/commonjs/social/features/post/components/MediaAttachment/MediaAttachment.js.map +1 -1
- package/lib/commonjs/social/utils/getFrameRatio.js +52 -0
- package/lib/commonjs/social/utils/getFrameRatio.js.map +1 -0
- package/lib/commonjs/social/utils/getIndicatorConfig.js +59 -0
- package/lib/commonjs/social/utils/getIndicatorConfig.js.map +1 -0
- package/lib/module/core/assets/icons/xml.js +48 -0
- package/lib/module/core/assets/icons/xml.js.map +1 -1
- package/lib/module/core/hooks/usePostByIds.js +32 -0
- package/lib/module/core/hooks/usePostByIds.js.map +1 -0
- package/lib/module/social/components/LoadingImage/index.js +4 -3
- package/lib/module/social/components/LoadingImage/index.js.map +1 -1
- package/lib/module/social/components/LoadingImage/styles.js +4 -0
- package/lib/module/social/components/LoadingImage/styles.js.map +1 -1
- package/lib/module/social/components/LoadingVideo/index.js +13 -7
- package/lib/module/social/components/LoadingVideo/index.js.map +1 -1
- package/lib/module/social/components/LoadingVideo/styles.js +4 -0
- package/lib/module/social/components/LoadingVideo/styles.js.map +1 -1
- package/lib/module/social/components/MediaViewer/MediaViewer.js +259 -0
- package/lib/module/social/components/MediaViewer/MediaViewer.js.map +1 -0
- package/lib/module/social/components/MediaViewer/index.js +2 -0
- package/lib/module/social/components/MediaViewer/index.js.map +1 -0
- package/lib/module/social/components/MediaViewer/styles.js +109 -0
- package/lib/module/social/components/MediaViewer/styles.js.map +1 -0
- package/lib/module/social/components/PostContent/index.js +77 -122
- package/lib/module/social/components/PostContent/index.js.map +1 -1
- package/lib/module/social/components/SelectedMediaComponent/SelectedMediaComponent.js +174 -0
- package/lib/module/social/components/SelectedMediaComponent/SelectedMediaComponent.js.map +1 -0
- package/lib/module/social/components/SelectedMediaComponent/index.js +2 -0
- package/lib/module/social/components/SelectedMediaComponent/index.js.map +1 -0
- package/lib/module/social/components/SelectedMediaComponent/styles.js +36 -0
- package/lib/module/social/components/SelectedMediaComponent/styles.js.map +1 -0
- package/lib/module/social/constants/index.js +5 -0
- package/lib/module/social/constants/index.js.map +1 -0
- package/lib/module/social/elements/PostMediaElement/PostMediaElement.js +273 -0
- package/lib/module/social/elements/PostMediaElement/PostMediaElement.js.map +1 -0
- package/lib/module/social/elements/PostMediaElement/index.js +2 -0
- package/lib/module/social/elements/PostMediaElement/index.js.map +1 -0
- package/lib/module/social/elements/PostMediaElement/styles.js +110 -0
- package/lib/module/social/elements/PostMediaElement/styles.js.map +1 -0
- package/lib/module/social/features/post/Composer/PostComposer.js +94 -109
- package/lib/module/social/features/post/Composer/PostComposer.js.map +1 -1
- package/lib/module/social/features/post/components/DetailedMediaAttachment/DetailedMediaAttachment.js +17 -7
- package/lib/module/social/features/post/components/DetailedMediaAttachment/DetailedMediaAttachment.js.map +1 -1
- package/lib/module/social/features/post/components/MediaAttachment/MediaAttachment.js +17 -7
- package/lib/module/social/features/post/components/MediaAttachment/MediaAttachment.js.map +1 -1
- package/lib/module/social/utils/getFrameRatio.js +44 -0
- package/lib/module/social/utils/getFrameRatio.js.map +1 -0
- package/lib/module/social/utils/getIndicatorConfig.js +53 -0
- package/lib/module/social/utils/getIndicatorConfig.js.map +1 -0
- package/lib/typescript/core/assets/icons/xml.d.ts +7 -0
- package/lib/typescript/core/assets/icons/xml.d.ts.map +1 -1
- package/lib/typescript/core/hooks/usePostByIds.d.ts +8 -0
- package/lib/typescript/core/hooks/usePostByIds.d.ts.map +1 -0
- package/lib/typescript/core/types/mention.d.ts +6 -0
- package/lib/typescript/core/types/mention.d.ts.map +1 -1
- package/lib/typescript/social/components/LoadingImage/index.d.ts +2 -1
- package/lib/typescript/social/components/LoadingImage/index.d.ts.map +1 -1
- package/lib/typescript/social/components/LoadingImage/styles.d.ts +4 -0
- package/lib/typescript/social/components/LoadingImage/styles.d.ts.map +1 -1
- package/lib/typescript/social/components/LoadingVideo/index.d.ts +2 -1
- package/lib/typescript/social/components/LoadingVideo/index.d.ts.map +1 -1
- package/lib/typescript/social/components/LoadingVideo/styles.d.ts +4 -0
- package/lib/typescript/social/components/LoadingVideo/styles.d.ts.map +1 -1
- package/lib/typescript/social/components/MediaViewer/MediaViewer.d.ts +17 -0
- package/lib/typescript/social/components/MediaViewer/MediaViewer.d.ts.map +1 -0
- package/lib/typescript/social/components/MediaViewer/index.d.ts +3 -0
- package/lib/typescript/social/components/MediaViewer/index.d.ts.map +1 -0
- package/lib/typescript/social/components/MediaViewer/styles.d.ts +99 -0
- package/lib/typescript/social/components/MediaViewer/styles.d.ts.map +1 -0
- package/lib/typescript/social/components/PostContent/index.d.ts.map +1 -1
- package/lib/typescript/social/components/SelectedMediaComponent/SelectedMediaComponent.d.ts +12 -0
- package/lib/typescript/social/components/SelectedMediaComponent/SelectedMediaComponent.d.ts.map +1 -0
- package/lib/typescript/social/components/SelectedMediaComponent/index.d.ts +3 -0
- package/lib/typescript/social/components/SelectedMediaComponent/index.d.ts.map +1 -0
- package/lib/typescript/social/components/SelectedMediaComponent/styles.d.ts +25 -0
- package/lib/typescript/social/components/SelectedMediaComponent/styles.d.ts.map +1 -0
- package/lib/typescript/social/constants/index.d.ts +4 -0
- package/lib/typescript/social/constants/index.d.ts.map +1 -0
- package/lib/typescript/social/elements/PostMediaElement/PostMediaElement.d.ts +15 -0
- package/lib/typescript/social/elements/PostMediaElement/PostMediaElement.d.ts.map +1 -0
- package/lib/typescript/social/elements/PostMediaElement/index.d.ts +3 -0
- package/lib/typescript/social/elements/PostMediaElement/index.d.ts.map +1 -0
- package/lib/typescript/social/elements/PostMediaElement/styles.d.ts +88 -0
- package/lib/typescript/social/elements/PostMediaElement/styles.d.ts.map +1 -0
- package/lib/typescript/social/features/post/Composer/PostComposer.d.ts.map +1 -1
- package/lib/typescript/social/features/post/components/DetailedMediaAttachment/DetailedMediaAttachment.d.ts +3 -0
- package/lib/typescript/social/features/post/components/DetailedMediaAttachment/DetailedMediaAttachment.d.ts.map +1 -1
- package/lib/typescript/social/features/post/components/MediaAttachment/MediaAttachment.d.ts +3 -0
- package/lib/typescript/social/features/post/components/MediaAttachment/MediaAttachment.d.ts.map +1 -1
- package/lib/typescript/social/utils/getFrameRatio.d.ts +21 -0
- package/lib/typescript/social/utils/getFrameRatio.d.ts.map +1 -0
- package/lib/typescript/social/utils/getIndicatorConfig.d.ts +11 -0
- package/lib/typescript/social/utils/getIndicatorConfig.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/core/assets/icons/xml.ts +60 -0
- package/src/core/hooks/usePostByIds.ts +33 -0
- package/src/core/types/mention.ts +6 -0
- package/src/social/components/LoadingImage/index.tsx +12 -2
- package/src/social/components/LoadingImage/styles.ts +4 -0
- package/src/social/components/LoadingVideo/index.tsx +28 -4
- package/src/social/components/LoadingVideo/styles.ts +4 -0
- package/src/social/components/MediaViewer/MediaViewer.tsx +384 -0
- package/src/social/components/MediaViewer/index.tsx +2 -0
- package/src/social/components/MediaViewer/styles.ts +109 -0
- package/src/social/components/PostContent/index.tsx +86 -159
- package/src/social/components/SelectedMediaComponent/SelectedMediaComponent.tsx +236 -0
- package/src/social/components/SelectedMediaComponent/index.ts +2 -0
- package/src/social/components/SelectedMediaComponent/styles.ts +38 -0
- package/src/social/constants/index.ts +4 -0
- package/src/social/elements/PostMediaElement/PostMediaElement.tsx +362 -0
- package/src/social/elements/PostMediaElement/index.tsx +5 -0
- package/src/social/elements/PostMediaElement/styles.ts +99 -0
- package/src/social/features/post/Composer/PostComposer.tsx +107 -123
- package/src/social/features/post/components/DetailedMediaAttachment/DetailedMediaAttachment.tsx +10 -3
- package/src/social/features/post/components/MediaAttachment/MediaAttachment.tsx +14 -3
- package/src/social/utils/getFrameRatio.ts +42 -0
- package/src/social/utils/getIndicatorConfig.ts +62 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { FlatList, Image, Modal, PanResponder, Pressable, StyleSheet, Text, TouchableOpacity, useWindowDimensions, View } from 'react-native';
|
|
4
|
+
import Video from 'react-native-video';
|
|
5
|
+
import { SvgXml } from 'react-native-svg';
|
|
6
|
+
import { clearIcon, pauseControlIcon, playControlIcon, soundOnIcon, soundOffIcon } from '../../../core/assets/icons/xml';
|
|
7
|
+
import { useStyles } from './styles';
|
|
8
|
+
const CONTROLS_AUTO_HIDE_MS = 3000;
|
|
9
|
+
function formatTime(seconds) {
|
|
10
|
+
if (!Number.isFinite(seconds) || seconds < 0) return '0:00';
|
|
11
|
+
const total = Math.floor(seconds);
|
|
12
|
+
const mins = Math.floor(total / 60);
|
|
13
|
+
const secs = total % 60;
|
|
14
|
+
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
|
15
|
+
}
|
|
16
|
+
export function MediaViewer({
|
|
17
|
+
visible,
|
|
18
|
+
items,
|
|
19
|
+
initialIndex,
|
|
20
|
+
onClose
|
|
21
|
+
}) {
|
|
22
|
+
var _items$current;
|
|
23
|
+
const {
|
|
24
|
+
styles
|
|
25
|
+
} = useStyles();
|
|
26
|
+
const {
|
|
27
|
+
width
|
|
28
|
+
} = useWindowDimensions();
|
|
29
|
+
const listRef = useRef(null);
|
|
30
|
+
const videoRef = useRef(null);
|
|
31
|
+
const [current, setCurrent] = useState(initialIndex);
|
|
32
|
+
// Mute-carry (PDT-4309 / PDT-4312): the first video plays unmuted; each swipe
|
|
33
|
+
// defaults the next video to muted — until the user unmutes, after which
|
|
34
|
+
// subsequent videos stay unmuted.
|
|
35
|
+
const [muted, setMuted] = useState(false);
|
|
36
|
+
const keepUnmutedRef = useRef(false);
|
|
37
|
+
|
|
38
|
+
// --- playback controls (ported from web VideoPlayerControls) ---
|
|
39
|
+
const [userPaused, setUserPaused] = useState(false);
|
|
40
|
+
const [progress, setProgress] = useState(0);
|
|
41
|
+
const [duration, setDuration] = useState(0);
|
|
42
|
+
const [scrubbing, setScrubbing] = useState(false);
|
|
43
|
+
const [controlsVisible, setControlsVisible] = useState(true);
|
|
44
|
+
const [trackWidth, setTrackWidth] = useState(0);
|
|
45
|
+
const hideTimer = useRef(null);
|
|
46
|
+
const clearHideTimer = useCallback(() => {
|
|
47
|
+
if (hideTimer.current) {
|
|
48
|
+
clearTimeout(hideTimer.current);
|
|
49
|
+
hideTimer.current = null;
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
const scheduleHide = useCallback(() => {
|
|
53
|
+
clearHideTimer();
|
|
54
|
+
hideTimer.current = setTimeout(() => setControlsVisible(false), CONTROLS_AUTO_HIDE_MS);
|
|
55
|
+
}, [clearHideTimer]);
|
|
56
|
+
const revealControls = useCallback(() => {
|
|
57
|
+
setControlsVisible(true);
|
|
58
|
+
scheduleHide();
|
|
59
|
+
}, [scheduleHide]);
|
|
60
|
+
const resetPlayback = useCallback(() => {
|
|
61
|
+
setUserPaused(false);
|
|
62
|
+
setProgress(0);
|
|
63
|
+
setDuration(0);
|
|
64
|
+
setScrubbing(false);
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!visible) {
|
|
68
|
+
clearHideTimer();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setCurrent(initialIndex);
|
|
72
|
+
setMuted(false);
|
|
73
|
+
keepUnmutedRef.current = false;
|
|
74
|
+
resetPlayback();
|
|
75
|
+
revealControls();
|
|
76
|
+
}, [visible, initialIndex, resetPlayback, revealControls, clearHideTimer]);
|
|
77
|
+
const onMomentumScrollEnd = useCallback(e => {
|
|
78
|
+
if (!width) return;
|
|
79
|
+
const idx = Math.round(e.nativeEvent.contentOffset.x / width);
|
|
80
|
+
if (idx !== current) {
|
|
81
|
+
setCurrent(idx);
|
|
82
|
+
setMuted(!keepUnmutedRef.current);
|
|
83
|
+
resetPlayback();
|
|
84
|
+
revealControls();
|
|
85
|
+
}
|
|
86
|
+
}, [width, current, resetPlayback, revealControls]);
|
|
87
|
+
const toggleMute = useCallback(() => {
|
|
88
|
+
setMuted(prev => {
|
|
89
|
+
const next = !prev;
|
|
90
|
+
keepUnmutedRef.current = !next; // user unmuted -> keep unmuted afterwards
|
|
91
|
+
return next;
|
|
92
|
+
});
|
|
93
|
+
revealControls();
|
|
94
|
+
}, [revealControls]);
|
|
95
|
+
const togglePlay = useCallback(() => {
|
|
96
|
+
setUserPaused(p => !p);
|
|
97
|
+
revealControls();
|
|
98
|
+
}, [revealControls]);
|
|
99
|
+
const onLoad = useCallback(data => {
|
|
100
|
+
setDuration(data.duration ?? 0);
|
|
101
|
+
}, []);
|
|
102
|
+
const onProgress = useCallback(data => {
|
|
103
|
+
if (!scrubbing) setProgress(data.currentTime);
|
|
104
|
+
}, [scrubbing]);
|
|
105
|
+
const seekToX = useCallback(locationX => {
|
|
106
|
+
if (trackWidth <= 0 || duration <= 0) return;
|
|
107
|
+
const ratio = Math.max(0, Math.min(1, locationX / trackWidth));
|
|
108
|
+
setProgress(ratio * duration);
|
|
109
|
+
}, [trackWidth, duration]);
|
|
110
|
+
|
|
111
|
+
// Scrubber: a horizontal drag inside a horizontal pager. We claim the gesture
|
|
112
|
+
// and disable FlatList scroll while scrubbing so the two don't fight.
|
|
113
|
+
const panResponder = useMemo(() => PanResponder.create({
|
|
114
|
+
onStartShouldSetPanResponder: () => true,
|
|
115
|
+
onMoveShouldSetPanResponder: () => true,
|
|
116
|
+
onPanResponderGrant: e => {
|
|
117
|
+
setScrubbing(true);
|
|
118
|
+
clearHideTimer();
|
|
119
|
+
setControlsVisible(true);
|
|
120
|
+
seekToX(e.nativeEvent.locationX);
|
|
121
|
+
},
|
|
122
|
+
onPanResponderMove: e => {
|
|
123
|
+
seekToX(e.nativeEvent.locationX);
|
|
124
|
+
},
|
|
125
|
+
onPanResponderRelease: e => {
|
|
126
|
+
var _videoRef$current;
|
|
127
|
+
const ratio = trackWidth > 0 ? Math.max(0, Math.min(1, e.nativeEvent.locationX / trackWidth)) : 0;
|
|
128
|
+
const target = ratio * (duration || 0);
|
|
129
|
+
(_videoRef$current = videoRef.current) === null || _videoRef$current === void 0 || _videoRef$current.seek(target);
|
|
130
|
+
setProgress(target);
|
|
131
|
+
setScrubbing(false);
|
|
132
|
+
scheduleHide();
|
|
133
|
+
},
|
|
134
|
+
onPanResponderTerminate: () => {
|
|
135
|
+
setScrubbing(false);
|
|
136
|
+
scheduleHide();
|
|
137
|
+
}
|
|
138
|
+
}), [seekToX, clearHideTimer, scheduleHide, trackWidth, duration]);
|
|
139
|
+
const onTrackLayout = useCallback(e => {
|
|
140
|
+
setTrackWidth(e.nativeEvent.layout.width);
|
|
141
|
+
}, []);
|
|
142
|
+
|
|
143
|
+
// The control overlay must live INSIDE the page (a descendant of the pager),
|
|
144
|
+
// so horizontal drags on the tap-target are reclaimed by the FlatList's
|
|
145
|
+
// native scroll — a container-level sibling overlay would swallow swipes.
|
|
146
|
+
const renderControls = useCallback(() => {
|
|
147
|
+
const progressPct = duration > 0 ? Math.max(0, Math.min(1, progress / duration)) : 0;
|
|
148
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
149
|
+
style: StyleSheet.absoluteFill,
|
|
150
|
+
pointerEvents: "box-none"
|
|
151
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
152
|
+
style: StyleSheet.absoluteFill,
|
|
153
|
+
onPress: () => controlsVisible ? setControlsVisible(false) : revealControls()
|
|
154
|
+
}), controlsVisible && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
155
|
+
style: styles.centerControls,
|
|
156
|
+
pointerEvents: "box-none"
|
|
157
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
158
|
+
style: styles.centerBtn,
|
|
159
|
+
onPress: togglePlay
|
|
160
|
+
}, /*#__PURE__*/React.createElement(SvgXml, {
|
|
161
|
+
xml: userPaused ? playControlIcon('#FFFFFF') : pauseControlIcon('#FFFFFF'),
|
|
162
|
+
width: 24,
|
|
163
|
+
height: 24
|
|
164
|
+
}))), /*#__PURE__*/React.createElement(View, {
|
|
165
|
+
style: styles.controlBar,
|
|
166
|
+
pointerEvents: "box-none"
|
|
167
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
168
|
+
style: styles.controlTime
|
|
169
|
+
}, formatTime(progress), " / ", formatTime(duration)), /*#__PURE__*/React.createElement(View, _extends({
|
|
170
|
+
style: styles.progressTrack,
|
|
171
|
+
onLayout: onTrackLayout
|
|
172
|
+
}, panResponder.panHandlers), /*#__PURE__*/React.createElement(View, {
|
|
173
|
+
style: styles.progressBg
|
|
174
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
175
|
+
style: [styles.progressFill, {
|
|
176
|
+
width: `${progressPct * 100}%`
|
|
177
|
+
}]
|
|
178
|
+
})))));
|
|
179
|
+
}, [styles, controlsVisible, setControlsVisible, revealControls, togglePlay, userPaused, progress, duration, onTrackLayout, panResponder]);
|
|
180
|
+
const renderItem = useCallback(({
|
|
181
|
+
item,
|
|
182
|
+
index
|
|
183
|
+
}) => /*#__PURE__*/React.createElement(View, {
|
|
184
|
+
style: [styles.page, {
|
|
185
|
+
width
|
|
186
|
+
}]
|
|
187
|
+
}, item.type === 'video' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
188
|
+
style: styles.media,
|
|
189
|
+
pointerEvents: "none"
|
|
190
|
+
}, /*#__PURE__*/React.createElement(Video, {
|
|
191
|
+
ref: index === current ? videoRef : undefined,
|
|
192
|
+
source: item.videoType ? {
|
|
193
|
+
uri: item.uri,
|
|
194
|
+
type: item.videoType
|
|
195
|
+
} : {
|
|
196
|
+
uri: item.uri
|
|
197
|
+
},
|
|
198
|
+
style: styles.media,
|
|
199
|
+
resizeMode: "contain",
|
|
200
|
+
paused: index !== current || !visible || userPaused,
|
|
201
|
+
muted: muted && index === current,
|
|
202
|
+
repeat: true,
|
|
203
|
+
playInBackground: false,
|
|
204
|
+
playWhenInactive: false,
|
|
205
|
+
onLoad: index === current ? onLoad : undefined,
|
|
206
|
+
onProgress: index === current ? onProgress : undefined
|
|
207
|
+
})), index === current && renderControls()) : /*#__PURE__*/React.createElement(Image, {
|
|
208
|
+
source: {
|
|
209
|
+
uri: item.uri
|
|
210
|
+
},
|
|
211
|
+
style: styles.media,
|
|
212
|
+
resizeMode: "contain"
|
|
213
|
+
})), [styles, width, current, muted, visible, userPaused, onLoad, onProgress, renderControls]);
|
|
214
|
+
const currentIsVideo = ((_items$current = items[current]) === null || _items$current === void 0 ? void 0 : _items$current.type) === 'video';
|
|
215
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
216
|
+
visible: visible,
|
|
217
|
+
transparent: true,
|
|
218
|
+
animationType: "fade",
|
|
219
|
+
onRequestClose: () => onClose(current)
|
|
220
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
221
|
+
style: styles.container
|
|
222
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
223
|
+
style: styles.header
|
|
224
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
225
|
+
style: styles.headerBtn,
|
|
226
|
+
onPress: () => onClose(current)
|
|
227
|
+
}, /*#__PURE__*/React.createElement(SvgXml, {
|
|
228
|
+
xml: clearIcon('white'),
|
|
229
|
+
width: 28,
|
|
230
|
+
height: 28
|
|
231
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
232
|
+
style: styles.counter
|
|
233
|
+
}, current + 1, "/", items.length), /*#__PURE__*/React.createElement(View, {
|
|
234
|
+
style: styles.headerBtn__right
|
|
235
|
+
}, currentIsVideo && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
236
|
+
onPress: toggleMute
|
|
237
|
+
}, /*#__PURE__*/React.createElement(SvgXml, {
|
|
238
|
+
xml: muted ? soundOffIcon('#FFFFFF') : soundOnIcon('#FFFFFF'),
|
|
239
|
+
width: 24,
|
|
240
|
+
height: 24
|
|
241
|
+
})))), /*#__PURE__*/React.createElement(FlatList, {
|
|
242
|
+
ref: listRef,
|
|
243
|
+
data: items,
|
|
244
|
+
horizontal: true,
|
|
245
|
+
pagingEnabled: true,
|
|
246
|
+
scrollEnabled: !scrubbing,
|
|
247
|
+
showsHorizontalScrollIndicator: false,
|
|
248
|
+
keyExtractor: (it, i) => `${it.uri}-${i}`,
|
|
249
|
+
renderItem: renderItem,
|
|
250
|
+
getItemLayout: (_, index) => ({
|
|
251
|
+
length: width,
|
|
252
|
+
offset: width * index,
|
|
253
|
+
index
|
|
254
|
+
}),
|
|
255
|
+
initialScrollIndex: initialIndex,
|
|
256
|
+
onMomentumScrollEnd: onMomentumScrollEnd
|
|
257
|
+
})));
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=MediaViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","FlatList","Image","Modal","PanResponder","Pressable","StyleSheet","Text","TouchableOpacity","useWindowDimensions","View","Video","SvgXml","clearIcon","pauseControlIcon","playControlIcon","soundOnIcon","soundOffIcon","useStyles","CONTROLS_AUTO_HIDE_MS","formatTime","seconds","Number","isFinite","total","Math","floor","mins","secs","toString","padStart","MediaViewer","visible","items","initialIndex","onClose","_items$current","styles","width","listRef","videoRef","current","setCurrent","muted","setMuted","keepUnmutedRef","userPaused","setUserPaused","progress","setProgress","duration","setDuration","scrubbing","setScrubbing","controlsVisible","setControlsVisible","trackWidth","setTrackWidth","hideTimer","clearHideTimer","clearTimeout","scheduleHide","setTimeout","revealControls","resetPlayback","onMomentumScrollEnd","e","idx","round","nativeEvent","contentOffset","x","toggleMute","prev","next","togglePlay","p","onLoad","data","onProgress","currentTime","seekToX","locationX","ratio","max","min","panResponder","create","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","onPanResponderGrant","onPanResponderMove","onPanResponderRelease","_videoRef$current","target","seek","onPanResponderTerminate","onTrackLayout","layout","renderControls","progressPct","React","createElement","style","absoluteFill","pointerEvents","onPress","Fragment","centerControls","centerBtn","xml","height","controlBar","controlTime","_extends","progressTrack","onLayout","panHandlers","progressBg","progressFill","renderItem","item","index","page","type","media","ref","undefined","source","videoType","uri","resizeMode","paused","repeat","playInBackground","playWhenInactive","currentIsVideo","transparent","animationType","onRequestClose","container","header","headerBtn","counter","length","headerBtn__right","horizontal","pagingEnabled","scrollEnabled","showsHorizontalScrollIndicator","keyExtractor","it","i","getItemLayout","_","offset","initialScrollIndex"],"sourceRoot":"../../../../../src","sources":["social/components/MediaViewer/MediaViewer.tsx"],"mappings":";AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SACEC,QAAQ,EAERC,KAAK,EAGLC,KAAK,EAGLC,YAAY,EACZC,SAAS,EAETC,UAAU,EACVC,IAAI,EACJC,gBAAgB,EAChBC,mBAAmB,EACnBC,IAAI,QACC,cAAc;AACrB,OAAOC,KAAK,MAIL,oBAAoB;AAC3B,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SACEC,SAAS,EACTC,gBAAgB,EAChBC,eAAe,EACfC,WAAW,EACXC,YAAY,QACP,gCAAgC;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version":3,"names":["MediaViewer"],"sourceRoot":"../../../../../src","sources":["social/components/MediaViewer/index.tsx"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { useTheme } from 'react-native-paper';
|
|
3
|
+
export const useStyles = () => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
const styles = StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
flex: 1,
|
|
8
|
+
backgroundColor: '#000000'
|
|
9
|
+
},
|
|
10
|
+
header: {
|
|
11
|
+
flexDirection: 'row',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'space-between',
|
|
14
|
+
paddingHorizontal: 16,
|
|
15
|
+
height: 56,
|
|
16
|
+
zIndex: 2
|
|
17
|
+
},
|
|
18
|
+
headerBtn: {
|
|
19
|
+
minWidth: 44,
|
|
20
|
+
height: 44,
|
|
21
|
+
alignItems: 'flex-start',
|
|
22
|
+
justifyContent: 'center'
|
|
23
|
+
},
|
|
24
|
+
headerBtn__right: {
|
|
25
|
+
minWidth: 44,
|
|
26
|
+
height: 44,
|
|
27
|
+
alignItems: 'flex-end',
|
|
28
|
+
justifyContent: 'center'
|
|
29
|
+
},
|
|
30
|
+
counter: {
|
|
31
|
+
color: '#FFFFFF',
|
|
32
|
+
fontSize: 14,
|
|
33
|
+
fontWeight: '600'
|
|
34
|
+
},
|
|
35
|
+
muteGlyph: {
|
|
36
|
+
fontSize: 20
|
|
37
|
+
},
|
|
38
|
+
page: {
|
|
39
|
+
flex: 1,
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
justifyContent: 'center'
|
|
42
|
+
},
|
|
43
|
+
media: {
|
|
44
|
+
width: '100%',
|
|
45
|
+
height: '100%'
|
|
46
|
+
},
|
|
47
|
+
// --- video control bar (ported from web VideoPlayerControls) ---
|
|
48
|
+
controlBar: {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
left: 0,
|
|
51
|
+
right: 0,
|
|
52
|
+
bottom: 0,
|
|
53
|
+
paddingHorizontal: 16,
|
|
54
|
+
paddingBottom: 24,
|
|
55
|
+
paddingTop: 12,
|
|
56
|
+
zIndex: 3
|
|
57
|
+
},
|
|
58
|
+
controlTime: {
|
|
59
|
+
color: '#FFFFFF',
|
|
60
|
+
fontSize: 12,
|
|
61
|
+
fontWeight: '600',
|
|
62
|
+
marginBottom: 8
|
|
63
|
+
},
|
|
64
|
+
progressTrack: {
|
|
65
|
+
height: 24,
|
|
66
|
+
justifyContent: 'center'
|
|
67
|
+
},
|
|
68
|
+
progressBg: {
|
|
69
|
+
height: 4,
|
|
70
|
+
borderRadius: 2,
|
|
71
|
+
backgroundColor: 'rgba(255, 255, 255, 0.3)'
|
|
72
|
+
},
|
|
73
|
+
progressFill: {
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
left: 0,
|
|
76
|
+
height: 4,
|
|
77
|
+
borderRadius: 2,
|
|
78
|
+
backgroundColor: '#FFFFFF'
|
|
79
|
+
},
|
|
80
|
+
// Centered play/pause + skip row (web .mobileControlsRow: top/left 50%,
|
|
81
|
+
// translate -50%, gap 2rem).
|
|
82
|
+
centerControls: {
|
|
83
|
+
position: 'absolute',
|
|
84
|
+
top: 0,
|
|
85
|
+
left: 0,
|
|
86
|
+
right: 0,
|
|
87
|
+
bottom: 0,
|
|
88
|
+
flexDirection: 'row',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
justifyContent: 'center'
|
|
91
|
+
},
|
|
92
|
+
// Circular translucent-black button (web .playButton/.skipButton: 2.5rem,
|
|
93
|
+
// border-radius 50%, transparent-black bg). 32px gap between buttons.
|
|
94
|
+
centerBtn: {
|
|
95
|
+
width: 40,
|
|
96
|
+
height: 40,
|
|
97
|
+
borderRadius: 20,
|
|
98
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
marginHorizontal: 16
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
styles,
|
|
106
|
+
theme
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","useTheme","useStyles","theme","styles","create","container","flex","backgroundColor","header","flexDirection","alignItems","justifyContent","paddingHorizontal","height","zIndex","headerBtn","minWidth","headerBtn__right","counter","color","fontSize","fontWeight","muteGlyph","page","media","width","controlBar","position","left","right","bottom","paddingBottom","paddingTop","controlTime","marginBottom","progressTrack","progressBg","borderRadius","progressFill","centerControls","top","centerBtn","marginHorizontal"],"sourceRoot":"../../../../../src","sources":["social/components/MediaViewer/styles.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAG7C,OAAO,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC7B,MAAMC,KAAK,GAAGF,QAAQ,CAAa,CAAC;EAEpC,MAAMG,MAAM,GAAGJ,UAAU,CAACK,MAAM,CAAC;IAC/BC,SAAS,EAAE;MACTC,IAAI,EAAE,CAAC;MACPC,eAAe,EAAE;IACnB,CAAC;IACDC,MAAM,EAAE;MACNC,aAAa,EAAE,KAAK;MACpBC,UAAU,EAAE,QAAQ;MACpBC,cAAc,EAAE,eAAe;MAC/BC,iBAAiB,EAAE,EAAE;MACrBC,MAAM,EAAE,EAAE;MACVC,MAAM,EAAE;IACV,CAAC;IACDC,SAAS,EAAE;MACTC,QAAQ,EAAE,EAAE;MACZH,MAAM,EAAE,EAAE;MACVH,UAAU,EAAE,YAAY;MACxBC,cAAc,EAAE;IAClB,CAAC;IACDM,gBAAgB,EAAE;MAChBD,QAAQ,EAAE,EAAE;MACZH,MAAM,EAAE,EAAE;MACVH,UAAU,EAAE,UAAU;MACtBC,cAAc,EAAE;IAClB,CAAC;IACDO,OAAO,EA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