fix landscape slider
This commit is contained in:
@@ -275,6 +275,7 @@ export default function NoticeDetails() {
|
|||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
title: notice.title,
|
title: notice.title,
|
||||||
|
headerShown: !isLandscape,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{isImageLoading ? (
|
{isImageLoading ? (
|
||||||
@@ -282,7 +283,21 @@ export default function NoticeDetails() {
|
|||||||
<ActivityIndicator size="large" color="#3b82f6" />
|
<ActivityIndicator size="large" color="#3b82f6" />
|
||||||
</Box>
|
</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
|
<FlatList
|
||||||
ref={flatListRef}
|
ref={flatListRef}
|
||||||
data={images}
|
data={images}
|
||||||
@@ -293,6 +308,7 @@ export default function NoticeDetails() {
|
|||||||
pagingEnabled
|
pagingEnabled
|
||||||
onViewableItemsChanged={onViewableItemsChanged}
|
onViewableItemsChanged={onViewableItemsChanged}
|
||||||
viewabilityConfig={viewabilityConfig}
|
viewabilityConfig={viewabilityConfig}
|
||||||
|
style={isLandscape ? { flex: 1 } : {}}
|
||||||
renderItem={({ item, index }) => (
|
renderItem={({ item, index }) => (
|
||||||
<View
|
<View
|
||||||
style={{ width: Dimensions.get("window").width }}
|
style={{ width: Dimensions.get("window").width }}
|
||||||
@@ -300,9 +316,22 @@ export default function NoticeDetails() {
|
|||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
source={item}
|
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}`}
|
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>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user