@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
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import React, {
|
|
7
7
|
useRef,
|
|
8
8
|
useLayoutEffect,
|
|
9
|
+
useEffect,
|
|
9
10
|
useCallback,
|
|
10
11
|
useMemo,
|
|
11
12
|
useState,
|
|
@@ -17,6 +18,8 @@ import {
|
|
|
17
18
|
StyleSheet,
|
|
18
19
|
Dimensions,
|
|
19
20
|
InteractionManager,
|
|
21
|
+
Platform,
|
|
22
|
+
Vibration,
|
|
20
23
|
type LayoutChangeEvent,
|
|
21
24
|
type ListRenderItemInfo,
|
|
22
25
|
} from 'react-native';
|
|
@@ -52,6 +55,7 @@ const { width: SCREEN_WIDTH } = Dimensions.get('window');
|
|
|
52
55
|
|
|
53
56
|
import { usePrevious } from '../../../../hooks/usePrevious';
|
|
54
57
|
import { useSkeletonItems } from '../../../../hooks/useSkeletonItems';
|
|
58
|
+
import { debounce } from 'lodash';
|
|
55
59
|
|
|
56
60
|
const CategoryCard = React.memo(
|
|
57
61
|
({
|
|
@@ -65,6 +69,8 @@ const CategoryCard = React.memo(
|
|
|
65
69
|
const { theme: appliedTheme } = useInternalTheme(theme);
|
|
66
70
|
const flatListRef = useRef<FlatList<ICategory>>(null);
|
|
67
71
|
const [itemWidths, setItemWidths] = useState<number[]>([]);
|
|
72
|
+
const isScrollingRef = useRef(false);
|
|
73
|
+
const lastPressedIndexRef = useRef<number | null>(null);
|
|
68
74
|
|
|
69
75
|
// Memoize theme colors
|
|
70
76
|
const themeColors = useMemo(
|
|
@@ -106,11 +112,28 @@ const CategoryCard = React.memo(
|
|
|
106
112
|
[]
|
|
107
113
|
);
|
|
108
114
|
|
|
115
|
+
// Haptic feedback utility
|
|
116
|
+
const triggerHapticFeedback = useCallback(() => {
|
|
117
|
+
if (Platform.OS === 'ios') {
|
|
118
|
+
// iOS haptic feedback (light impact)
|
|
119
|
+
Vibration.vibrate(1);
|
|
120
|
+
} else if (Platform.OS === 'android') {
|
|
121
|
+
// Android haptic feedback (short vibration)
|
|
122
|
+
Vibration.vibrate(10);
|
|
123
|
+
}
|
|
124
|
+
}, []);
|
|
125
|
+
|
|
109
126
|
const scrollToCategory = useCallback(
|
|
110
127
|
(index: number, animated: boolean) => {
|
|
111
|
-
if (
|
|
128
|
+
if (
|
|
129
|
+
!flatListRef.current ||
|
|
130
|
+
index < 0 ||
|
|
131
|
+
index >= category.length ||
|
|
132
|
+
isScrollingRef.current
|
|
133
|
+
)
|
|
112
134
|
return;
|
|
113
135
|
|
|
136
|
+
isScrollingRef.current = true;
|
|
114
137
|
const RIGHT_SCROLL_BIAS = scale(40);
|
|
115
138
|
const offset = itemWidths.length
|
|
116
139
|
? itemWidths.slice(0, index).reduce((sum, w) => sum + w, 0) +
|
|
@@ -127,11 +150,35 @@ const CategoryCard = React.memo(
|
|
|
127
150
|
offset: Math.max(0, offset),
|
|
128
151
|
animated,
|
|
129
152
|
});
|
|
153
|
+
// Reset scrolling flag after animation completes
|
|
154
|
+
if (animated) {
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
isScrollingRef.current = false;
|
|
157
|
+
}, 300);
|
|
158
|
+
} else {
|
|
159
|
+
isScrollingRef.current = false;
|
|
160
|
+
}
|
|
130
161
|
});
|
|
131
162
|
},
|
|
132
163
|
[category, itemWidths]
|
|
133
164
|
);
|
|
134
165
|
|
|
166
|
+
// Debounced scroll function to prevent rapid scrolling
|
|
167
|
+
const debouncedScrollToCategory = useMemo(
|
|
168
|
+
() =>
|
|
169
|
+
debounce((index: number, animated: boolean) => {
|
|
170
|
+
scrollToCategory(index, animated);
|
|
171
|
+
}, 100),
|
|
172
|
+
[scrollToCategory]
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
// Cleanup debounced function on unmount
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
return () => {
|
|
178
|
+
debouncedScrollToCategory.cancel();
|
|
179
|
+
};
|
|
180
|
+
}, [debouncedScrollToCategory]);
|
|
181
|
+
|
|
135
182
|
const onItemLayout = useCallback(
|
|
136
183
|
(event: LayoutChangeEvent, index: number) => {
|
|
137
184
|
const { width } = event.nativeEvent.layout;
|
|
@@ -153,19 +200,38 @@ const CategoryCard = React.memo(
|
|
|
153
200
|
const index = category.findIndex(
|
|
154
201
|
(cat) => cat._id === selectedCategory._id
|
|
155
202
|
);
|
|
156
|
-
if (index >= 0
|
|
203
|
+
if (index >= 0 && index !== lastPressedIndexRef.current) {
|
|
204
|
+
// Use debounced scroll for external category changes
|
|
205
|
+
debouncedScrollToCategory(index, true);
|
|
206
|
+
}
|
|
157
207
|
}
|
|
158
|
-
}, [selectedCategory, category,
|
|
208
|
+
}, [selectedCategory, category, debouncedScrollToCategory, prevCategoryId]);
|
|
159
209
|
|
|
160
210
|
const handlePress = useCallback(
|
|
161
211
|
(item: ICategory) => {
|
|
162
|
-
|
|
212
|
+
// Prevent rapid successive taps on the same item
|
|
163
213
|
const index = category.findIndex((cat) => cat._id === item._id);
|
|
164
|
-
if (index
|
|
165
|
-
|
|
214
|
+
if (index < 0) return;
|
|
215
|
+
|
|
216
|
+
// Check if same item is being pressed rapidly
|
|
217
|
+
if (lastPressedIndexRef.current === index && isScrollingRef.current) {
|
|
218
|
+
return;
|
|
166
219
|
}
|
|
220
|
+
|
|
221
|
+
lastPressedIndexRef.current = index;
|
|
222
|
+
|
|
223
|
+
// Trigger haptic feedback for better UX
|
|
224
|
+
triggerHapticFeedback();
|
|
225
|
+
|
|
226
|
+
// Call the callback
|
|
227
|
+
onPressCategory?.(item);
|
|
228
|
+
|
|
229
|
+
// Scroll to category with slight delay for smoother UX
|
|
230
|
+
requestAnimationFrame(() => {
|
|
231
|
+
scrollToCategory(index, true);
|
|
232
|
+
});
|
|
167
233
|
},
|
|
168
|
-
[category, onPressCategory, scrollToCategory]
|
|
234
|
+
[category, onPressCategory, scrollToCategory, triggerHapticFeedback]
|
|
169
235
|
);
|
|
170
236
|
|
|
171
237
|
// Memoize filled mode selected style
|
|
@@ -219,11 +285,18 @@ const CategoryCard = React.memo(
|
|
|
219
285
|
|
|
220
286
|
return (
|
|
221
287
|
<TouchableOpacity
|
|
222
|
-
activeOpacity={0.
|
|
288
|
+
activeOpacity={0.7}
|
|
223
289
|
onPress={() => handlePress(item)}
|
|
224
290
|
style={containerStyle}
|
|
225
291
|
onLayout={(event) => onItemLayout(event, index)}
|
|
226
292
|
accessibilityLabel={`Select category ${item.name}`}
|
|
293
|
+
accessibilityRole="button"
|
|
294
|
+
accessibilityState={{ selected: isSelected }}
|
|
295
|
+
accessibilityHint={
|
|
296
|
+
isSelected
|
|
297
|
+
? `${item.name} is currently selected`
|
|
298
|
+
: `Double tap to select ${item.name} category`
|
|
299
|
+
}
|
|
227
300
|
>
|
|
228
301
|
<Text style={textStyle}>{item.name}</Text>
|
|
229
302
|
{mode === 'text' && isSelected && <View style={underlineStyle} />}
|
|
@@ -294,6 +367,20 @@ const CategoryCard = React.memo(
|
|
|
294
367
|
maxToRenderPerBatch={12}
|
|
295
368
|
windowSize={5}
|
|
296
369
|
removeClippedSubviews
|
|
370
|
+
onScrollBeginDrag={() => {
|
|
371
|
+
isScrollingRef.current = true;
|
|
372
|
+
}}
|
|
373
|
+
onScrollEndDrag={() => {
|
|
374
|
+
// Reset after a short delay to allow momentum scrolling
|
|
375
|
+
setTimeout(() => {
|
|
376
|
+
isScrollingRef.current = false;
|
|
377
|
+
}, 200);
|
|
378
|
+
}}
|
|
379
|
+
onMomentumScrollEnd={() => {
|
|
380
|
+
isScrollingRef.current = false;
|
|
381
|
+
}}
|
|
382
|
+
accessibilityLabel="Category selection list"
|
|
383
|
+
accessibilityRole="list"
|
|
297
384
|
/>
|
|
298
385
|
)}
|
|
299
386
|
</View>
|