Skip to content

Commit b682bd5

Browse files
committed
fix: bring back animations for opening and closing of the gallery header/footer
1 parent 6469f4b commit b682bd5

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

package/src/components/ImageGallery/components/ImageGalleryFooter.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import {
2121
VideoType,
2222
} from '../../../native';
2323

24+
const ReanimatedSafeAreaView = Animated.createAnimatedComponent
25+
? Animated.createAnimatedComponent(SafeAreaView)
26+
: SafeAreaView;
27+
2428
import { DefaultStreamChatGenerics, FileTypes } from '../../../types/types';
2529
import type { Photo } from '../ImageGallery';
2630

@@ -160,7 +164,7 @@ export const ImageGalleryFooterWithContext = <
160164
pointerEvents={'box-none'}
161165
style={styles.wrapper}
162166
>
163-
<SafeAreaView style={[{ backgroundColor: white }, container, footerStyle]}>
167+
<ReanimatedSafeAreaView style={[{ backgroundColor: white }, footerStyle, container]}>
164168
{photo.type === FileTypes.Video ? (
165169
videoControlElement ? (
166170
videoControlElement({ duration, onPlayPause, paused, progress, videoRef })
@@ -202,7 +206,7 @@ export const ImageGalleryFooterWithContext = <
202206
</TouchableOpacity>
203207
)}
204208
</View>
205-
</SafeAreaView>
209+
</ReanimatedSafeAreaView>
206210
</Animated.View>
207211
);
208212
};

package/src/components/ImageGallery/components/ImageGalleryHeader.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import React, { useMemo, useState } from 'react';
22
import { Pressable, SafeAreaView, StyleSheet, Text, View, ViewStyle } from 'react-native';
3-
import { Extrapolation, interpolate, SharedValue, useAnimatedStyle } from 'react-native-reanimated';
3+
import Animated, {
4+
Extrapolation,
5+
interpolate,
6+
SharedValue,
7+
useAnimatedStyle,
8+
} from 'react-native-reanimated';
49

510
import { useOverlayContext } from '../../../contexts/overlayContext/OverlayContext';
611
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
@@ -11,6 +16,10 @@ import type { DefaultStreamChatGenerics } from '../../../types/types';
1116
import { getDateString } from '../../../utils/i18n/getDateString';
1217
import type { Photo } from '../ImageGallery';
1318

19+
const ReanimatedSafeAreaView = Animated.createAnimatedComponent
20+
? Animated.createAnimatedComponent(SafeAreaView)
21+
: SafeAreaView;
22+
1423
export type ImageGalleryHeaderCustomComponent<
1524
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
1625
> = ({
@@ -93,7 +102,7 @@ export const ImageGalleryHeader = <
93102
onLayout={(event) => setHeight(event.nativeEvent.layout.height)}
94103
pointerEvents={'box-none'}
95104
>
96-
<SafeAreaView style={[{ backgroundColor: white }, container, headerStyle]}>
105+
<ReanimatedSafeAreaView style={[{ backgroundColor: white }, headerStyle, container]}>
97106
<View style={[styles.innerContainer, innerContainer]}>
98107
{leftElement ? (
99108
leftElement({ hideOverlay, photo })
@@ -120,7 +129,7 @@ export const ImageGalleryHeader = <
120129
<View style={[styles.rightContainer, rightContainer]} />
121130
)}
122131
</View>
123-
</SafeAreaView>
132+
</ReanimatedSafeAreaView>
124133
</View>
125134
);
126135
};

0 commit comments

Comments
 (0)