@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
@@ -14,30 +14,48 @@ import {
14
14
  type TextStyle,
15
15
  type ViewStyle,
16
16
  type AccessibilityProps,
17
- type ListRenderItemInfo,
18
17
  } from 'react-native';
18
+
19
19
  import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
20
20
  import { moderateScale, verticalScale } from 'react-native-size-matters';
21
- import { usePaginatedSection } from '../../../../hooks/usePaginatedSection';
21
+ import FastImage from 'react-native-fast-image';
22
+ import { RFValue } from 'react-native-responsive-fontsize';
23
+
22
24
  import NavigateToMore from '../components/NavigateToMore';
23
- import { useInternalTheme } from '../../../../theme/hook/useInternalTheme';
25
+ import { AdsPoster } from '../components';
24
26
  import CardPoster from '../components/CardPoster';
25
- import FastImage from 'react-native-fast-image';
27
+
28
+ import { useInternalTheme } from '../../../../theme/hook/useInternalTheme';
29
+
26
30
  import type {
31
+ IAdItem,
27
32
  IGetSectionData,
28
33
  ISectionContent,
29
34
  MoreFetchData,
30
35
  } from '../../../../types';
31
36
  import type { ITheme, ThemeOverride } from '../../../../theme/themes';
32
- import { RFValue } from 'react-native-responsive-fontsize';
33
- 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';
34
39
 
35
- // default values
40
+ // Constants
36
41
  const DEFAULT_ITEM_WIDTH = moderateScale(100);
37
42
  const DEFAULT_BORDER_RADIUS = moderateScale(5);
38
43
  const DEFAULT_SKELETON_COUNT = 5;
39
44
  const ASPECT_RATIO = 0.7 / 1;
45
+ const END_REACHED_THRESHOLD = 0.5;
46
+ const ITEM_ACTIVE_OPACITY = 0.8;
47
+ const SKELETON_TITLE_WIDTH = moderateScale(100);
48
+ const SKELETON_TITLE_HEIGHT = moderateScale(20);
49
+ const SKELETON_TITLE_BORDER_RADIUS = moderateScale(4);
50
+ const SKELETON_TITLE_MARGIN_HORIZONTAL = moderateScale(15);
51
+ const SKELETON_TITLE_MARGIN_BOTTOM = verticalScale(6);
52
+ const SKELETON_ITEM_MARGIN_LEFT = moderateScale(12);
53
+ const SKELETON_ITEM_MARGIN_RIGHT = moderateScale(12);
54
+ const ITEM_MARGIN_LEFT = moderateScale(10);
55
+ const LIST_CONTENT_PADDING_RIGHT = moderateScale(12);
56
+ const SKELETON_LIST_PADDING_RIGHT = moderateScale(15);
40
57
 
