fix landscape slider
This commit is contained in:
@@ -275,6 +275,7 @@ export default function NoticeDetails() {
|
||||
<Stack.Screen
|
||||
options={{
|
||||
title: notice.title,
|
||||
headerShown: !isLandscape,
|
||||
}}
|
||||
/>
|
||||
{isImageLoading ? (
|
||||
@@ -282,7 +283,21 @@ export default function NoticeDetails() {
|
||||
<ActivityIndicator size="large" color="#3b82f6" />
|
||||
</Box>
|
||||
) : (
|
||||
<Box className="sticky top-0 z-10 bg-white">
|
||||
<Box
|
||||
className="sticky top-0 z-10 bg-white"
|
||||
style={
|
||||
isLandscape
|
||||
? {
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
zIndex: 30,
|
||||
}
|
||||
: {}
|
||||
}
|
||||
>
|
||||
<FlatList
|
||||
ref={flatListRef}
|
||||
data={images}
|
||||
@@ -293,6 +308,7 @@ export default function NoticeDetails() {
|
||||
pagingEnabled
|
||||
onViewableItemsChanged={onViewableItemsChanged}
|
||||
viewabilityConfig={viewabilityConfig}
|
||||
style={isLandscape ? { flex: 1 } : {}}
|
||||
renderItem={({ item, index }) => (
|
||||
<View
|
||||
style={{ width: Dimensions.get("window").width }}
|
||||
@@ -300,9 +316,22 @@ export default function NoticeDetails() {
|
||||
>
|
||||
<Image
|
||||
source={item}
|
||||
className="h-auto w-auto rounded-md aspect-[1/1]"
|
||||
// className="h-auto w-auto rounded-md aspect-[1/1]"
|
||||
alt={`Zdjęcie ${index + 1}`}
|
||||
resizeMode={isLandscape ? "cover" : "contain"}
|
||||
renderMode="contain"
|
||||
className={
|
||||
isLandscape
|
||||
? "w-auto h-full" // w landscape - pełny ekran z contain
|
||||
: "h-auto w-auto rounded-md aspect-[1/1]" // w portrait - kwadrat
|
||||
}
|
||||
style={
|
||||
isLandscape
|
||||
? {
|
||||
resizeMode: "contain", // zachowuje naturalne proporcje
|
||||
}
|
||||
: {}
|
||||
}
|
||||
// resizeMode={isLandscape ? "cover" : "contain"}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user