@amityco/react-native-social-uikit 4.1.0 → 4.1.1-21d3e899.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 +43 -1
- package/lib/commonjs/core/assets/icons/xml.js.map +1 -1
- 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/MediaSelector/MediaSelector.js +164 -0
- package/lib/commonjs/social/components/MediaSelector/MediaSelector.js.map +1 -0
- package/lib/commonjs/social/components/MediaSelector/index.js +13 -0
- package/lib/commonjs/social/components/MediaSelector/index.js.map +1 -0
- package/lib/commonjs/social/components/MediaSelector/styles.js +130 -0
- package/lib/commonjs/social/components/MediaSelector/styles.js.map +1 -0
- package/lib/commonjs/social/components/MediaViewer/MediaViewer.js +134 -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 +60 -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 +147 -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 +244 -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 +57 -91
- 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 +38 -0
- package/lib/module/core/assets/icons/xml.js.map +1 -1
- 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/MediaSelector/MediaSelector.js +158 -0
- package/lib/module/social/components/MediaSelector/MediaSelector.js.map +1 -0
- package/lib/module/social/components/MediaSelector/index.js +2 -0
- package/lib/module/social/components/MediaSelector/index.js.map +1 -0
- package/lib/module/social/components/MediaSelector/styles.js +123 -0
- package/lib/module/social/components/MediaSelector/styles.js.map +1 -0
- package/lib/module/social/components/MediaViewer/MediaViewer.js +127 -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 +53 -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 +141 -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 +237 -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 +59 -93
- 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 +5 -0
- package/lib/typescript/core/assets/icons/xml.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/MediaSelector/MediaSelector.d.ts +14 -0
- package/lib/typescript/social/components/MediaSelector/MediaSelector.d.ts.map +1 -0
- package/lib/typescript/social/components/MediaSelector/index.d.ts +2 -0
- package/lib/typescript/social/components/MediaSelector/index.d.ts.map +1 -0
- package/lib/typescript/social/components/MediaSelector/styles.d.ts +116 -0
- package/lib/typescript/social/components/MediaSelector/styles.d.ts.map +1 -0
- 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 +48 -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 +5 -3
- package/src/core/assets/icons/xml.ts +46 -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/MediaSelector/MediaSelector.tsx +231 -0
- package/src/social/components/MediaSelector/index.tsx +1 -0
- package/src/social/components/MediaSelector/styles.ts +124 -0
- package/src/social/components/MediaViewer/MediaViewer.tsx +168 -0
- package/src/social/components/MediaViewer/index.tsx +2 -0
- package/src/social/components/MediaViewer/styles.ts +53 -0
- package/src/social/components/PostContent/index.tsx +86 -159
- package/src/social/components/SelectedMediaComponent/SelectedMediaComponent.tsx +202 -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 +318 -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 +70 -96
- 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,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStyles = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _reactNativePaper = require("react-native-paper");
|
|
9
|
+
const NUM_COLUMNS = 3;
|
|
10
|
+
const CELL_GAP = 2;
|
|
11
|
+
const useStyles = () => {
|
|
12
|
+
const theme = (0, _reactNativePaper.useTheme)();
|
|
13
|
+
const {
|
|
14
|
+
width
|
|
15
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
16
|
+
const cellSize = Math.floor((width - CELL_GAP * (NUM_COLUMNS - 1)) / NUM_COLUMNS);
|
|
17
|
+
const styles = _reactNative.StyleSheet.create({
|
|
18
|
+
container: {
|
|
19
|
+
flex: 1,
|
|
20
|
+
backgroundColor: theme.colors.background
|
|
21
|
+
},
|
|
22
|
+
header: {
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
paddingHorizontal: 16,
|
|
27
|
+
height: 56
|
|
28
|
+
},
|
|
29
|
+
headerButton: {
|
|
30
|
+
minWidth: 64
|
|
31
|
+
},
|
|
32
|
+
headerButton__right: {
|
|
33
|
+
minWidth: 64,
|
|
34
|
+
alignItems: 'flex-end'
|
|
35
|
+
},
|
|
36
|
+
headerTitle: {
|
|
37
|
+
color: theme.colors.base,
|
|
38
|
+
fontSize: 16,
|
|
39
|
+
fontWeight: '600'
|
|
40
|
+
},
|
|
41
|
+
headerClose: {
|
|
42
|
+
color: theme.colors.base,
|
|
43
|
+
fontSize: 16
|
|
44
|
+
},
|
|
45
|
+
headerAdd: {
|
|
46
|
+
color: theme.colors.primary,
|
|
47
|
+
fontSize: 16,
|
|
48
|
+
fontWeight: '600'
|
|
49
|
+
},
|
|
50
|
+
headerAdd__disabled: {
|
|
51
|
+
color: theme.colors.baseShade3,
|
|
52
|
+
fontSize: 16,
|
|
53
|
+
fontWeight: '600'
|
|
54
|
+
},
|
|
55
|
+
grid: {
|
|
56
|
+
paddingBottom: 24
|
|
57
|
+
},
|
|
58
|
+
cell: {
|
|
59
|
+
width: cellSize,
|
|
60
|
+
height: cellSize,
|
|
61
|
+
marginRight: CELL_GAP,
|
|
62
|
+
marginBottom: CELL_GAP,
|
|
63
|
+
backgroundColor: theme.colors.baseShade4
|
|
64
|
+
},
|
|
65
|
+
cell__image: {
|
|
66
|
+
width: '100%',
|
|
67
|
+
height: '100%'
|
|
68
|
+
},
|
|
69
|
+
cell__selectedOverlay: {
|
|
70
|
+
..._reactNative.StyleSheet.absoluteFillObject,
|
|
71
|
+
borderWidth: 2,
|
|
72
|
+
borderColor: theme.colors.primary
|
|
73
|
+
},
|
|
74
|
+
cell__badge: {
|
|
75
|
+
position: 'absolute',
|
|
76
|
+
top: 6,
|
|
77
|
+
right: 6,
|
|
78
|
+
minWidth: 22,
|
|
79
|
+
height: 22,
|
|
80
|
+
borderRadius: 11,
|
|
81
|
+
paddingHorizontal: 5,
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
backgroundColor: theme.colors.primary
|
|
85
|
+
},
|
|
86
|
+
cell__badgeEmpty: {
|
|
87
|
+
position: 'absolute',
|
|
88
|
+
top: 6,
|
|
89
|
+
right: 6,
|
|
90
|
+
width: 22,
|
|
91
|
+
height: 22,
|
|
92
|
+
borderRadius: 11,
|
|
93
|
+
borderWidth: 1.5,
|
|
94
|
+
borderColor: '#FFFFFF',
|
|
95
|
+
backgroundColor: 'rgba(0,0,0,0.2)'
|
|
96
|
+
},
|
|
97
|
+
cell__badgeLabel: {
|
|
98
|
+
color: '#FFFFFF',
|
|
99
|
+
fontSize: 12,
|
|
100
|
+
fontWeight: '700'
|
|
101
|
+
},
|
|
102
|
+
cell__videoDuration: {
|
|
103
|
+
position: 'absolute',
|
|
104
|
+
bottom: 6,
|
|
105
|
+
right: 6,
|
|
106
|
+
color: '#FFFFFF',
|
|
107
|
+
fontSize: 11,
|
|
108
|
+
fontWeight: '600',
|
|
109
|
+
textShadowColor: 'rgba(0,0,0,0.6)',
|
|
110
|
+
textShadowRadius: 2
|
|
111
|
+
},
|
|
112
|
+
empty: {
|
|
113
|
+
flex: 1,
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
justifyContent: 'center',
|
|
116
|
+
padding: 32
|
|
117
|
+
},
|
|
118
|
+
empty__text: {
|
|
119
|
+
color: theme.colors.baseShade1,
|
|
120
|
+
fontSize: 14,
|
|
121
|
+
textAlign: 'center'
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
styles,
|
|
126
|
+
theme
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
exports.useStyles = useStyles;
|
|
130
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativePaper","NUM_COLUMNS","CELL_GAP","useStyles","theme","useTheme","width","useWindowDimensions","cellSize","Math","floor","styles","StyleSheet","create","container","flex","backgroundColor","colors","background","header","flexDirection","alignItems","justifyContent","paddingHorizontal","height","headerButton","minWidth","headerButton__right","headerTitle","color","base","fontSize","fontWeight","headerClose","headerAdd","primary","headerAdd__disabled","baseShade3","grid","paddingBottom","cell","marginRight","marginBottom","baseShade4","cell__image","cell__selectedOverlay","absoluteFillObject","borderWidth","borderColor","cell__badge","position","top","right","borderRadius","cell__badgeEmpty","cell__badgeLabel","cell__videoDuration","bottom","textShadowColor","textShadowRadius","empty","padding","empty__text","baseShade1","textAlign","exports"],"sourceRoot":"../../../../../src","sources":["social/components/MediaSelector/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAGA,MAAME,WAAW,GAAG,CAAC;AACrB,MAAMC,QAAQ,GAAG,CAAC;AAEX,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC7B,MAAMC,KAAK,GAAG,IAAAC,0BAAQ,EAAa,CAAC;EACpC,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EACvC,MAAMC,QAAQ,GAAGC,IAAI,CAACC,KAAK,CACzB,CAACJ,KAAK,GAAGJ,QAAQ,IAAID,WAAW,GAAG,CAAC,CAAC,IAAIA,WAC3C,CAAC;EAED,MAAMU,MAAM,GAAGC,uBAAU,CAACC,MAAM,CAAC;IAC/BC,SAAS,EAAE;MACTC,IAAI,EAAE,CAAC;MACPC,eAAe,EAAEZ,KAAK,CAACa,MAAM,CAACC;IAChC,C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,OAAA,CAAA9D,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MediaViewer = MediaViewer;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeVideo = _interopRequireDefault(require("react-native-video"));
|
|
10
|
+
var _reactNativeSvg = require("react-native-svg");
|
|
11
|
+
var _xml = require("../../../core/assets/icons/xml");
|
|
12
|
+
var _styles = require("./styles");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function MediaViewer({
|
|
15
|
+
visible,
|
|
16
|
+
items,
|
|
17
|
+
initialIndex,
|
|
18
|
+
onClose
|
|
19
|
+
}) {
|
|
20
|
+
var _items$current;
|
|
21
|
+
const {
|
|
22
|
+
styles
|
|
23
|
+
} = (0, _styles.useStyles)();
|
|
24
|
+
const {
|
|
25
|
+
width
|
|
26
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
27
|
+
const listRef = (0, _react.useRef)(null);
|
|
28
|
+
const [current, setCurrent] = (0, _react.useState)(initialIndex);
|
|
29
|
+
// Mute-carry (PDT-4309 / PDT-4312): the first video plays unmuted; each swipe
|
|
30
|
+
// defaults the next video to muted — until the user unmutes, after which
|
|
31
|
+
// subsequent videos stay unmuted.
|
|
32
|
+
const [muted, setMuted] = (0, _react.useState)(false);
|
|
33
|
+
const keepUnmutedRef = (0, _react.useRef)(false);
|
|
34
|
+
(0, _react.useEffect)(() => {
|
|
35
|
+
if (!visible) return;
|
|
36
|
+
setCurrent(initialIndex);
|
|
37
|
+
setMuted(false);
|
|
38
|
+
keepUnmutedRef.current = false;
|
|
39
|
+
}, [visible, initialIndex]);
|
|
40
|
+
const onMomentumScrollEnd = (0, _react.useCallback)(e => {
|
|
41
|
+
if (!width) return;
|
|
42
|
+
const idx = Math.round(e.nativeEvent.contentOffset.x / width);
|
|
43
|
+
if (idx !== current) {
|
|
44
|
+
setCurrent(idx);
|
|
45
|
+
setMuted(!keepUnmutedRef.current);
|
|
46
|
+
}
|
|
47
|
+
}, [width, current]);
|
|
48
|
+
const toggleMute = (0, _react.useCallback)(() => {
|
|
49
|
+
setMuted(prev => {
|
|
50
|
+
const next = !prev;
|
|
51
|
+
keepUnmutedRef.current = !next; // user unmuted -> keep unmuted afterwards
|
|
52
|
+
return next;
|
|
53
|
+
});
|
|
54
|
+
}, []);
|
|
55
|
+
const renderItem = (0, _react.useCallback)(({
|
|
56
|
+
item,
|
|
57
|
+
index
|
|
58
|
+
}) => /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
59
|
+
style: [styles.page, {
|
|
60
|
+
width
|
|
61
|
+
}]
|
|
62
|
+
}, item.type === 'video' ?
|
|
63
|
+
/*#__PURE__*/
|
|
64
|
+
// pointerEvents none so horizontal swipes reach the pager instead of
|
|
65
|
+
// being captured by the native video view.
|
|
66
|
+
React.createElement(_reactNative.View, {
|
|
67
|
+
style: styles.media,
|
|
68
|
+
pointerEvents: "none"
|
|
69
|
+
}, /*#__PURE__*/React.createElement(_reactNativeVideo.default, {
|
|
70
|
+
source: item.videoType ? {
|
|
71
|
+
uri: item.uri,
|
|
72
|
+
type: item.videoType
|
|
73
|
+
} : {
|
|
74
|
+
uri: item.uri
|
|
75
|
+
},
|
|
76
|
+
style: styles.media,
|
|
77
|
+
resizeMode: "contain",
|
|
78
|
+
paused: index !== current || !visible,
|
|
79
|
+
muted: muted && index === current,
|
|
80
|
+
repeat: true,
|
|
81
|
+
playInBackground: false,
|
|
82
|
+
playWhenInactive: false
|
|
83
|
+
})) : /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
84
|
+
source: {
|
|
85
|
+
uri: item.uri
|
|
86
|
+
},
|
|
87
|
+
style: styles.media,
|
|
88
|
+
resizeMode: "contain"
|
|
89
|
+
})), [styles, width, current, muted, visible]);
|
|
90
|
+
const currentIsVideo = ((_items$current = items[current]) === null || _items$current === void 0 ? void 0 : _items$current.type) === 'video';
|
|
91
|
+
return /*#__PURE__*/React.createElement(_reactNative.Modal, {
|
|
92
|
+
visible: visible,
|
|
93
|
+
transparent: true,
|
|
94
|
+
animationType: "fade",
|
|
95
|
+
onRequestClose: () => onClose(current)
|
|
96
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
97
|
+
style: styles.container
|
|
98
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
99
|
+
style: styles.header
|
|
100
|
+
}, /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
|
|
101
|
+
style: styles.headerBtn,
|
|
102
|
+
onPress: () => onClose(current)
|
|
103
|
+
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgXml, {
|
|
104
|
+
xml: (0, _xml.clearIcon)('white'),
|
|
105
|
+
width: 28,
|
|
106
|
+
height: 28
|
|
107
|
+
})), /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
108
|
+
style: styles.counter
|
|
109
|
+
}, current + 1, "/", items.length), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
110
|
+
style: styles.headerBtn__right
|
|
111
|
+
}, currentIsVideo && /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
|
|
112
|
+
onPress: toggleMute
|
|
113
|
+
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgXml, {
|
|
114
|
+
xml: muted ? (0, _xml.soundOffIcon)('#FFFFFF') : (0, _xml.soundOnIcon)('#FFFFFF'),
|
|
115
|
+
width: 24,
|
|
116
|
+
height: 24
|
|
117
|
+
})))), /*#__PURE__*/React.createElement(_reactNative.FlatList, {
|
|
118
|
+
ref: listRef,
|
|
119
|
+
data: items,
|
|
120
|
+
horizontal: true,
|
|
121
|
+
pagingEnabled: true,
|
|
122
|
+
showsHorizontalScrollIndicator: false,
|
|
123
|
+
keyExtractor: (it, i) => `${it.uri}-${i}`,
|
|
124
|
+
renderItem: renderItem,
|
|
125
|
+
getItemLayout: (_, index) => ({
|
|
126
|
+
length: width,
|
|
127
|
+
offset: width * index,
|
|
128
|
+
index
|
|
129
|
+
}),
|
|
130
|
+
initialScrollIndex: initialIndex,
|
|
131
|
+
onMomentumScrollEnd: onMomentumScrollEnd
|
|
132
|
+
})));
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=MediaViewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_reactNativeVideo","_interopRequireDefault","_reactNativeSvg","_xml","_styles","e","__esModule","default","MediaViewer","visible","items","initialIndex","onClose","_items$current","styles","useStyles","width","useWindowDimensions","listRef","useRef","current","setCurrent","useState","muted","setMuted","keepUnmutedRef","useEffect","onMomentumScrollEnd","useCallback","idx","Math","round","nativeEvent","contentOffset","x","toggleMute","prev","next","renderItem","item","index","React","createElement","View","style","page","type","media","pointerEvents","source","videoType","uri","resizeMode","paused","repeat","playInBackground","playWhenInactive","Image","currentIsVideo","Modal","transparent","animationType","onRequestClose","container","header","TouchableOpacity","headerBtn","onPress","SvgXml","xml","clearIcon","height","Text","counter","length","headerBtn__right","soundOffIcon","soundOnIcon","FlatList","ref","data","horizontal","pagingEnabled","showsHorizontalScrollIndicator","keyExtractor","it","i","getItemLayout","_","offset","initialScrollIndex"],"sourceRoot":"../../../../../src","sources":["social/components/MediaViewer/MediaViewer.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAaA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAN,OAAA;AAAqC,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,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6D;EAAiB,GAClCjB,cAAc,iBACbjB,KAAA,CAAAC,aAAA,CAAC3C,YAAA,CAAAkE,gBAAgB;IAACE,OAAO,EAAEhC;EAAW,gBACpCM,KAAA,CAAAC,aAAA,CAACxC,eAAA,CAAAkE,MAAM;IACLC,GAAG,EAAE9C,KAAK,GAAG,IAAAqD,iBAAY,EAAC,SAAS,CAAC,GAAG,IAAAC,gBAAW,EAAC,SAAS,CAAE;IAC9D7D,KAAK,EAAE,EAAG;IACVuD,MAAM,EAAE;EAAG,CACZ,CACe,CAEhB,CACF,CAAC,eACP9B,KAAA,CAAAC,aAAA,CAAC3C,YAAA,CAAA+E,QAAQ;IACPC,GAAG,EAAE7D,OAAQ;IACb8D,IAAI,EAAEtE,KAAM;IACZuE,UAAU;IACVC,aAAa;IACbC,8BAA8B,EAAE,KAAM;IACtCC,YAAY,EAAEA,CAACC,EAAE,EAAEC,CAAC,KAAK,GAAGD,EAAE,CAAClC,GAAG,IAAImC,CAAC,EAAG;IAC1ChD,UAAU,EAAEA,UAAW;IACvBiD,aAAa,EAAEA,CAACC,CAAC,EAAEhD,KAAK,MAAM;MAC5BkC,MAAM,EAAE1D,KAAK;MACbyE,MAAM,EAAEzE,KAAK,GAAGwB,KAAK;MACrBA;IACF,CAAC,CAAE;IACHkD,kBAAkB,EAAE/E,YAAa;IACjCgB,mBAAmB,EAAEA;EAAoB,CAC1C,CACG,CACD,CAAC;AAEZ","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "MediaViewer", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _MediaViewer.MediaViewer;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _MediaViewer = require("./MediaViewer");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_MediaViewer","require"],"sourceRoot":"../../../../../src","sources":["social/components/MediaViewer/index.tsx"],"mappings":";;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStyles = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _reactNativePaper = require("react-native-paper");
|
|
9
|
+
const useStyles = () => {
|
|
10
|
+
const theme = (0, _reactNativePaper.useTheme)();
|
|
11
|
+
const styles = _reactNative.StyleSheet.create({
|
|
12
|
+
container: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
backgroundColor: '#000000'
|
|
15
|
+
},
|
|
16
|
+
header: {
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
paddingHorizontal: 16,
|
|
21
|
+
height: 56,
|
|
22
|
+
zIndex: 2
|
|
23
|
+
},
|
|
24
|
+
headerBtn: {
|
|
25
|
+
minWidth: 44,
|
|
26
|
+
height: 44,
|
|
27
|
+
alignItems: 'flex-start',
|
|
28
|
+
justifyContent: 'center'
|
|
29
|
+
},
|
|
30
|
+
headerBtn__right: {
|
|
31
|
+
minWidth: 44,
|
|
32
|
+
height: 44,
|
|
33
|
+
alignItems: 'flex-end',
|
|
34
|
+
justifyContent: 'center'
|
|
35
|
+
},
|
|
36
|
+
counter: {
|
|
37
|
+
color: '#FFFFFF',
|
|
38
|
+
fontSize: 14,
|
|
39
|
+
fontWeight: '600'
|
|
40
|
+
},
|
|
41
|
+
muteGlyph: {
|
|
42
|
+
fontSize: 20
|
|
43
|
+
},
|
|
44
|
+
page: {
|
|
45
|
+
flex: 1,
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
justifyContent: 'center'
|
|
48
|
+
},
|
|
49
|
+
media: {
|
|
50
|
+
width: '100%',
|
|
51
|
+
height: '100%'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
styles,
|
|
56
|
+
theme
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.useStyles = useStyles;
|
|
60
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativePaper","useStyles","theme","useTheme","styles","StyleSheet","create","container","flex","backgroundColor","header","flexDirection","alignItems","justifyContent","paddingHorizontal","height","zIndex","headerBtn","minWidth","headerBtn__right","counter","color","fontSize","fontWeight","muteGlyph","page","media","width","exports"],"sourceRoot":"../../../../../src","sources":["social/components/MediaViewer/styles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAGO,MAAME,SAAS,GAAGA,CAAA,KAAM;EAC7B,MAAMC,KAAK,GAAG,IAAAC,0BAAQ,EAAa,CAAC;EAEpC,MAAMC,MAAM,GAAGC,uBAAU,CAACC,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,EAAE;MACPC,KAAK,EAAE,SAAS;MAChBC,QAAQ,EAAE,EAAE;MACZC,UAAU,EAAE;IACd,CAAC;IACDC,SAAS,EAAE;MACTF,QAAQ,EAAE;IACZ,CAAC;IACDG,IAAI,EAAE;MACJjB,IAAI,EAAE,CAAC;MACPI,UAAU,EAAE,QAAQ;MACpBC,cAAc,EAAE;IAClB,CAAC;IACDa,KAAK,EAAE;MACLC,KAAK,EAAE,MAAM;MACbZ,MAAM,EAAE;IACV;EACF,CAAC,CAAC;EAEF,OAAO;IAAEX,MAAM;IAAEF;EAAM,CAAC;AAC1B,CAAC;AAAC0B,OAAA,CAAA3B,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -6,17 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeSvg = require("react-native-svg");
|
|
10
9
|
var _styles = require("./styles");
|
|
11
10
|
var _useAuth = _interopRequireDefault(require("../../../core/hooks/useAuth"));
|
|
12
11
|
var _feed = require("../../../core/legacy/feed");
|
|
13
12
|
var _dist = _interopRequireDefault(require("../legacy/react-native-image-viewing/dist"));
|
|
14
|
-
var
|
|
13
|
+
var _reactNativeSvg = require("react-native-svg");
|
|
15
14
|
var _xml = require("../../../core/assets/icons/xml");
|
|
15
|
+
var _store = require("../../../core/stores/store");
|
|
16
|
+
var _PostMediaElement = require("../../elements/PostMediaElement");
|
|
16
17
|
var _LivestreamContent = _interopRequireDefault(require("../LivestreamContent"));
|
|
17
18
|
var _PreviewLink = require("../PreviewLink");
|
|
18
19
|
var _RenderTextWithMention = _interopRequireDefault(require("../RenderTextWithMention/RenderTextWithMention"));
|
|
19
20
|
var _PollContent = _interopRequireDefault(require("../PollContent"));
|
|
21
|
+
var _MediaViewer = require("../MediaViewer");
|
|
20
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
23
|
const PostContent = ({
|
|
22
24
|
post,
|
|
@@ -38,9 +40,12 @@ const PostContent = ({
|
|
|
38
40
|
const [videoPostsFullSize, setVideoPostsFullSize] = (0, _react.useState)([]);
|
|
39
41
|
const [visibleFullImage, setIsVisibleFullImage] = (0, _react.useState)(false);
|
|
40
42
|
const [imageIndex, setImageIndex] = (0, _react.useState)(0);
|
|
43
|
+
const [videoViewerIndex, setVideoViewerIndex] = (0, _react.useState)(null);
|
|
44
|
+
const [mediaLoading, setMediaLoading] = (0, _react.useState)(((childrenPosts === null || childrenPosts === void 0 ? void 0 : childrenPosts.length) ?? 0) > 0);
|
|
45
|
+
const [mediaChildPosts, setMediaChildPosts] = (0, _react.useState)([]);
|
|
46
|
+
const mediaControlsRef = (0, _react.useRef)(null);
|
|
47
|
+
const viewerIndexRef = (0, _react.useRef)(0);
|
|
41
48
|
const styles = (0, _styles.useStyles)();
|
|
42
|
-
let imageStyle = styles.imageLargePost;
|
|
43
|
-
let colStyle = styles.col2;
|
|
44
49
|
const {
|
|
45
50
|
currentPostdetail
|
|
46
51
|
} = (0, _store.useUIKitSelector)(state => state.postDetail);
|
|
@@ -71,12 +76,14 @@ const PostContent = ({
|
|
|
71
76
|
}
|
|
72
77
|
}, [imagePosts, videoPosts, apiRegion]);
|
|
73
78
|
const getPostInfo = (0, _react.useCallback)(async () => {
|
|
79
|
+
setMediaLoading(((childrenPosts === null || childrenPosts === void 0 ? void 0 : childrenPosts.length) ?? 0) > 0);
|
|
74
80
|
try {
|
|
75
81
|
const response = await Promise.all(childrenPosts.map(async id => {
|
|
76
82
|
const {
|
|
77
83
|
data: childrenPost
|
|
78
84
|
} = await (0, _feed.getPostById)(id);
|
|
79
85
|
return {
|
|
86
|
+
post: childrenPost,
|
|
80
87
|
dataType: childrenPost === null || childrenPost === void 0 ? void 0 : childrenPost.dataType,
|
|
81
88
|
data: childrenPost === null || childrenPost === void 0 ? void 0 : childrenPost.data
|
|
82
89
|
};
|
|
@@ -85,17 +92,20 @@ const PostContent = ({
|
|
|
85
92
|
const videos = [];
|
|
86
93
|
const polls = [];
|
|
87
94
|
const livestreams = [];
|
|
95
|
+
const media = [];
|
|
88
96
|
response.forEach(item => {
|
|
89
97
|
var _item$data, _item$data2;
|
|
90
98
|
if ((item === null || item === void 0 ? void 0 : item.dataType) === 'image' && item !== null && item !== void 0 && (_item$data = item.data) !== null && _item$data !== void 0 && _item$data.fileId) {
|
|
91
99
|
const url = `https://api.${apiRegion}.amity.co/api/v3/files/${item === null || item === void 0 ? void 0 : item.data.fileId}/download?size=medium`;
|
|
92
100
|
if (!images.includes(url)) {
|
|
93
101
|
images.push(url);
|
|
102
|
+
if (item.post) media.push(item.post);
|
|
94
103
|
}
|
|
95
104
|
} else if ((item === null || item === void 0 ? void 0 : item.dataType) === 'video' && item !== null && item !== void 0 && (_item$data2 = item.data) !== null && _item$data2 !== void 0 && _item$data2.videoFileId.original) {
|
|
96
105
|
const isExisted = videos.some(video => video.videoFileId.original === item.data.videoFileId.original);
|
|
97
106
|
if (!isExisted) {
|
|
98
107
|
videos.push(item.data);
|
|
108
|
+
if (item.post) media.push(item.post);
|
|
99
109
|
}
|
|
100
110
|
} else if ((item === null || item === void 0 ? void 0 : item.dataType) === 'poll') {
|
|
101
111
|
if (!polls.some(poll => poll.pollId === item.data.pollId)) {
|
|
@@ -107,12 +117,12 @@ const PostContent = ({
|
|
|
107
117
|
}
|
|
108
118
|
}
|
|
109
119
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
|
|
121
|
+
// Set unconditionally so navigating to a post without media clears the
|
|
122
|
+
// previous media (see the effect below which no longer eagerly resets).
|
|
123
|
+
setMediaChildPosts(media);
|
|
124
|
+
setImagePosts(images);
|
|
125
|
+
setVideoPosts(videos);
|
|
116
126
|
if (polls.length > 0) {
|
|
117
127
|
setPollIds(polls);
|
|
118
128
|
}
|
|
@@ -121,121 +131,50 @@ const PostContent = ({
|
|
|
121
131
|
}
|
|
122
132
|
} catch (error) {
|
|
123
133
|
console.log('error: ', error);
|
|
134
|
+
} finally {
|
|
135
|
+
setMediaLoading(false);
|
|
124
136
|
}
|
|
125
137
|
}, [apiRegion, childrenPosts]);
|
|
126
138
|
(0, _react.useEffect)(() => {
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
// Don't clear media here: getPostInfo resolves images/videos/media to their
|
|
140
|
+
// fresh values, so the existing media stays on screen until the new data
|
|
141
|
+
// arrives. Eagerly resetting caused a blank flash whenever the feed
|
|
142
|
+
// re-rendered (e.g. realtime updates), then the content popped back in.
|
|
129
143
|
getPostInfo();
|
|
130
144
|
}, [childrenPosts, currentPostdetail, postList, postListGlobal, getPostInfo]);
|
|
131
145
|
function onClickImage(index) {
|
|
146
|
+
viewerIndexRef.current = index;
|
|
132
147
|
setIsVisibleFullImage(true);
|
|
133
148
|
setImageIndex(index);
|
|
134
149
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const mediaPosts = [...imagePosts].length > 0 ? [...imagePosts] : [...thumbnailFileIds];
|
|
140
|
-
const imageElement = mediaPosts.map((item, index) => {
|
|
141
|
-
if (mediaPosts.length === 1) {
|
|
142
|
-
imageStyle = styles.imageLargePost;
|
|
143
|
-
colStyle = styles.col6;
|
|
144
|
-
} else if (mediaPosts.length === 2) {
|
|
145
|
-
colStyle = styles.col3;
|
|
146
|
-
if (index === 0) {
|
|
147
|
-
imageStyle = [styles.imageLargePost, styles.imageMarginRight];
|
|
148
|
-
} else {
|
|
149
|
-
imageStyle = [styles.imageLargePost, styles.imageMarginLeft];
|
|
150
|
-
}
|
|
151
|
-
} else if (mediaPosts.length === 3) {
|
|
152
|
-
switch (index) {
|
|
153
|
-
case 0:
|
|
154
|
-
colStyle = styles.col6;
|
|
155
|
-
imageStyle = [styles.imageMediumPost, styles.imageMarginBottom];
|
|
156
|
-
break;
|
|
157
|
-
case 1:
|
|
158
|
-
colStyle = styles.col3;
|
|
159
|
-
imageStyle = [styles.imageMediumPost, styles.imageMarginTop, styles.imageMarginRight];
|
|
160
|
-
break;
|
|
161
|
-
case 2:
|
|
162
|
-
colStyle = styles.col3;
|
|
163
|
-
imageStyle = [styles.imageMediumPost, styles.imageMarginTop, styles.imageMarginLeft];
|
|
164
|
-
break;
|
|
165
|
-
default:
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
} else {
|
|
169
|
-
switch (index) {
|
|
170
|
-
case 0:
|
|
171
|
-
colStyle = styles.col6;
|
|
172
|
-
imageStyle = [styles.imageMediumLargePost, styles.imageMarginBottom];
|
|
173
|
-
break;
|
|
174
|
-
case 1:
|
|
175
|
-
colStyle = styles.col2;
|
|
176
|
-
imageStyle = [styles.imageSmallPost, styles.imageMarginTop, styles.imageMarginRight];
|
|
177
|
-
break;
|
|
178
|
-
case 2:
|
|
179
|
-
colStyle = styles.col2;
|
|
180
|
-
imageStyle = [styles.imageSmallPost, styles.imageMarginTop, styles.imageMarginLeft, styles.imageMarginRight];
|
|
181
|
-
break;
|
|
182
|
-
case 3:
|
|
183
|
-
colStyle = styles.col2;
|
|
184
|
-
imageStyle = [styles.imageSmallPost, styles.imageMarginTop, styles.imageMarginLeft];
|
|
185
|
-
break;
|
|
186
|
-
default:
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
191
|
-
style: colStyle,
|
|
192
|
-
key: item
|
|
193
|
-
}, /*#__PURE__*/React.createElement(_reactNative.TouchableWithoutFeedback, {
|
|
194
|
-
onPress: () => onClickImage(index)
|
|
195
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, null, videoPosts.length > 0 && renderPlayButton(), /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
196
|
-
style: imageStyle,
|
|
197
|
-
source: {
|
|
198
|
-
uri: item
|
|
199
|
-
}
|
|
200
|
-
}), index === 3 && imagePosts.length > 4 && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
201
|
-
style: styles.overlay
|
|
202
|
-
}, /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
203
|
-
style: styles.overlayText
|
|
204
|
-
}, `+ ${imagePosts.length - 3}`)))));
|
|
205
|
-
});
|
|
206
|
-
if (imageElement.length < 3) {
|
|
207
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
208
|
-
style: styles.imagesWrap
|
|
209
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
210
|
-
style: styles.row
|
|
211
|
-
}, imageElement));
|
|
212
|
-
} else if (imageElement.length === 3) {
|
|
213
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
214
|
-
style: [styles.imagesWrap]
|
|
215
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
216
|
-
style: styles.row
|
|
217
|
-
}, imageElement.slice(0, 1)), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
218
|
-
style: styles.row
|
|
219
|
-
}, imageElement.slice(1, 3)));
|
|
220
|
-
} else {
|
|
221
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
222
|
-
style: styles.imagesWrap
|
|
223
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
224
|
-
style: styles.row
|
|
225
|
-
}, imageElement.slice(0, 1)), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
226
|
-
style: styles.row
|
|
227
|
-
}, imageElement.slice(1, 4)));
|
|
228
|
-
}
|
|
150
|
+
function closeFullScreen() {
|
|
151
|
+
var _mediaControlsRef$cur;
|
|
152
|
+
setIsVisibleFullImage(false);
|
|
153
|
+
(_mediaControlsRef$cur = mediaControlsRef.current) === null || _mediaControlsRef$cur === void 0 || _mediaControlsRef$cur.slideTo(viewerIndexRef.current);
|
|
229
154
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
155
|
+
|
|
156
|
+
// UC2 (PDT-4309): video carousel opens the swipeable full-screen player
|
|
157
|
+
// (autoplay + mute-carry) instead of the single-video route.
|
|
158
|
+
function openVideoViewer(index) {
|
|
159
|
+
viewerIndexRef.current = index;
|
|
160
|
+
setVideoViewerIndex(index);
|
|
161
|
+
}
|
|
162
|
+
function closeVideoViewer(lastIndex) {
|
|
163
|
+
var _mediaControlsRef$cur2;
|
|
164
|
+
setVideoViewerIndex(null);
|
|
165
|
+
// Published post: return to the last-viewed frame.
|
|
166
|
+
(_mediaControlsRef$cur2 = mediaControlsRef.current) === null || _mediaControlsRef$cur2 === void 0 || _mediaControlsRef$cur2.slideTo(lastIndex);
|
|
238
167
|
}
|
|
168
|
+
const videoViewerItems = videoPosts.map(item => {
|
|
169
|
+
var _item$videoFileId;
|
|
170
|
+
return {
|
|
171
|
+
type: 'video',
|
|
172
|
+
// The /files/{original}/download endpoint returns the original video
|
|
173
|
+
// file (mp4), not an HLS playlist — no m3u8 type hint (let the player
|
|
174
|
+
// detect the container).
|
|
175
|
+
uri: `https://api.${apiRegion}.amity.co/api/v3/files/${item === null || item === void 0 || (_item$videoFileId = item.videoFileId) === null || _item$videoFileId === void 0 ? void 0 : _item$videoFileId.original}/download`
|
|
176
|
+
};
|
|
177
|
+
});
|
|
239
178
|
function renderImageHeader({
|
|
240
179
|
imageIndex: imgIndex
|
|
241
180
|
}) {
|
|
@@ -245,10 +184,12 @@ const PostContent = ({
|
|
|
245
184
|
style: styles.flexWidth
|
|
246
185
|
}, /*#__PURE__*/React.createElement(_reactNative.TouchableOpacity, {
|
|
247
186
|
style: styles.closebtnIcon,
|
|
248
|
-
onPress:
|
|
249
|
-
}, /*#__PURE__*/React.createElement(
|
|
250
|
-
|
|
251
|
-
|
|
187
|
+
onPress: closeFullScreen
|
|
188
|
+
}, /*#__PURE__*/React.createElement(_reactNativeSvg.SvgXml, {
|
|
189
|
+
xml: (0, _xml.clearIcon)('white'),
|
|
190
|
+
width: 28,
|
|
191
|
+
height: 28
|
|
192
|
+
}))), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
252
193
|
style: styles.flexWidth
|
|
253
194
|
}, /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
254
195
|
style: styles.header
|
|
@@ -273,14 +214,28 @@ const PostContent = ({
|
|
|
273
214
|
post: post,
|
|
274
215
|
onPressPost: onPressPost,
|
|
275
216
|
roomId: livestreamId[0]
|
|
276
|
-
}) :
|
|
217
|
+
}) : /*#__PURE__*/React.createElement(_PostMediaElement.PostMediaElement, {
|
|
218
|
+
posts: mediaChildPosts,
|
|
219
|
+
onImageClick: onClickImage,
|
|
220
|
+
onVideoClick: openVideoViewer,
|
|
221
|
+
controlsRef: mediaControlsRef,
|
|
222
|
+
loading: mediaLoading
|
|
223
|
+
}), /*#__PURE__*/React.createElement(_dist.default, {
|
|
277
224
|
images: imagePostsFullSize.length > 0 ? imagePostsFullSize : videoPostsFullSize,
|
|
278
225
|
imageIndex: imageIndex,
|
|
279
226
|
visible: visibleFullImage,
|
|
280
|
-
onRequestClose:
|
|
227
|
+
onRequestClose: closeFullScreen,
|
|
228
|
+
onImageIndexChange: idx => {
|
|
229
|
+
viewerIndexRef.current = idx;
|
|
230
|
+
},
|
|
281
231
|
isVideoButton: videoPosts.length > 0 ? true : false,
|
|
282
232
|
videoPosts: videoPosts,
|
|
283
233
|
HeaderComponent: renderImageHeader
|
|
234
|
+
}), /*#__PURE__*/React.createElement(_MediaViewer.MediaViewer, {
|
|
235
|
+
visible: videoViewerIndex !== null,
|
|
236
|
+
items: videoViewerItems,
|
|
237
|
+
initialIndex: videoViewerIndex ?? 0,
|
|
238
|
+
onClose: closeVideoViewer
|
|
284
239
|
}));
|
|
285
240
|
};
|
|
286
241
|
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(PostContent);
|