58
+ // Types
41
59
  type MovieCardFourProps = {
42
60
  title: string;
43
61
  section_id: string;
@@ -60,53 +78,76 @@ type MovieCardFourProps = {
60
78
  skeletonCount?: number;
61
79
  containerStyle?: StyleProp<ViewStyle>;
62
80
  titleStyle?: StyleProp<TextStyle>;
81
+ paginationSkeletonCount?: number;
63
82
  itemStyle?: StyleProp<ViewStyle>;
64
83
  isLoading?: boolean;
65
84
  theme?: ThemeOverride;
85
+ onDisplayAds?: (ad: IServeAd) => void;
86
+ screenDimensions?: { width: number; height: number };
87
+ viewportOffsets?: {
88
+ top: number;
89
+ bottom: number;
90
+ left: number;
91
+ right: number;
92
+ };
66
93
  } & AccessibilityProps;
67
94
 
95
+ // Main Component
68
96
  const MovieCardFour: React.FC<MovieCardFourProps> = ({
69
97
  title,
70
98
  section_id,
71
99
  type,
72
- data: initialData,
100
+ data: externalData,
73
101
  moreFetchData,
74
102
  onPressItem,
75
103
  onPressMore,
76
- renderItemImage,
77
104
  itemWidth = DEFAULT_ITEM_WIDTH,
78
105
  itemHeight = DEFAULT_ITEM_WIDTH / ASPECT_RATIO,
79
106
  borderRadius = DEFAULT_BORDER_RADIUS,
80
107
  skeletonCount = DEFAULT_SKELETON_COUNT,
81
108
  containerStyle,
109
+ paginationSkeletonCount,
82
110
  titleStyle,
83
111
  itemStyle,
84
112
  isLoading = false,
85
113
  theme,
86
114
  accessibilityLabel,
87
115
  accessibilityHint,
116
+ onDisplayAds,
117
+ screenDimensions,
118
+ viewportOffsets,
88
119
  }) => {
89
- const flatListRef = useRef<FlatList<IContentData>>(null);
120
+ // Refs
121
+ const flatListRef = useRef<FlatList<IContentData | IAdItem>>(null);
90
122
  const onEndReachedCalledDuringMomentum = useRef(false);
123
+
124
+ // Theme
91
125
  const { theme: appliedTheme } = useInternalTheme(theme);
92
126
 
127
+ // Styles
93
128
  const styles = useMemo(
94
129
  () => getStyles(appliedTheme, itemWidth, itemHeight, borderRadius),
95
130
  [appliedTheme, itemWidth, itemHeight, borderRadius]
96
131
  );
97
132
 
133
+ // Data Management
98
134
  const {
99
- data,
135
+ listData,
100
136
  pagination,
101
- loading: isPaginating,
102
- loadMoreData,
103
- } = usePaginatedSection(
104
- section_id,
105
- moreFetchData,
106
- initialData?.data || [],
107
- isLoading
108
- );
137
+ loadMore,
138
+ isEmpty,
139
+ isPaging: isPaginating,
140
+ } = useCards({
141
+ sectionId: section_id,
142
+ data: externalData,
143
+ fetchMore: moreFetchData,
144
+ loading: isLoading,
145
+ initialSkeleton: skeletonCount,
146
+ pagingSkeleton: paginationSkeletonCount,
147
+ adsRender: true,
148
+ });
109
149
 
150
+ // Event Handlers
110
151
  const handleItemPress = useCallback(
111
152
  (item: IContentData) => onPressItem?.(item),
112
153
  [onPressItem]
@@ -123,66 +164,113 @@ const MovieCardFour: React.FC<MovieCardFourProps> = ({
123
164
  pagination?.nextPage
124
165
  ) {
125
166
  onEndReachedCalledDuringMomentum.current = true;
126
- loadMoreData(pagination.nextPage);
167
+ loadMore(pagination.nextPage);
127
168
  }
128
- }, [loadMoreData, pagination]);
169
+ }, [loadMore, pagination]);
129
170
 
