|
|
@@ -13,7 +13,7 @@ import { Colors } from 'src/theme';
|
|
|
import { CustomImageViewer } from 'src/components';
|
|
|
|
|
|
export const PhotoItem = React.memo(
|
|
|
- ({ item, allRegions }: { item: any; allRegions: AllRegions[] }) => {
|
|
|
+ ({ item, allRegions, cacheBuster }: { item: any; allRegions: AllRegions[]; cacheBuster?: number }) => {
|
|
|
const navigation = useNavigation();
|
|
|
const [currentImageIndex, setCurrentImageIndex] = useState(0);
|
|
|
const [isViewerVisible, setIsViewerVisible] = useState(false);
|
|
|
@@ -25,13 +25,16 @@ export const PhotoItem = React.memo(
|
|
|
};
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ const bustParam = cacheBuster ? `?t=${cacheBuster}` : '';
|
|
|
setFullImages(
|
|
|
item.photos.map((photo: PhotosData) => ({
|
|
|
...photo,
|
|
|
- uri: API_HOST + photo.url_mid
|
|
|
+ uri: API_HOST + photo.url_mid + bustParam
|
|
|
}))
|
|
|
);
|
|
|
- }, [item]);
|
|
|
+ }, [item, cacheBuster]);
|
|
|
+
|
|
|
+ const bustParam = cacheBuster ? `?t=${cacheBuster}` : '';
|
|
|
|
|
|
const renderPhotos = () => {
|
|
|
const photos = item.photos.slice(0, 3);
|
|
|
@@ -41,7 +44,7 @@ export const PhotoItem = React.memo(
|
|
|
return (
|
|
|
<TouchableOpacity onPress={() => openImageViewer(0)}>
|
|
|
<Image
|
|
|
- source={{ uri: getImageUri(photos[0].url_small), cache: 'reload' }}
|
|
|
+ source={{ uri: getImageUri(photos[0].url_small) + bustParam, cache: 'reload' }}
|
|
|
style={photoStyles.onePhoto}
|
|
|
/>
|
|
|
</TouchableOpacity>
|
|
|
@@ -50,7 +53,7 @@ export const PhotoItem = React.memo(
|
|
|
return photos.map((photo: PhotosData, index: number) => (
|
|
|
<TouchableOpacity key={photo.id} onPress={() => openImageViewer(index)}>
|
|
|
<Image
|
|
|
- source={{ uri: getImageUri(photo.url_small), cache: 'reload' }}
|
|
|
+ source={{ uri: getImageUri(photo.url_small) + bustParam, cache: 'reload' }}
|
|
|
style={[photoStyles.twoPhotos, index === 0 && { marginRight: 8 }]}
|
|
|
/>
|
|
|
</TouchableOpacity>
|
|
|
@@ -60,7 +63,7 @@ export const PhotoItem = React.memo(
|
|
|
<View style={{ flexDirection: 'row' }}>
|
|
|
<TouchableOpacity onPress={() => openImageViewer(0)}>
|
|
|
<Image
|
|
|
- source={{ uri: getImageUri(photos[0].url_small), cache: 'reload' }}
|
|
|
+ source={{ uri: getImageUri(photos[0].url_small) + bustParam, cache: 'reload' }}
|
|
|
style={photoStyles.bigPhoto}
|
|
|
/>
|
|
|
</TouchableOpacity>
|
|
|
@@ -68,13 +71,13 @@ export const PhotoItem = React.memo(
|
|
|
<View style={styles.smallPhotoContainer}>
|
|
|
<TouchableOpacity onPress={() => openImageViewer(1)}>
|
|
|
<Image
|
|
|
- source={{ uri: getImageUri(photos[1].url_small), cache: 'reload' }}
|
|
|
+ source={{ uri: getImageUri(photos[1].url_small) + bustParam, cache: 'reload' }}
|
|
|
style={photoStyles.smallPhoto}
|
|
|
/>
|
|
|
</TouchableOpacity>
|
|
|
<TouchableOpacity onPress={() => openImageViewer(2)}>
|
|
|
<Image
|
|
|
- source={{ uri: getImageUri(photos[2].url_small), cache: 'reload' }}
|
|
|
+ source={{ uri: getImageUri(photos[2].url_small) + bustParam, cache: 'reload' }}
|
|
|
style={[photoStyles.smallPhoto, { position: 'relative' }]}
|
|
|
/>
|
|
|
</TouchableOpacity>
|
|
|
@@ -95,7 +98,7 @@ export const PhotoItem = React.memo(
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const photoViews = useMemo(() => renderPhotos(), [item.photos]);
|
|
|
+ const photoViews = useMemo(() => renderPhotos(), [item.photos, cacheBuster]);
|
|
|
|
|
|
const handlePress = useCallback(() => {
|
|
|
navigation.navigate(
|