mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-09 07:46:05 +08:00
feat:热门列表 BigVideoCard 下方穿插双列直播卡片
This commit is contained in:
@@ -207,13 +207,23 @@ export default function HomeScreen() {
|
|||||||
}
|
}
|
||||||
if (row.type === "live") {
|
if (row.type === "live") {
|
||||||
return (
|
return (
|
||||||
<View style={styles.liveRow}>
|
<View style={styles.row}>
|
||||||
<LiveCard
|
<View style={styles.leftCol}>
|
||||||
isLivePulse
|
<LiveCard
|
||||||
item={row.left}
|
isLivePulse
|
||||||
fullWidth
|
item={row.left}
|
||||||
onPress={() => router.push(`/live/${row.left.roomid}` as any)}
|
onPress={() => router.push(`/live/${row.left.roomid}` as any)}
|
||||||
/>
|
/>
|
||||||
|
</View>
|
||||||
|
{row.right && (
|
||||||
|
<View style={styles.rightCol}>
|
||||||
|
<LiveCard
|
||||||
|
isLivePulse
|
||||||
|
item={row.right}
|
||||||
|
onPress={() => router.push(`/live/${row.right!.roomid}` as any)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -559,9 +569,6 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
leftCol: { marginLeft: 4, marginRight: 2 },
|
leftCol: { marginLeft: 4, marginRight: 2 },
|
||||||
rightCol: { marginLeft: 2, marginRight: 4 },
|
rightCol: { marginLeft: 2, marginRight: 4 },
|
||||||
liveRow: {
|
|
||||||
paddingHorizontal: 4,
|
|
||||||
},
|
|
||||||
footer: {
|
footer: {
|
||||||
height: 48,
|
height: 48,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
|||||||
@@ -46,21 +46,27 @@ export function toListRows(pages: VideoItem[][], liveRooms?: LiveRoom[]): ListRo
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (liveRooms && roomIdx < liveRooms.length && pairs.length > 0) {
|
if (liveRooms && liveRooms.length >= 2) {
|
||||||
// const seed = chunk[0]?.aid ?? 0;
|
const a = liveRooms[roomIdx % liveRooms.length];
|
||||||
// const insertAt = seed % (pairs.length + 1);
|
const b = liveRooms[(roomIdx + 1) % liveRooms.length];
|
||||||
// pairs.splice(insertAt, 0, {
|
roomIdx += 2;
|
||||||
// type: 'live',
|
|
||||||
// left: liveRooms[roomIdx],
|
|
||||||
// });
|
|
||||||
// roomIdx++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
if (rows.length < 20) {
|
||||||
if (rows.length < 20) {
|
rows.push({ type: 'big', item: bigItem });
|
||||||
rows.push({ type: 'big', item: bigItem }, ...pairs);
|
rows.push({ type: 'live', left: a, right: b });
|
||||||
|
rows.push(...pairs);
|
||||||
|
} else {
|
||||||
|
rows.push(...pairs);
|
||||||
|
rows.push({ type: 'big', item: bigItem });
|
||||||
|
rows.push({ type: 'live', left: a, right: b });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rows.push(...pairs, { type: 'big', item: bigItem });
|
// No live data, fall back to original logic
|
||||||
|
if (rows.length < 20) {
|
||||||
|
rows.push({ type: 'big', item: bigItem }, ...pairs);
|
||||||
|
} else {
|
||||||
|
rows.push(...pairs, { type: 'big', item: bigItem });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rows;
|
return rows;
|
||||||
|
|||||||
Reference in New Issue
Block a user