@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.
Files changed (136) hide show
  1. package/lib/module/components/Auth/QrLogin/QrLogin.js +304 -138
  2. package/lib/module/components/Auth/QrLogin/QrLogin.js.map +1 -1
  3. package/lib/module/components/Auth/QrLogin/components/QrViewArea.js +193 -141
  4. package/lib/module/components/Auth/QrLogin/components/QrViewArea.js.map +1 -1
  5. package/lib/module/components/Content/Card/Category/Category.js +83 -11
  6. package/lib/module/components/Content/Card/Category/Category.js.map +1 -1
  7. package/lib/module/components/Content/Card/NowWatching/NowWatching.js +237 -108
  8. package/lib/module/components/Content/Card/NowWatching/NowWatching.js.map +1 -1
  9. package/lib/module/components/Content/Card/Sliders/Styles/One.js +185 -126
  10. package/lib/module/components/Content/Card/Sliders/Styles/One.js.map +1 -1
  11. package/lib/module/components/Content/Card/Sliders/Styles/Two.js +139 -92
  12. package/lib/module/components/Content/Card/Sliders/Styles/Two.js.map +1 -1
  13. package/lib/module/components/Content/Card/Styles/Five.js +131 -48
  14. package/lib/module/components/Content/Card/Styles/Five.js.map +1 -1
  15. package/lib/module/components/Content/Card/Styles/Four.js +126 -59
  16. package/lib/module/components/Content/Card/Styles/Four.js.map +1 -1
  17. package/lib/module/components/Content/Card/Styles/One.js +125 -50
  18. package/lib/module/components/Content/Card/Styles/One.js.map +1 -1
  19. package/lib/module/components/Content/Card/Styles/RotateInOut.js +138 -53
  20. package/lib/module/components/Content/Card/Styles/RotateInOut.js.map +1 -1
  21. package/lib/module/components/Content/Card/Styles/Six.js +207 -115
  22. package/lib/module/components/Content/Card/Styles/Six.js.map +1 -1
  23. package/lib/module/components/Content/Card/Styles/Three.js +134 -79
  24. package/lib/module/components/Content/Card/Styles/Three.js.map +1 -1
  25. package/lib/module/components/Content/Card/Styles/TopTen.js +186 -171
  26. package/lib/module/components/Content/Card/Styles/TopTen.js.map +1 -1
  27. package/lib/module/components/Content/Card/Styles/Two.js +144 -64
  28. package/lib/module/components/Content/Card/Styles/Two.js.map +1 -1
  29. package/lib/module/components/Content/Card/components/AdsPoster.js +162 -0
  30. package/lib/module/components/Content/Card/components/AdsPoster.js.map +1 -0
  31. package/lib/module/components/Content/Card/components/CardPoster.js +120 -136
  32. package/lib/module/components/Content/Card/components/CardPoster.js.map +1 -1
  33. package/lib/module/components/Content/Card/components/index.js +4 -0
  34. package/lib/module/components/Content/Card/components/index.js.map +1 -0
  35. package/lib/module/components/Content/Content.js +67 -27
  36. package/lib/module/components/Content/Content.js.map +1 -1
  37. package/lib/module/components/Content/Sections.js +32 -11
  38. package/lib/module/components/Content/Sections.js.map +1 -1
  39. package/lib/module/constants/dummySections.js +44 -4
  40. package/lib/module/constants/dummySections.js.map +1 -1
  41. package/lib/module/hooks/Images/index.js +5 -0
  42. package/lib/module/hooks/Images/index.js.map +1 -0
  43. package/lib/module/hooks/Images/useImageLoader.js +168 -0
  44. package/lib/module/hooks/Images/useImageLoader.js.map +1 -0
  45. package/lib/module/hooks/Images/useImageValidation.js +36 -0
  46. package/lib/module/hooks/Images/useImageValidation.js.map +1 -0
  47. package/lib/module/hooks/index.js +3 -0
  48. package/lib/module/hooks/index.js.map +1 -1
  49. package/lib/module/hooks/useAdTracking.js +270 -0
  50. package/lib/module/hooks/useAdTracking.js.map +1 -0
  51. package/lib/module/hooks/useCards.js +164 -0
  52. package/lib/module/hooks/useCards.js.map +1 -0
  53. package/lib/module/hooks/usePaginatedSection.js +11 -6
  54. package/lib/module/hooks/usePaginatedSection.js.map +1 -1
  55. package/lib/typescript/src/components/Auth/QrLogin/QrLogin.d.ts +2 -0
  56. package/lib/typescript/src/components/Auth/QrLogin/QrLogin.d.ts.map +1 -1
  57. package/lib/typescript/src/components/Auth/QrLogin/components/QrViewArea.d.ts.map +1 -1
  58. package/lib/typescript/src/components/Content/Card/Category/Category.d.ts.map +1 -1
  59. package/lib/typescript/src/components/Content/Card/NowWatching/NowWatching.d.ts.map +1 -1
  60. package/lib/typescript/src/components/Content/Card/Sliders/Styles/One.d.ts.map +1 -1
  61. package/lib/typescript/src/components/Content/Card/Sliders/Styles/Two.d.ts.map +1 -1
  62. package/lib/typescript/src/components/Content/Card/Styles/Five.d.ts +13 -1
  63. package/lib/typescript/src/components/Content/Card/Styles/Five.d.ts.map +1 -1
  64. package/lib/typescript/src/components/Content/Card/Styles/Four.d.ts +13 -1
  65. package/lib/typescript/src/components/Content/Card/Styles/Four.d.ts.map +1 -1
  66. package/lib/typescript/src/components/Content/Card/Styles/One.d.ts +15 -3
  67. package/lib/typescript/src/components/Content/Card/Styles/One.d.ts.map +1 -1
  68. package/lib/typescript/src/components/Content/Card/Styles/RotateInOut.d.ts +13 -1
  69. package/lib/typescript/src/components/Content/Card/Styles/RotateInOut.d.ts.map +1 -1
  70. package/lib/typescript/src/components/Content/Card/Styles/Six.d.ts +1 -0
  71. package/lib/typescript/src/components/Content/Card/Styles/Six.d.ts.map +1 -1
  72. package/lib/typescript/src/components/Content/Card/Styles/Three.d.ts +13 -5
  73. package/lib/typescript/src/components/Content/Card/Styles/Three.d.ts.map +1 -1
  74. package/lib/typescript/src/components/Content/Card/Styles/TopTen.d.ts +1 -0
  75. package/lib/typescript/src/components/Content/Card/Styles/TopTen.d.ts.map +1 -1
  76. package/lib/typescript/src/components/Content/Card/Styles/Two.d.ts +13 -1
  77. package/lib/typescript/src/components/Content/Card/Styles/Two.d.ts.map +1 -1
  78. package/lib/typescript/src/components/Content/Card/components/AdsPoster.d.ts +26 -0
  79. package/lib/typescript/src/components/Content/Card/components/AdsPoster.d.ts.map +1 -0
  80. package/lib/typescript/src/components/Content/Card/components/CardPoster.d.ts +3 -1
  81. package/lib/typescript/src/components/Content/Card/components/CardPoster.d.ts.map +1 -1
  82. package/lib/typescript/src/components/Content/Card/components/index.d.ts +2 -0
  83. package/lib/typescript/src/components/Content/Card/components/index.d.ts.map +1 -0
  84. package/lib/typescript/src/components/Content/Card/index.d.ts +76 -6
  85. package/lib/typescript/src/components/Content/Card/index.d.ts.map +1 -1
  86. package/lib/typescript/src/components/Content/Content.d.ts +4 -3
  87. package/lib/typescript/src/components/Content/Content.d.ts.map +1 -1
  88. package/lib/typescript/src/components/Content/Sections.d.ts +20 -6
  89. package/lib/typescript/src/components/Content/Sections.d.ts.map +1 -1
  90. package/lib/typescript/src/constants/dummySections.d.ts +5 -0
  91. package/lib/typescript/src/constants/dummySections.d.ts.map +1 -1
  92. package/lib/typescript/src/hooks/Images/index.d.ts +3 -0
  93. package/lib/typescript/src/hooks/Images/index.d.ts.map +1 -0
  94. package/lib/typescript/src/hooks/Images/useImageLoader.d.ts +36 -0
  95. package/lib/typescript/src/hooks/Images/useImageLoader.d.ts.map +1 -0
  96. package/lib/typescript/src/hooks/Images/useImageValidation.d.ts +17 -0
  97. package/lib/typescript/src/hooks/Images/useImageValidation.d.ts.map +1 -0
  98. package/lib/typescript/src/hooks/index.d.ts +3 -0
  99. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  100. package/lib/typescript/src/hooks/useAdTracking.d.ts +39 -0
  101. package/lib/typescript/src/hooks/useAdTracking.d.ts.map +1 -0
  102. package/lib/typescript/src/hooks/useCards.d.ts +36 -0
  103. package/lib/typescript/src/hooks/useCards.d.ts.map +1 -0
  104. package/lib/typescript/src/hooks/usePaginatedSection.d.ts +12 -2
  105. package/lib/typescript/src/hooks/usePaginatedSection.d.ts.map +1 -1
  106. package/lib/typescript/src/types/sections/index.d.ts +7 -4
  107. package/lib/typescript/src/types/sections/index.d.ts.map +1 -1
  108. package/package.json +6 -3
  109. package/src/components/Auth/QrLogin/QrLogin.tsx +382 -122
  110. package/src/components/Auth/QrLogin/components/QrViewArea.tsx +291 -197
  111. package/src/components/Content/Card/Category/Category.tsx +95 -8
  112. package/src/components/Content/Card/NowWatching/NowWatching.tsx +281 -136
  113. package/src/components/Content/Card/Sliders/Styles/One.tsx +244 -148
  114. package/src/components/Content/Card/Sliders/Styles/Two.tsx +171 -102
  115. package/src/components/Content/Card/Styles/Five.tsx +161 -62
  116. package/src/components/Content/Card/Styles/Four.tsx +164 -85
  117. package/src/components/Content/Card/Styles/One.tsx +161 -71
  118. package/src/components/Content/Card/Styles/RotateInOut.tsx +157 -60
  119. package/src/components/Content/Card/Styles/Six.tsx +242 -142
  120. package/src/components/Content/Card/Styles/Three.tsx +166 -133
  121. package/src/components/Content/Card/Styles/TopTen.tsx +230 -191
  122. package/src/components/Content/Card/Styles/Two.tsx +182 -79
  123. package/src/components/Content/Card/components/AdsPoster.tsx +202 -0
  124. package/src/components/Content/Card/components/CardPoster.tsx +134 -154
  125. package/src/components/Content/Card/components/index.ts +1 -0
  126. package/src/components/Content/Content.tsx +83 -45
  127. package/src/components/Content/Sections.tsx +51 -10
  128. package/src/constants/dummySections.ts +48 -1
  129. package/src/hooks/Images/index.ts +2 -0
  130. package/src/hooks/Images/useImageLoader.ts +206 -0
  131. package/src/hooks/Images/useImageValidation.ts +36 -0
  132. package/src/hooks/index.ts +3 -0
  133. package/src/hooks/useAdTracking.ts +349 -0
  134. package/src/hooks/useCards.ts +228 -0
  135. package/src/hooks/usePaginatedSection.ts +26 -7
  136. 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 { RFValue } from 'react-native-responsive-fontsize';
