修改没开会员时对动态的模糊程度;修复动态的media_component为null时报错的问题
This commit is contained in:
parent
38b44979c1
commit
b86bf9fe9e
|
@ -6,6 +6,7 @@ import {
|
||||||
TouchableWithoutFeedback,
|
TouchableWithoutFeedback,
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Image as NativeImage,
|
Image as NativeImage,
|
||||||
|
Platform,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTailwind } from "tailwind-rn";
|
import { useTailwind } from "tailwind-rn";
|
||||||
|
@ -14,7 +15,7 @@ import ImageViewer from "react-native-image-zoom-viewer";
|
||||||
import VideoModal from "../VideoModal";
|
import VideoModal from "../VideoModal";
|
||||||
import { useNavigation } from "@react-navigation/native";
|
import { useNavigation } from "@react-navigation/native";
|
||||||
import formatTimestamp from "../../utils/formatTimestamp";
|
import formatTimestamp from "../../utils/formatTimestamp";
|
||||||
import { follow, unfollow, block } from "../../utils/relation";
|
import { follow, unfollow } from "../../utils/relation";
|
||||||
import baseRequest from "../../utils/baseRequest";
|
import baseRequest from "../../utils/baseRequest";
|
||||||
import { generateSignature } from "../../utils/crypto";
|
import { generateSignature } from "../../utils/crypto";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
@ -87,63 +88,6 @@ export default function Post({ blur, data }) {
|
||||||
follow(account.mid, data.mid);
|
follow(account.mid, data.mid);
|
||||||
};
|
};
|
||||||
|
|
||||||
//拉黑、举报组件
|
|
||||||
// const [operationOpen, setOperationOpen] = useState(false);
|
|
||||||
// const Operation = () => {
|
|
||||||
// const handleFeedback = () => {
|
|
||||||
// navigation.navigate("MessageDetail", { mid: 1 });
|
|
||||||
// setOperationOpen(false);
|
|
||||||
// };
|
|
||||||
// const handleBlock = async () => {
|
|
||||||
// const account = await get("account");
|
|
||||||
// const subMid = account.mid;
|
|
||||||
// const objMid = data.mid;
|
|
||||||
// await block(subMid, objMid);
|
|
||||||
// setOperationOpen(false);
|
|
||||||
// };
|
|
||||||
// return (
|
|
||||||
// <View style={tailwind("absolute right-4 top-2")}>
|
|
||||||
// <Icon
|
|
||||||
// type="ionicon"
|
|
||||||
// name="ellipsis-vertical"
|
|
||||||
// size={32}
|
|
||||||
// color="white"
|
|
||||||
// onPress={() => setOperationOpen(true)}
|
|
||||||
// />
|
|
||||||
// {operationOpen && (
|
|
||||||
// <TouchableWithoutFeedback onPress={() => setOperationOpen(false)}>
|
|
||||||
// <View
|
|
||||||
// style={{
|
|
||||||
// ...tailwind("items-center bg-white rounded-lg p-2"),
|
|
||||||
// }}
|
|
||||||
// >
|
|
||||||
// <TouchableOpacity
|
|
||||||
// onPress={handleBlock}
|
|
||||||
// style={tailwind("flex-row items-center px-4")}
|
|
||||||
// >
|
|
||||||
// <Icon
|
|
||||||
// type="ionicon"
|
|
||||||
// name="remove-circle"
|
|
||||||
// color="#f87171"
|
|
||||||
// size={24}
|
|
||||||
// />
|
|
||||||
// <Text style={tailwind("text-base")}>拉黑</Text>
|
|
||||||
// </TouchableOpacity>
|
|
||||||
// <Divider style={tailwind("w-full my-2")} />
|
|
||||||
// <TouchableOpacity
|
|
||||||
// onPress={handleFeedback}
|
|
||||||
// style={tailwind("flex-row items-center px-4")}
|
|
||||||
// >
|
|
||||||
// <Icon type="ionicon" name="warning" color="#60a5fa" size={24} />
|
|
||||||
// <Text style={tailwind("text-base")}>举报</Text>
|
|
||||||
// </TouchableOpacity>
|
|
||||||
// </View>
|
|
||||||
// </TouchableWithoutFeedback>
|
|
||||||
// )}
|
|
||||||
// </View>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={tailwind("flex flex-col")}>
|
<View style={tailwind("flex flex-col")}>
|
||||||
<View style={tailwind("flex pt-3.5 pb-1.5 pl-3.5")}>
|
<View style={tailwind("flex pt-3.5 pb-1.5 pl-3.5")}>
|
||||||
|
@ -192,8 +136,12 @@ export default function Post({ blur, data }) {
|
||||||
</Text>
|
</Text>
|
||||||
{/* 媒体展示 */}
|
{/* 媒体展示 */}
|
||||||
<View style={tailwind("pr-10 mb-1")}>
|
<View style={tailwind("pr-10 mb-1")}>
|
||||||
{data.media_component.video_ids.length === 0 ? (
|
{data.media_component.video_ids?.length === 0 ||
|
||||||
<ImageDisplay blur={blur} media={data.media_component.images} />
|
data.media_component.video_ids === null ? (
|
||||||
|
<ImageDisplay
|
||||||
|
blur={blur}
|
||||||
|
media={data.media_component?.images}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
activeOpacity={1}
|
activeOpacity={1}
|
||||||
|
@ -246,7 +194,7 @@ export default function Post({ blur, data }) {
|
||||||
<Text
|
<Text
|
||||||
style={tailwind("mx-1 text-sm font-medium text-[#FF669E]")}
|
style={tailwind("mx-1 text-sm font-medium text-[#FF669E]")}
|
||||||
>
|
>
|
||||||
开通会员永久看动态
|
会员永久查看所有动态
|
||||||
</Text>
|
</Text>
|
||||||
<NativeImage
|
<NativeImage
|
||||||
source={require("../../assets/icon/others/pinklink.png")}
|
source={require("../../assets/icon/others/pinklink.png")}
|
||||||
|
@ -296,6 +244,7 @@ function ImageDisplay({ blur, media }) {
|
||||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||||
const [imageIndex, setImageIndex] = useState();
|
const [imageIndex, setImageIndex] = useState();
|
||||||
const images = media.map((item) => ({ url: item.urls[0] }));
|
const images = media.map((item) => ({ url: item.urls[0] }));
|
||||||
|
if (images.length === 0) return null;
|
||||||
return (
|
return (
|
||||||
<View style={tailwind("flex flex-row flex-wrap")}>
|
<View style={tailwind("flex flex-row flex-wrap")}>
|
||||||
{media.length > 1 ? (
|
{media.length > 1 ? (
|
||||||
|
@ -318,7 +267,7 @@ function ImageDisplay({ blur, media }) {
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
style={tailwind("w-full h-full rounded")}
|
style={tailwind("w-full h-full rounded")}
|
||||||
blurRadius={blur ? 75 : 0}
|
blurRadius={blur ? (Platform.OS === "ios" ? 130 : 7) : 0}
|
||||||
source={item.urls[0]}
|
source={item.urls[0]}
|
||||||
placeholder={blurhash}
|
placeholder={blurhash}
|
||||||
contentFit="cover"
|
contentFit="cover"
|
||||||
|
@ -350,7 +299,7 @@ function ImageDisplay({ blur, media }) {
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
style={tailwind("w-full h-full rounded")}
|
style={tailwind("w-full h-full rounded")}
|
||||||
blurRadius={blur ? 75 : 0}
|
blurRadius={blur ? (Platform.OS === "ios" ? 130 : 7) : 0}
|
||||||
source={media[0].urls[0]}
|
source={media[0].urls[0]}
|
||||||
placeholder={blurhash}
|
placeholder={blurhash}
|
||||||
contentFit="contain"
|
contentFit="contain"
|
||||||
|
@ -393,7 +342,7 @@ function PosterDisplay({ blur, media }) {
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
style={tailwind("w-full h-full rounded")}
|
style={tailwind("w-full h-full rounded")}
|
||||||
blurRadius={blur ? 75 : 0}
|
blurRadius={blur ? (Platform.OS === "ios" ? 130 : 7) : 0}
|
||||||
source={media.cover_urls[0]}
|
source={media.cover_urls[0]}
|
||||||
placeholder={blurhash}
|
placeholder={blurhash}
|
||||||
contentFit="cover"
|
contentFit="cover"
|
||||||
|
|
Loading…
Reference in New Issue