@zezosoft/zezo-ott-react-native-ui-kit 1.1.2 → 1.1.3
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/module/components/Auth/QrLogin/QrLogin.js +304 -138
- package/lib/module/components/Auth/QrLogin/QrLogin.js.map +1 -1
- package/lib/module/components/Auth/QrLogin/components/QrViewArea.js +193 -141
- package/lib/module/components/Auth/QrLogin/components/QrViewArea.js.map +1 -1
- package/lib/module/components/Content/Card/Category/Category.js +83 -11
- package/lib/module/components/Content/Card/Category/Category.js.map +1 -1
- package/lib/module/components/Content/Card/NowWatching/NowWatching.js +237 -108
- package/lib/module/components/Content/Card/NowWatching/NowWatching.js.map +1 -1
- package/lib/module/components/Content/Card/Sliders/Styles/One.js +185 -126
- package/lib/module/components/Content/Card/Sliders/Styles/One.js.map +1 -1
- package/lib/module/components/Content/Card/Sliders/Styles/Two.js +139 -92
- package/lib/module/components/Content/Card/Sliders/Styles/Two.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Five.js +131 -48
- package/lib/module/components/Content/Card/Styles/Five.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Four.js +126 -59
- package/lib/module/components/Content/Card/Styles/Four.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/One.js +125 -50
- package/lib/module/components/Content/Card/Styles/One.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/RotateInOut.js +138 -53
- package/lib/module/components/Content/Card/Styles/RotateInOut.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Six.js +207 -115
- package/lib/module/components/Content/Card/Styles/Six.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Three.js +134 -79
- package/lib/module/components/Content/Card/Styles/Three.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/TopTen.js +186 -171
- package/lib/module/components/Content/Card/Styles/TopTen.js.map +1 -1
- package/lib/module/components/Content/Card/Styles/Two.js +144 -64
- package/lib/module/components/Content/Card/Styles/Two.js.map +1 -1
- package/lib/module/components/Content/Card/components/AdsPoster.js +162 -0
- package/lib/module/components/Content/Card/components/AdsPoster.js.map +1 -0
- package/lib/module/components/Content/Card/components/CardPoster.js +120 -136
- package/lib/module/components/Content/Card/components/CardPoster.js.map +1 -1
- package/lib/module/components/Content/Card/components/index.js +4 -0
- package/lib/module/components/Content/Card/components/index.js.map +1 -0
- package/lib/module/components/Content/Content.js +67 -27
- package/lib/module/components/Content/Content.js.map +1 -1
- package/lib/module/components/Content/Sections.js +32 -11
- package/lib/module/components/Content/Sections.js.map +1 -1
- package/lib/module/constants/dummySections.js +44 -4
- package/lib/module/constants/dummySections.js.map +1 -1
- package/lib/module/hooks/Images/index.js +5 -0
- package/lib/module/hooks/Images/index.js.map +1 -0
- package/lib/module/hooks/Images/useImageLoader.js +168 -0
- package/lib/module/hooks/Images/useImageLoader.js.map +1 -0
- package/lib/module/hooks/Images/useImageValidation.js +36 -0
- package/lib/module/hooks/Images/useImageValidation.js.map +1 -0
- package/lib/module/hooks/index.js +3 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useAdTracking.js +270 -0
- package/lib/module/hooks/useAdTracking.js.map +1 -0
- package/lib/module/hooks/useCards.js +164 -0
- package/lib/module/hooks/useCards.js.map +1 -0
- package/lib/module/hooks/usePaginatedSection.js +11 -6
- package/lib/module/hooks/usePaginatedSection.js.map +1 -1
- package/lib/typescript/src/components/Auth/QrLogin/QrLogin.d.ts +2 -0
- package/lib/typescript/src/components/Auth/QrLogin/QrLogin.d.ts.map +1 -1
- package/lib/typescript/src/components/Auth/QrLogin/components/QrViewArea.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Category/Category.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/NowWatching/NowWatching.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Sliders/Styles/One.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Sliders/Styles/Two.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Five.d.ts +13 -1
- package/lib/typescript/src/components/Content/Card/Styles/Five.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Four.d.ts +13 -1
- package/lib/typescript/src/components/Content/Card/Styles/Four.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/One.d.ts +15 -3
- package/lib/typescript/src/components/Content/Card/Styles/One.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/RotateInOut.d.ts +13 -1
- package/lib/typescript/src/components/Content/Card/Styles/RotateInOut.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Six.d.ts +1 -0
- package/lib/typescript/src/components/Content/Card/Styles/Six.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Three.d.ts +13 -5
- package/lib/typescript/src/components/Content/Card/Styles/Three.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/TopTen.d.ts +1 -0
- package/lib/typescript/src/components/Content/Card/Styles/TopTen.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/Styles/Two.d.ts +13 -1
- package/lib/typescript/src/components/Content/Card/Styles/Two.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/components/AdsPoster.d.ts +26 -0
- package/lib/typescript/src/components/Content/Card/components/AdsPoster.d.ts.map +1 -0
- package/lib/typescript/src/components/Content/Card/components/CardPoster.d.ts +3 -1
- package/lib/typescript/src/components/Content/Card/components/CardPoster.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Card/components/index.d.ts +2 -0
- package/lib/typescript/src/components/Content/Card/components/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Content/Card/index.d.ts +76 -6
- package/lib/typescript/src/components/Content/Card/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Content.d.ts +4 -3
- package/lib/typescript/src/components/Content/Content.d.ts.map +1 -1
- package/lib/typescript/src/components/Content/Sections.d.ts +20 -6
- package/lib/typescript/src/components/Content/Sections.d.ts.map +1 -1
- package/lib/typescript/src/constants/dummySections.d.ts +5 -0
- package/lib/typescript/src/constants/dummySections.d.ts.map +1 -1
- package/lib/typescript/src/hooks/Images/index.d.ts +3 -0
- package/lib/typescript/src/hooks/Images/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/Images/useImageLoader.d.ts +36 -0
- package/lib/typescript/src/hooks/Images/useImageLoader.d.ts.map +1 -0
- package/lib/typescript/src/hooks/Images/useImageValidation.d.ts +17 -0
- package/lib/typescript/src/hooks/Images/useImageValidation.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +3 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useAdTracking.d.ts +39 -0
- package/lib/typescript/src/hooks/useAdTracking.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCards.d.ts +36 -0
- package/lib/typescript/src/hooks/useCards.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePaginatedSection.d.ts +12 -2
- package/lib/typescript/src/hooks/usePaginatedSection.d.ts.map +1 -1
- package/lib/typescript/src/types/sections/index.d.ts +7 -4
- package/lib/typescript/src/types/sections/index.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/components/Auth/QrLogin/QrLogin.tsx +382 -122
- package/src/components/Auth/QrLogin/components/QrViewArea.tsx +291 -197
- package/src/components/Content/Card/Category/Category.tsx +95 -8
- package/src/components/Content/Card/NowWatching/NowWatching.tsx +281 -136
- package/src/components/Content/Card/Sliders/Styles/One.tsx +244 -148
- package/src/components/Content/Card/Sliders/Styles/Two.tsx +171 -102
- package/src/components/Content/Card/Styles/Five.tsx +161 -62
- package/src/components/Content/Card/Styles/Four.tsx +164 -85
- package/src/components/Content/Card/Styles/One.tsx +161 -71
- package/src/components/Content/Card/Styles/RotateInOut.tsx +157 -60
- package/src/components/Content/Card/Styles/Six.tsx +242 -142
- package/src/components/Content/Card/Styles/Three.tsx +166 -133
- package/src/components/Content/Card/Styles/TopTen.tsx +230 -191
- package/src/components/Content/Card/Styles/Two.tsx +182 -79
- package/src/components/Content/Card/components/AdsPoster.tsx +202 -0
- package/src/components/Content/Card/components/CardPoster.tsx +134 -154
- package/src/components/Content/Card/components/index.ts +1 -0
- package/src/components/Content/Content.tsx +83 -45
- package/src/components/Content/Sections.tsx +51 -10
- package/src/constants/dummySections.ts +48 -1
- package/src/hooks/Images/index.ts +2 -0
- package/src/hooks/Images/useImageLoader.ts +206 -0
- package/src/hooks/Images/useImageValidation.ts +36 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useAdTracking.ts +349 -0
- package/src/hooks/useCards.ts +228 -0
- package/src/hooks/usePaginatedSection.ts +26 -7
- package/src/types/sections/index.ts +7 -4
|
@@ -13,33 +13,52 @@ import {
|
|
|
13
13
|
Dimensions,
|
|
14
14
|
TouchableOpacity,
|
|
15
15
|
} from 'react-native';
|
|
16
|
+
|
|
16
17
|
import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
|
|
17
18
|
import FastImage from 'react-native-fast-image';
|
|
18
19
|
import Carousel from 'react-native-snap-carousel';
|
|
19
20
|
import { moderateScale, verticalScale } from 'react-native-size-matters';
|
|
20
21
|
import { debounce } from 'lodash';
|
|
21
|
-
|
|
22
|
-
import { usePaginatedSection } from '../../../../hooks/usePaginatedSection';
|
|
22
|
+
import { RFValue } from 'react-native-responsive-fontsize';
|
|
23
23
|
|
|
24
24
|
import { useInternalTheme } from '../../../../theme/hook/useInternalTheme';
|
|
25
|
+
|
|
25
26
|
import CardPoster from '../components/CardPoster';
|
|
26
27
|
import NavigateToMore from '../components/NavigateToMore';
|
|
28
|
+
import { AdsPoster } from '../components';
|
|
29
|
+
|
|
27
30
|
import type {
|
|
31
|
+
IAdItem,
|
|
28
32
|
IGetSectionData,
|
|
29
33
|
ISectionContent,
|
|
30
34
|
MoreFetchData,
|
|
31
35
|
} from '../../../../types';
|
|
32
36
|
import type { ThemeOverride } from '../../../../theme/themes';
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
37
|
+
import type { IContentData, IServeAd } from '@zezosoft/zezo-ott-api-client';
|
|
38
|
+
import { useCards } from '../../../../hooks';
|
|
35
39
|
|
|
40
|
+
// Constants
|
|
36
41
|
const { width, height } = Dimensions.get('window');
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
42
|
+
const ITEM_WIDTH_RATIO = 0.42;
|
|
43
|
+
const ITEM_HEIGHT_RATIO = 0.28;
|
|
44
|
+
const DEFAULT_ITEM_WIDTH = width * ITEM_WIDTH_RATIO;
|
|
45
|
+
const DEFAULT_ITEM_HEIGHT = height * ITEM_HEIGHT_RATIO;
|
|
40
46
|
const DEFAULT_BORDER_RADIUS = moderateScale(10);
|
|
47
|
+
const DEFAULT_SKELETON_COUNT = 5;
|
|
48
|
+
const DEBOUNCE_DELAY = 300;
|
|
49
|
+
const ITEM_ACTIVE_OPACITY = 0.8;
|
|
50
|
+
const CAROUSEL_FIRST_ITEM = 1;
|
|
51
|
+
const CAROUSEL_INACTIVE_OPACITY = 0.6;
|
|
52
|
+
const CAROUSEL_INACTIVE_SCALE = 0.9;
|
|
53
|
+
const PAGINATION_TRIGGER_OFFSET = 2;
|
|
54
|
+
const SKELETON_TITLE_WIDTH = moderateScale(100);
|
|
55
|
+
const SKELETON_TITLE_HEIGHT = verticalScale(14);
|
|
56
|
+
const SKELETON_TITLE_BORDER_RADIUS = moderateScale(4);
|
|
57
|
+
const SKELETON_TITLE_MARGIN_LEFT = moderateScale(12);
|
|
58
|
+
const SKELETON_TITLE_MARGIN_BOTTOM = verticalScale(6);
|
|
59
|
+
const SKELETON_ITEM_MARGIN_RIGHT = moderateScale(12);
|
|
41
60
|
|
|
42
|
-
// Static
|
|
61
|
+
// Static Styles
|
|
43
62
|
const staticStyles = StyleSheet.create({
|
|
44
63
|
root: {
|
|
45
64
|
marginVertical: verticalScale(6),
|
|
@@ -56,6 +75,7 @@ const staticStyles = StyleSheet.create({
|
|
|
56
75
|
},
|
|
57
76
|
});
|
|
58
77
|
|
|
78
|
+
// Types
|
|
59
79
|
type Props = {
|
|
60
80
|
title: string;
|
|
61
81
|
section_id: string;
|
|
@@ -68,45 +88,56 @@ type Props = {
|
|
|
68
88
|
name: IGetSectionData['name'];
|
|
69
89
|
type: IGetSectionData['type'];
|
|
70
90
|
}) => void;
|
|
71
|
-
renderItemImage?: (params: {
|
|
72
|
-
item: IContentData;
|
|
73
|
-
index: number;
|
|
74
|
-
}) => React.ReactNode;
|
|
75
91
|
itemWidth?: number;
|
|
76
92
|
itemHeight?: number;
|
|
77
93
|
borderRadius?: number;
|
|
78
94
|
skeletonCount?: number;
|
|
79
95
|
containerStyle?: StyleProp<ViewStyle>;
|
|
80
96
|
titleStyle?: StyleProp<TextStyle>;
|
|
97
|
+
paginationSkeletonCount?: number;
|
|
81
98
|
itemStyle?: StyleProp<ViewStyle>;
|
|
82
99
|
isLoading?: boolean;
|
|
83
100
|
theme?: ThemeOverride;
|
|
101
|
+
onDisplayAds?: (ad: IServeAd) => void;
|
|
102
|
+
screenDimensions?: { width: number; height: number };
|
|
103
|
+
viewportOffsets?: {
|
|
104
|
+
top: number;
|
|
105
|
+
bottom: number;
|
|
106
|
+
left: number;
|
|
107
|
+
right: number;
|
|
108
|
+
};
|
|
84
109
|
};
|
|
85
110
|
|
|
111
|
+
// Main Component
|
|
86
112
|
const MovieCardThree: React.FC<Props> = ({
|
|
87
113
|
title,
|
|
88
114
|
section_id,
|
|
89
115
|
type,
|
|
90
|
-
data:
|
|
116
|
+
data: externalData,
|
|
91
117
|
moreFetchData,
|
|
92
118
|
onPressMore,
|
|
93
119
|
onPressItem,
|
|
94
|
-
renderItemImage,
|
|
95
120
|
itemWidth = DEFAULT_ITEM_WIDTH,
|
|
96
121
|
itemHeight = DEFAULT_ITEM_HEIGHT,
|
|
97
122
|
borderRadius = DEFAULT_BORDER_RADIUS,
|
|
98
|
-
skeletonCount =
|
|
123
|
+
skeletonCount = DEFAULT_SKELETON_COUNT,
|
|
124
|
+
paginationSkeletonCount,
|
|
99
125
|
containerStyle,
|
|
100
126
|
titleStyle,
|
|
101
127
|
itemStyle,
|
|
102
128
|
isLoading = false,
|
|
103
129
|
theme,
|
|
130
|
+
onDisplayAds,
|
|
131
|
+
screenDimensions,
|
|
132
|
+
viewportOffsets,
|
|
104
133
|
}) => {
|
|
105
|
-
|
|
134
|
+
// Refs
|
|
135
|
+
const carouselRef = useRef<Carousel<IContentData | IAdItem> | null>(null);
|
|
106
136
|
|
|
107
|
-
|
|
137
|
+
// Theme
|
|
138
|
+
const { theme: appliedTheme } = useInternalTheme(theme);
|
|
108
139
|
|
|
109
|
-
//
|
|
140
|
+
// Styles
|
|
110
141
|
const styles = useMemo(
|
|
111
142
|
() =>
|
|
112
143
|
StyleSheet.create({
|
|
@@ -115,167 +146,175 @@ const MovieCardThree: React.FC<Props> = ({
|
|
|
115
146
|
height: itemHeight,
|
|
116
147
|
borderRadius,
|
|
117
148
|
overflow: 'hidden',
|
|
118
|
-
elevation: 0,
|
|
119
|
-
shadowColor: 'transparent',
|
|
120
|
-
shadowOffset: { width: 0, height: 0 },
|
|
121
|
-
shadowOpacity: 0,
|
|
122
|
-
shadowRadius: 0,
|
|
123
149
|
},
|
|
124
150
|
image: {
|
|
125
151
|
width: '100%',
|
|
126
152
|
height: '100%',
|
|
127
|
-
backgroundColor: appliedTheme.colors.
|
|
153
|
+
backgroundColor: appliedTheme.colors.surfaceVariant,
|
|
128
154
|
},
|
|
129
155
|
skeleton: {
|
|
130
156
|
width: itemWidth,
|
|
131
157
|
height: itemHeight,
|
|
132
158
|
borderRadius,
|
|
159
|
+
marginRight: SKELETON_ITEM_MARGIN_RIGHT,
|
|
133
160
|
overflow: 'hidden',
|
|
134
|
-
marginRight: moderateScale(12),
|
|
135
161
|
},
|
|
136
162
|
}),
|
|
137
|
-
[appliedTheme
|
|
163
|
+
[appliedTheme, itemWidth, itemHeight, borderRadius]
|
|
138
164
|
);
|
|
139
165
|
|
|
166
|
+
// Data Management
|
|
140
167
|
const {
|
|
141
|
-
|
|
142
|
-
loading: isPaginating,
|
|
168
|
+
listData,
|
|
143
169
|
pagination,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
170
|
+
loadMore,
|
|
171
|
+
isEmpty,
|
|
172
|
+
isPaging: isPaginating,
|
|
173
|
+
} = useCards({
|
|
174
|
+
sectionId: section_id,
|
|
175
|
+
data: externalData,
|
|
176
|
+
fetchMore: moreFetchData,
|
|
177
|
+
loading: isLoading,
|
|
178
|
+
initialSkeleton: skeletonCount,
|
|
179
|
+
pagingSkeleton: paginationSkeletonCount,
|
|
180
|
+
adsRender: true,
|
|
181
|
+
});
|
|
151
182
|
|
|
152
|
-
//
|
|
183
|
+
// Skeleton Data
|
|
153
184
|
const skeletonItems = useMemo(() => {
|
|
154
185
|
const count = isLoading ? skeletonCount : isPaginating ? 1 : 0;
|
|
155
|
-
|
|
156
|
-
|
|
186
|
+
|
|
187
|
+
if (!count) {
|
|
188
|
+
return [];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return Array.from({ length: count }, (_, index) => ({
|
|
192
|
+
_id: `skeleton-${index}`,
|
|
157
193
|
isSkeleton: true,
|
|
158
194
|
}));
|
|
159
195
|
}, [isLoading, isPaginating, skeletonCount]);
|
|
160
196
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
? skeletonItems
|
|
166
|
-
: skeletonItems.length > 0
|
|
167
|
-
? [...data, ...skeletonItems]
|
|
168
|
-
: data,
|
|
169
|
-
[isLoading, data, skeletonItems]
|
|
170
|
-
);
|
|
197
|
+
const finalData = useMemo(() => {
|
|
198
|
+
if (isLoading) {
|
|
199
|
+
return skeletonItems;
|
|
200
|
+
}
|
|
171
201
|
|
|
172
|
-
|
|
202
|
+
if (!skeletonItems.length) {
|
|
203
|
+
return listData;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return [...listData, ...skeletonItems];
|
|
207
|
+
}, [listData, isLoading, skeletonItems]);
|
|
208
|
+
|
|
209
|
+
// Debounced Functions
|
|
173
210
|
const debouncedLoadMore = useMemo(
|
|
174
211
|
() =>
|
|
175
212
|
debounce((nextPage: number) => {
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
-
[
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
const handleItemPress = useCallback(
|
|
182
|
-
(item: IContentData) => {
|
|
183
|
-
onPressItem?.(item);
|
|
184
|
-
},
|
|
185
|
-
[onPressItem]
|
|
213
|
+
loadMore(nextPage);
|
|
214
|
+
}, DEBOUNCE_DELAY),
|
|
215
|
+
[loadMore]
|
|
186
216
|
);
|
|
187
217
|
|
|
218
|
+
// Event Handlers
|
|
188
219
|
const handlePressMore = useCallback(() => {
|
|
189
|
-
onPressMore?.({
|
|
190
|
-
section_id,
|
|
191
|
-
name: title,
|
|
192
|
-
type,
|
|
193
|
-
});
|
|
220
|
+
onPressMore?.({ section_id, name: title, type });
|
|
194
221
|
}, [onPressMore, section_id, title, type]);
|
|
195
222
|
|
|
223
|
+
const handleSnapToItem = useCallback(
|
|
224
|
+
(index: number) => {
|
|
225
|
+
// Pagination logic
|
|
226
|
+
if (!pagination?.hasNextPage || !pagination?.nextPage) return;
|
|
227
|
+
if (index >= finalData.length - PAGINATION_TRIGGER_OFFSET) {
|
|
228
|
+
debouncedLoadMore(pagination.nextPage);
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
[finalData, pagination, debouncedLoadMore]
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
// Render Functions
|
|
196
235
|
const renderItem = useCallback(
|
|
197
|
-
({
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
item: IContentData | { isSkeleton: true; _id: string };
|
|
202
|
-
index: number;
|
|
203
|
-
}) => {
|
|
204
|
-
if ('isSkeleton' in item) {
|
|
236
|
+
({ item, index }: { item: IContentData | IAdItem; index: number }) => {
|
|
237
|
+
// Handle ads
|
|
238
|
+
if ('type' in item && item.type === 'ads') {
|
|
239
|
+
const adItem = item as IAdItem;
|
|
205
240
|
return (
|
|
206
|
-
<View
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
241
|
+
<View
|
|
242
|
+
key={`ad-${adItem.tracking?.impression || index}`}
|
|
243
|
+
style={[styles.item, itemStyle]}
|
|
244
|
+
>
|
|
245
|
+
<AdsPoster
|
|
246
|
+
ad={adItem}
|
|
247
|
+
theme={appliedTheme}
|
|
248
|
+
isLoading={isLoading}
|
|
249
|
+
containerStyle={{ width: itemWidth, height: itemHeight }}
|
|
250
|
+
imageStyle={styles.image}
|
|
251
|
+
borderRadius={borderRadius}
|
|
252
|
+
onDisplayAds={onDisplayAds}
|
|
253
|
+
screenDimensions={screenDimensions}
|
|
254
|
+
viewportOffsets={viewportOffsets}
|
|
255
|
+
/>
|
|
217
256
|
</View>
|
|
218
257
|
);
|
|
219
258
|
}
|
|
220
|
-
|
|
259
|
+
// Handle content items
|
|
260
|
+
const contentItem = item as IContentData;
|
|
261
|
+
const isSkeleton =
|
|
262
|
+
contentItem._id?.startsWith?.('pagination-skeleton') ?? false;
|
|
221
263
|
return (
|
|
222
264
|
<TouchableOpacity
|
|
223
|
-
key={item._id || `item-${index}`}
|
|
224
|
-
activeOpacity={0.8}
|
|
225
265
|
style={[styles.item, itemStyle]}
|
|
226
|
-
|
|
227
|
-
onPress={() =>
|
|
266
|
+
activeOpacity={ITEM_ACTIVE_OPACITY}
|
|
267
|
+
onPress={() => {
|
|
268
|
+
if (!isSkeleton && !isLoading) {
|
|
269
|
+
onPressItem?.(contentItem);
|
|
270
|
+
}
|
|
271
|
+
}}
|
|
228
272
|
>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
resizeMode={FastImage.resizeMode.cover}
|
|
239
|
-
isLoading={isLoading}
|
|
240
|
-
/>
|
|
241
|
-
)}
|
|
273
|
+
<CardPoster
|
|
274
|
+
posterUri={item.poster}
|
|
275
|
+
content_offering_type={item.content_offering_type}
|
|
276
|
+
theme={appliedTheme}
|
|
277
|
+
borderRadius={borderRadius}
|
|
278
|
+
posterWrapperStyle={styles.image}
|
|
279
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
280
|
+
isLoading={isSkeleton || isLoading}
|
|
281
|
+
/>
|
|
242
282
|
</TouchableOpacity>
|
|
243
283
|
);
|
|
244
284
|
},
|
|
245
285
|
[
|
|
246
|
-
styles.item,
|
|
247
|
-
styles.image,
|
|
248
|
-
styles.skeleton,
|
|
249
|
-
itemStyle,
|
|
250
|
-
onPressItem,
|
|
251
|
-
isLoading,
|
|
252
|
-
renderItemImage,
|
|
253
286
|
appliedTheme,
|
|
254
|
-
|
|
287
|
+
styles,
|
|
288
|
+
itemStyle,
|
|
255
289
|
itemWidth,
|
|
256
290
|
itemHeight,
|
|
257
|
-
|
|
291
|
+
borderRadius,
|
|
292
|
+
isLoading,
|
|
293
|
+
onPressItem,
|
|
294
|
+
onDisplayAds,
|
|
295
|
+
screenDimensions,
|
|
296
|
+
viewportOffsets,
|
|
258
297
|
]
|
|
259
298
|
);
|
|
260
|
-
if (!initialData) return null;
|
|
261
|
-
if (!isLoading && (!data || data.length === 0)) return null;
|
|
262
299
|
|
|
300
|
+
// Early Returns
|
|
301
|
+
if (!externalData) return null;
|
|
302
|
+
if (!isLoading && listData.length === 0 && !isEmpty) return null;
|
|
303
|
+
|
|
304
|
+
// Main Render
|
|
263
305
|
return (
|
|
264
|
-
<View
|
|
265
|
-
style={[staticStyles.root, containerStyle]}
|
|
266
|
-
testID={`movie-card-${section_id}`}
|
|
267
|
-
>
|
|
306
|
+
<View style={[staticStyles.root, containerStyle]}>
|
|
268
307
|
{isLoading ? (
|
|
269
308
|
<SkeletonPlaceholder
|
|
270
309
|
highlightColor={appliedTheme.colors.skeletonHighlightColor}
|
|
271
310
|
backgroundColor={appliedTheme.colors.skeletonBaseColor}
|
|
272
311
|
>
|
|
273
312
|
<SkeletonPlaceholder.Item
|
|
274
|
-
width={
|
|
275
|
-
height={
|
|
276
|
-
borderRadius={
|
|
277
|
-
marginLeft={
|
|
278
|
-
marginBottom={
|
|
313
|
+
width={SKELETON_TITLE_WIDTH}
|
|
314
|
+
height={SKELETON_TITLE_HEIGHT}
|
|
315
|
+
borderRadius={SKELETON_TITLE_BORDER_RADIUS}
|
|
316
|
+
marginLeft={SKELETON_TITLE_MARGIN_LEFT}
|
|
317
|
+
marginBottom={SKELETON_TITLE_MARGIN_BOTTOM}
|
|
279
318
|
/>
|
|
280
319
|
</SkeletonPlaceholder>
|
|
281
320
|
) : (
|
|
@@ -291,23 +330,17 @@ const MovieCardThree: React.FC<Props> = ({
|
|
|
291
330
|
showAllProps={{ iconColor: appliedTheme.colors.textPrimary, theme }}
|
|
292
331
|
/>
|
|
293
332
|
)}
|
|
333
|
+
|
|
294
334
|
<Carousel
|
|
295
335
|
ref={carouselRef}
|
|
296
|
-
data={finalData as
|
|
297
|
-
vertical={false}
|
|
336
|
+
data={finalData as IContentData[]}
|
|
298
337
|
renderItem={renderItem}
|
|
299
|
-
firstItem={
|
|
300
|
-
inactiveSlideOpacity={0.6}
|
|
301
|
-
inactiveSlideScale={0.9}
|
|
338
|
+
firstItem={CAROUSEL_FIRST_ITEM}
|
|
302
339
|
sliderWidth={width}
|
|
303
340
|
itemWidth={itemWidth}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (index >= finalData.length - 2) {
|
|
308
|
-
debouncedLoadMore(pagination.nextPage);
|
|
309
|
-
}
|
|
310
|
-
}}
|
|
341
|
+
inactiveSlideOpacity={CAROUSEL_INACTIVE_OPACITY}
|
|
342
|
+
inactiveSlideScale={CAROUSEL_INACTIVE_SCALE}
|
|
343
|
+
onSnapToItem={handleSnapToItem}
|
|
311
344
|
/>
|
|
312
345
|
</View>
|
|
313
346
|
);
|