推荐和关注一次出4个,修改卡片渲染逻辑;相册至少2张图;

This commit is contained in:
yezian 2024-01-08 02:11:42 +08:00
parent fd7eb60be0
commit b85999a68b
5 changed files with 52 additions and 28 deletions

View File

@ -4,7 +4,7 @@ import {
TouchableOpacity,
Image as NativeImage,
} from "react-native";
import React, { memo, useContext } from "react";
import React, { memo, useContext, useMemo } from "react";
import { useTailwind } from "tailwind-rn";
import { Image } from "expo-image";
import { Video, ResizeMode } from "expo-av";
@ -17,6 +17,8 @@ function StreamerCard({ data, screen }) {
const showVideo = useContext(
screen === "feed" ? FeedShowVideoContext : SameCityShowVideoContext
);
const isPlaying = useMemo(() => showVideo.includes(data?.mid), [showVideo]);
const tailwind = useTailwind();
const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk";
@ -56,7 +58,7 @@ function StreamerCard({ data, screen }) {
),
}}
>
{data?.gender === 0 ? (
{data?.gender === 1 ? (
<NativeImage
source={require("../../assets/icon/12DP/female.png")}
/>
@ -107,21 +109,23 @@ function StreamerCard({ data, screen }) {
transition={1000}
placeholder={blurhash}
cachePolicy="disk"
style={tailwind("w-full h-full z-0")}
style={
isPlaying
? tailwind("w-full h-full z-0 absolute")
: tailwind("w-full h-full z-20 absolute")
}
/>
<Video
style={tailwind("z-10 w-full h-full")}
isLooping
shouldPlay={isPlaying}
isMuted
useNativeControls={false}
source={{
uri: data?.shorts?.videos[0]?.urls[0],
}}
resizeMode={ResizeMode.COVER}
/>
{showVideo.includes(data?.mid) && (
<Video
style={tailwind("z-10 absolute w-full h-full")}
isLooping
shouldPlay
isMuted
useNativeControls={false}
source={{
uri: data?.shorts?.videos[0]?.urls[0],
}}
resizeMode={ResizeMode.COVER}
/>
)}
</View>
<View style={tailwind("flex-col flex-1 ml-1")}>
{data?.album?.images.map((item, index) => {

View File

@ -365,7 +365,7 @@ export default function EditStreamerProfile({ navigation, route }) {
if (photos.length === 0 && oldPhotos.length === 0) {
Toast.show({
type: "error",
text1: "请确保相册中至少有张图片",
text1: "请确保相册中至少有2张图片",
topOffset: 60,
});
return;
@ -383,6 +383,16 @@ export default function EditStreamerProfile({ navigation, route }) {
const album = {
image_ids: [...oldPhotosIds, ...newPhotosIds?.image_ids],
};
//2
if (album.image_ids.length < 2) {
Toast.show({
type: "error",
text1: "相册至少需要上传2张照片哦",
topOffset: 60,
});
setIsSubmitting(false);
return;
}
//9
if (album.image_ids.length > 9) {
Toast.show({
@ -804,7 +814,7 @@ export default function EditStreamerProfile({ navigation, route }) {
<Text
style={tailwind("text-xs text-[#FFFFFF80] font-medium")}
>
将在主页展示最多9
将在主页展示29
</Text>
</View>
<View style={tailwind("flex-row flex-wrap")}>

View File

@ -60,7 +60,7 @@ export default function FeedStream() {
//
const [startIndex, setStartIndex] = useState(0);
// ID
const batchSize = 10;
const batchSize = 4;
//
const [data, setData] = useState([]);
const [isEnd, setIsEnd] = useState(true);
@ -188,7 +188,7 @@ export default function FeedStream() {
data={data}
renderItem={renderItem}
estimatedItemSize={352}
initialNumToRender={10}
initialNumToRender={4}
refreshControl={
<RefreshControl
colors={["#FF669E"]}

View File

@ -21,8 +21,8 @@ export default function FollowStream() {
const account = await get("account");
const signature = await generateSignature({
mid: account.mid,
offset: offset,
limit: 10,
offset: 0,
limit: 100,
...base,
});
//mid
@ -35,8 +35,8 @@ export default function FollowStream() {
},
body: JSON.stringify({
mid: account.mid,
offset: offset,
limit: 10,
offset: 0,
limit: 100,
...base,
}),
}
@ -70,7 +70,7 @@ export default function FollowStream() {
const signature = await generateSignature({
mids: followMids,
offset: offset,
limit: 10,
limit: 4,
...base,
});
//
@ -84,7 +84,7 @@ export default function FollowStream() {
body: JSON.stringify({
mids: followMids,
offset: offset,
limit: 10,
limit: 4,
...base,
}),
}
@ -145,7 +145,7 @@ export default function FollowStream() {
data={data}
renderItem={renderItem}
estimatedItemSize={352}
initialNumToRender={10}
initialNumToRender={4}
refreshControl={
<RefreshControl
colors={["#FF669E"]}

View File

@ -298,6 +298,16 @@ export default function StreamerVerificationForm({ navigation, route }) {
text1: "上传失败,请联系客服进行上传",
topOffset: 60,
});
setIsSubmitting(false);
return;
}
if (album.image_ids.length < 2) {
Toast.show({
type: "error",
text1: "相册至少需要上传2张照片哦",
topOffset: 60,
});
setIsSubmitting(false);
return;
}
@ -818,7 +828,7 @@ export default function StreamerVerificationForm({ navigation, route }) {
<Text
style={tailwind("text-xs text-[#FFFFFF80] font-medium")}
>
将在主页展示最多9
将在主页展示29
</Text>
</View>
<MediaPicker