推荐和关注一次出4个,修改卡片渲染逻辑;相册至少2张图;
This commit is contained in:
parent
fd7eb60be0
commit
b85999a68b
|
@ -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) => {
|
||||
|
|
|
@ -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张)
|
||||
将在“主页”展示(2~9张)
|
||||
</Text>
|
||||
</View>
|
||||
<View style={tailwind("flex-row flex-wrap")}>
|
||||
|
|
|
@ -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"]}
|
||||
|
|
|
@ -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"]}
|
||||
|
|
|
@ -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张)
|
||||
将在“主页”展示(2~9张)
|
||||
</Text>
|
||||
</View>
|
||||
<MediaPicker
|
||||
|
|
Loading…
Reference in New Issue