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