修复banner问题

This commit is contained in:
al 2025-01-21 17:37:25 +08:00
parent 58f94ac646
commit 2097e22113
4 changed files with 11 additions and 15 deletions

View File

@ -1,4 +1,4 @@
import { View, Alert, Dimensions, TouchableOpacity } from "react-native";
import { View, Text, Alert, Dimensions, TouchableOpacity } from "react-native";
import React from "react";
import Swiper from "react-native-swiper";
import { Image } from "expo-image";
@ -8,8 +8,8 @@ import { goToPage } from "../../utils/tools";
export default function Banner({
navigation,
banners,
width = Dimensions.get("window").width - 40,
height = ((Dimensions.get("window").width - 40) * 3) / 7,
width = Dimensions.get("window").width - 32,
height = Math.ceil(((Dimensions.get("window").width - 32) * 3) / 7),
}) {
const tailwind = useTailwind();
@ -36,11 +36,11 @@ export default function Banner({
<TouchableOpacity
key={index}
activeOpacity={1}
style={tailwind("w-full h-full")}
style={{ ...tailwind("h-full"), width: "calc(100vw - 5rem)" }}
onPress={() => {
const linkAndParams = goToPage(banner?.link);
const link = banner?.link;
console.log("linkAndParams", linkAndParams);
if (typeof linkAndParams === "string") {
if (
link?.action === "webViewHeaderInward" ||
@ -81,17 +81,16 @@ export default function Banner({
}
}}
>
<View
style={tailwind(
"bg-white w-full h-full rounded-lg overflow-hidden"
)}
>
<View style={tailwind("h-full rounded-lg overflow-hidden")}>
<Image
source={banner.url}
contentFit="cover"
transition={1000}
cachePolicy="disk"
style={tailwind("w-full h-full rounded-lg overflow-hidden")}
style={{
...tailwind("h-full rounded-lg overflow-hidden"),
width: "calc(100vw - 5rem)",
}}
/>
</View>
</TouchableOpacity>

View File

@ -101,14 +101,12 @@ export default function EditSpacePost({ navigation, route }) {
setContent(
paid_text ? text.slice(0, text.length - paid_text.length) : text
);
console.log(paid_text);
setPrice(price ? price / 100 : 0);
setTextVisibleRange(media_visible_range);
setBlurCover(is_blurring_cover === 1);
setIsFreeForIronfan(is_ironfan_visible === 1);
setPaidText(!paid_text ?? paid_text.substring(1));
setIsCreatingPaidText(is_creating_paid_text === 1);
console.log(m_type === 1, media_component.images, media_component.videos);
setOldMediaAssets(
m_type === 1 ? media_component.images : media_component.videos
);

View File

@ -66,7 +66,6 @@ export default function NoticeItem({ navigation, leftIcon, hasLink, data }) {
{!!data?.link_text && (
<TouchableOpacity
onPress={() => {
console.log("此链接已失效", data.is_valid);
if (!data.is_valid) {
Toast.show({
type: "error",

View File

@ -94,7 +94,7 @@ export default function HostList() {
getBannerList();
}, []);
return (
<View style={tailwind("flex-1 px-4")}>
<View style={{ ...tailwind("flex-1"), paddingHorizontal: 16 }}>
<View style={tailwind("flex flex-row justify-between items-center")}>
<Text style={tailwind("text-white text-xl font-medium")}>猜你想看</Text>
<TouchableOpacity