171
+ const handleMomentumScrollBegin = useCallback(() => {
172
+ onEndReachedCalledDuringMomentum.current = false;
173
+ }, []);
174
+
175
+ // Render Functions
130
176
  const renderItem = useCallback(
131
- ({ item, index }: ListRenderItemInfo<IContentData>) => {
177
+ ({ item, index }: { item: IContentData | IAdItem; index: number }) => {
178
+ // Handle ads
179
+ if ('type' in item && item.type === 'ads') {
180
+ const adItem = item as IAdItem;
181
+ return (
182
+ <View
183
+ key={`ad-${adItem.tracking?.impression || index}`}
184
+ style={[styles.item, itemStyle]}
185
+ >
186
+ <AdsPoster
187
+ ad={adItem}
188
+ theme={appliedTheme}
189
+ isLoading={isLoading}
190
+ containerStyle={{ width: itemWidth, height: itemHeight }}
191
+ imageStyle={styles.image}
192
+ borderRadius={borderRadius}
193
+ onDisplayAds={onDisplayAds}
194
+ screenDimensions={screenDimensions}
195
+ viewportOffsets={viewportOffsets}
196
+ />
197
+ </View>
198
+ );
199
+ }
200
+ // Handle content items
201
+ const contentItem = item as IContentData;
202
+ const isSkeleton =
203
+ contentItem._id?.startsWith?.('pagination-skeleton') ?? false;
204
+
132
205
  return (
133
206
  <TouchableOpacity
207
+ key={contentItem._id}
134
208
  style={[styles.item, itemStyle]}
135
- onPress={() => handleItemPress(item)}
136
- activeOpacity={0.8}
209
+ activeOpacity={ITEM_ACTIVE_OPACITY}
210
+ onPress={() => {
211
+ if (!isSkeleton && !isLoading) {
212
+ handleItemPress(contentItem);
213
+ }
214
+ }}
137
215
  >
138
- {renderItemImage ? (
139
- renderItemImage({ item, index })
140
- ) : (
141
- <CardPoster
142
- content_offering_type={item.content_offering_type}
143
- posterUri={item.poster}
144
- theme={appliedTheme}
145
- borderRadius={borderRadius}
146
- posterWrapperStyle={styles.image}
147
- resizeMode={FastImage.resizeMode.cover}
148
- isLoading={isLoading}
149
- />
150
- )}
216
+ <CardPoster
217
+ posterUri={contentItem.poster}
218
+ content_offering_type={contentItem.content_offering_type}
219
+ theme={appliedTheme}
220
+ borderRadius={borderRadius}
221
+ posterWrapperStyle={styles.image}
222
+ resizeMode={FastImage.resizeMode.cover}
223
+ isLoading={isSkeleton || isLoading}
224
+ />
151
225
  </TouchableOpacity>
152
226
  );
153
227
  },
154
228
  [
155
- styles.item,
156
- styles.image,
157
- itemStyle,
158
- renderItemImage,
159
229
  appliedTheme,
230
+ styles,
231
+ itemStyle,
160
232
  borderRadius,
161
233
  isLoading,
162
234
  handleItemPress,
235
+ itemWidth,
236
+ itemHeight,
237
+ onDisplayAds,
238
+ screenDimensions,
239
+ viewportOffsets,
163
240
  ]
164
241
  );
165
242
 
166
- const renderSkeletonItem = ({ index }: { index: number }) => (
167
- <SkeletonPlaceholder
168
- key={`skeleton-${index}`}
169
- highlightColor={appliedTheme.colors.skeletonHighlightColor}
170
- backgroundColor={appliedTheme.colors.skeletonBaseColor}
171
- >
172
- <SkeletonPlaceholder.Item
173
- width={itemWidth}
174
- height={itemHeight}
175
- borderRadius={borderRadius}
176
- marginLeft={index === 0 ? moderateScale(12) : 0}
177
- marginRight={moderateScale(12)}
178
- />
179
- </SkeletonPlaceholder>
243
+ const renderSkeletonItem = useCallback(
244
+ ({ index }: { index: number }) => (
245
+ <SkeletonPlaceholder
246
+ key={`skeleton-${index}`}
247
+ highlightColor={appliedTheme.colors.skeletonHighlightColor}
248
+ backgroundColor={appliedTheme.colors.skeletonBaseColor}
249
+ >
250
+ <SkeletonPlaceholder.Item
251
+ width={itemWidth}
252
+ height={itemHeight}
253
+ borderRadius={borderRadius}
254
+ marginLeft={index === 0 ? SKELETON_ITEM_MARGIN_LEFT : 0}
255
+ marginRight={SKELETON_ITEM_MARGIN_RIGHT}
256
+ />
257
+ </SkeletonPlaceholder>
258
+ ),
259
+ [appliedTheme, itemWidth, itemHeight, borderRadius]
260
+ );
261
+
262
+ const keyExtractor = useCallback(
263
+ (item: IContentData | IAdItem, index: number) => {
264
+ return '_id' in item ? item._id : `ad-${index}`;
265
+ },
266
+ []
180
267
  );
181
- if (!initialData) {
182
- return null;
183
- }
184
- if (!isLoading && data.length === 0) return null;
185
268
 
269
+ // Early Returns
270
+ if (!externalData) return null;
271
+ if (!isLoading && listData.length === 0 && !isEmpty) return null;
272
+
273
+ // Main Render
186
274
  return (
187
275
  <View
188
276
  style={[styles.root, containerStyle]}
@@ -196,24 +284,21 @@ const MovieCardFour: React.FC<MovieCardFourProps> = ({
196
284
  backgroundColor={appliedTheme.colors.skeletonBaseColor}
197
285
  >
198
286
  <SkeletonPlaceholder.Item
199
- width={moderateScale(100)}
200
- height={moderateScale(20)}
201
- borderRadius={moderateScale(4)}
202
- marginHorizontal={moderateScale(15)}
203
- marginBottom={verticalScale(6)}
287
+ width={SKELETON_TITLE_WIDTH}
288
+ height={SKELETON_TITLE_HEIGHT}
289
+ borderRadius={SKELETON_TITLE_BORDER_RADIUS}
290
+ marginHorizontal={SKELETON_TITLE_MARGIN_HORIZONTAL}
291
+ marginBottom={SKELETON_TITLE_MARGIN_BOTTOM}
204
292
  />
205
293
  </SkeletonPlaceholder>
294
+
206
295
  <ScrollView
207
296
  horizontal
208
297
  showsHorizontalScrollIndicator={false}
209
298
  contentContainerStyle={styles.skeletonList}
210
299
  >
211
- {skeletonCount > 0 && (
212
- <View style={styles.skeletonList}>
213
- {Array.from({ length: skeletonCount }).map((_, index) =>
214
- renderSkeletonItem({ index })
215
- )}
216
- </View>
300
+ {Array.from({ length: skeletonCount }).map((_, index) =>
301
+ renderSkeletonItem({ index })
217
302
  )}
218
303
  </ScrollView>
219
304
  </>
@@ -230,25 +315,18 @@ const MovieCardFour: React.FC<MovieCardFourProps> = ({
230
315
  containerStyle={styles.navigateToMoreContainer}
231
316
  showAllProps={{ iconColor: appliedTheme.colors.textPrimary, theme }}
232
317
  />
318
+
233
319
  <FlatList
234
320
  ref={flatListRef}
235
- data={data}
321
+ data={listData}
236
322
  horizontal
237
- keyExtractor={(item, index) =>
238
- item._id || `item-${item.slug || item.name || index}`
239
- }
323
+ keyExtractor={keyExtractor}
240
324
  renderItem={renderItem}
241
325
  showsHorizontalScrollIndicator={false}
242
326
  contentContainerStyle={styles.listContent}
243
- initialNumToRender={5}
244
327
  onEndReached={handleEndReached}
245
- onEndReachedThreshold={0.5}
246
- onScrollBeginDrag={() => {
247
- onEndReachedCalledDuringMomentum.current = false;
248
- }}
249
- onMomentumScrollBegin={() => {
250
- onEndReachedCalledDuringMomentum.current = false;
251
- }}
328
+ onEndReachedThreshold={END_REACHED_THRESHOLD}
329
+ onMomentumScrollBegin={handleMomentumScrollBegin}
252
330
  ListFooterComponent={
253
331
  isPaginating ? renderSkeletonItem({ index: 0 }) : null
254
332
  }
@@ -259,6 +337,7 @@ const MovieCardFour: React.FC<MovieCardFourProps> = ({
259
337
  );
260
338
  };
261
339
 
340
+ // Styles
262
341
  const getStyles = (
263
342
  theme: ITheme,
264
343
  width: number,
@@ -270,7 +349,7 @@ const getStyles = (
270
349
  marginVertical: verticalScale(6),
271
350
  },
272
351
  item: {
273
- marginLeft: moderateScale(10),
352
+ marginLeft: ITEM_MARGIN_LEFT,
274
353
  },
275
354
  image: {
276
355
  width,
@@ -287,12 +366,12 @@ const getStyles = (
287
366
  fontWeight: '600',
288
367
  },
289
368
  listContent: {
290
- paddingRight: moderateScale(12),
369
+ paddingRight: LIST_CONTENT_PADDING_RIGHT,
291
370
  },
292
371
  skeletonList: {
293
372
  flexDirection: 'row',
294
373
  alignItems: 'flex-start',
295
- paddingRight: moderateScale(15),
374
+ paddingRight: SKELETON_LIST_PADDING_RIGHT,
296
375
  },
297
376
  });
298
377