@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
|
@@ -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
|
|
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 {
|
|
25
|
+
import { AdsPoster } from '../components';
|
|
24
26
|
import CardPoster from '../components/CardPoster';
|
|
25
|
-
|
|
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 {
|
|
33
|
-
import
|
|
37
|
+
import type { IContentData, IServeAd } from '@zezosoft/zezo-ott-api-client';
|
|
38
|
+
import { useCards } from '../../../../hooks';
|
|
34
39
|
|
|
35
|
-
//
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
135
|
+
listData,
|
|
100
136
|
pagination,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
167
|
+
loadMore(pagination.nextPage);
|
|
127
168
|
}
|
|
128
|
-
}, [
|
|
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 }:
|
|
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
|
-
|
|
136
|
-
|
|
209
|
+
activeOpacity={ITEM_ACTIVE_OPACITY}
|
|
210
|
+
onPress={() => {
|
|
211
|
+
if (!isSkeleton && !isLoading) {
|
|
212
|
+
handleItemPress(contentItem);
|
|
213
|
+
}
|
|
214
|
+
}}
|
|
137
215
|
>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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 = (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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={
|
|
200
|
-
height={
|
|
201
|
-
borderRadius={
|
|
202
|
-
marginHorizontal={
|
|
203
|
-
marginBottom={
|
|
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
|
|
212
|
-
|
|
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={
|
|
321
|
+
data={listData}
|
|
236
322
|
horizontal
|
|
237
|
-
keyExtractor={
|
|
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={
|
|
246
|
-
|
|
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:
|
|
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:
|
|
369
|
+
paddingRight: LIST_CONTENT_PADDING_RIGHT,
|
|
291
370
|
},
|
|
292
371
|
skeletonList: {
|
|
293
372
|
flexDirection: 'row',
|
|
294
373
|
alignItems: 'flex-start',
|
|
295
|
-
paddingRight:
|
|
374
|
+
paddingRight: SKELETON_LIST_PADDING_RIGHT,
|
|
296
375
|
},
|
|
297
376
|
});
|
|
298
377
|
|