34
- import type { IContentData } from '@zezosoft/zezo-ott-api-client';
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 DEFAULT_ITEM_WIDTH = width * 0.42;
39
- const DEFAULT_ITEM_HEIGHT = height * 0.28;
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 styles defined outside getStyles to avoid recalculation
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: initialData,
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 = 5,
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
- const { theme: appliedTheme } = useInternalTheme(theme);
134
+ // Refs
135
+ const carouselRef = useRef<Carousel<IContentData | IAdItem> | null>(null);
106
136
 
107
- const carouselRef = useRef<any>(null);
137
+ // Theme
138
+ const { theme: appliedTheme } = useInternalTheme(theme);
108
139
 
109
- // Memoized dynamic styles
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.skeletonBaseColor ?? '#222',
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.colors.skeletonBaseColor, itemWidth, itemHeight, borderRadius]
163
+ [appliedTheme, itemWidth, itemHeight, borderRadius]
138
164
  );
139
165
 
166
+ // Data Management
140
167
  const {
141
- data,
142
- loading: isPaginating,
168
+ listData,
143
169
  pagination,
144
- loadMoreData,
145
- } = usePaginatedSection(
146
- section_id,
147
- moreFetchData,
148
- initialData?.data || [],
149
- isLoading
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
- // Memoized skeleton items
183
+ // Skeleton Data
153
184
  const skeletonItems = useMemo(() => {
154
185
  const count = isLoading ? skeletonCount : isPaginating ? 1 : 0;
155
- return Array.from({ length: count }, (_, i) => ({
156
- _id: `skeleton-${i}`,
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
- // Optimized finalData to avoid unnecessary spread
162
- const finalData = useMemo(
163
- () =>
164
- isLoading
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
- // Debounced loadMoreData to prevent excessive calls
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
- return loadMoreData(nextPage);
177
- }, 300),
178
- [loadMoreData]
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
- item,
199
- index,
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 key={item._id} style={styles.skeleton}>
207
- <SkeletonPlaceholder
208
- highlightColor={appliedTheme.colors.skeletonHighlightColor}
209
- backgroundColor={appliedTheme.colors.skeletonBaseColor}
210
- >
211
- <SkeletonPlaceholder.Item
212
- width={itemWidth}
213
- height={itemHeight}
214
- borderRadius={borderRadius}
215
- />
216
- </SkeletonPlaceholder>
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
- disabled={!item || !onPressItem || isLoading}
227
- onPress={() => handleItemPress(item)}
266
+ activeOpacity={ITEM_ACTIVE_OPACITY}
267
+ onPress={() => {
268
+ if (!isSkeleton && !isLoading) {
269
+ onPressItem?.(contentItem);
270
+ }
271
+ }}
228
272
  >
229
- {renderItemImage ? (
230
- renderItemImage({ item, index })
231
- ) : (
232
- <CardPoster
233
- content_offering_type={item.content_offering_type}
234
- posterUri={item.poster}
235
- theme={appliedTheme}
236
- borderRadius={borderRadius}
237
- posterWrapperStyle={styles.image}
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
- borderRadius,
287
+ styles,
288
+ itemStyle,
255
289
  itemWidth,
256
290
  itemHeight,
257
- handleItemPress,
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={moderateScale(100)}
275
- height={verticalScale(14)}
276
- borderRadius={moderateScale(4)}
277
- marginLeft={moderateScale(12)}
278
- marginBottom={verticalScale(6)}
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 any}
297
- vertical={false}
336
+ data={finalData as IContentData[]}
298
337
  renderItem={renderItem}
299
- firstItem={1}
300
- inactiveSlideOpacity={0.6}
301
- inactiveSlideScale={0.9}
338
+ firstItem={CAROUSEL_FIRST_ITEM}
302
339
  sliderWidth={width}
303
340
  itemWidth={itemWidth}
304
- onSnapToItem={(index) => {
305
- if (isLoading || !pagination?.hasNextPage || !pagination?.nextPage)
306
- return;
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
  );