Skip to content

Commit 875c6a4

Browse files
authored
fix: image gallery header and footer safe area view (#2840)
1 parent abbcdf8 commit 875c6a4

File tree

2 files changed

+37
-38
lines changed

2 files changed

+37
-38
lines changed

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

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ export const ImageGalleryFooterWithContext = <
154154
};
155155

156156
return (
157-
<View
157+
<SafeAreaView
158158
accessibilityLabel={accessibilityLabel}
159159
onLayout={(event) => setHeight(event.nativeEvent.layout.height)}
160160
pointerEvents={'box-none'}
161161
style={styles.wrapper}
162162
>
163163
<Animated.View style={footerStyle}>
164-
<SafeAreaView style={[{ backgroundColor: white }, container]}>
164+
<View style={[{ backgroundColor: white }, container]}>
165165
{photo.type === FileTypes.Video ? (
166166
videoControlElement ? (
167167
videoControlElement({ duration, onPlayPause, paused, progress, videoRef })
@@ -175,37 +175,37 @@ export const ImageGalleryFooterWithContext = <
175175
/>
176176
)
177177
) : null}
178-
<View style={[styles.innerContainer, { backgroundColor: white }, innerContainer]}>
179-
{leftElement ? (
180-
leftElement({ openGridView, photo, share, shareMenuOpen })
181-
) : (
182-
<ShareButton share={share} ShareIcon={ShareIcon} shareMenuOpen={shareMenuOpen} />
183-
)}
184-
{centerElement ? (
185-
centerElement({ openGridView, photo, share, shareMenuOpen })
186-
) : (
187-
<View style={[styles.centerContainer, centerContainer]}>
188-
<Text style={[styles.imageCountText, { color: black }, imageCountText]}>
189-
{t<string>('{{ index }} of {{ photoLength }}', {
190-
index: photoLength - selectedIndex,
191-
photoLength,
192-
})}
193-
</Text>
178+
</View>
179+
<View style={[styles.innerContainer, { backgroundColor: white }, innerContainer]}>
180+
{leftElement ? (
181+
leftElement({ openGridView, photo, share, shareMenuOpen })
182+
) : (
183+
<ShareButton share={share} ShareIcon={ShareIcon} shareMenuOpen={shareMenuOpen} />
184+
)}
185+
{centerElement ? (
186+
centerElement({ openGridView, photo, share, shareMenuOpen })
187+
) : (
188+
<View style={[styles.centerContainer, centerContainer]}>
189+
<Text style={[styles.imageCountText, { color: black }, imageCountText]}>
190+
{t<string>('{{ index }} of {{ photoLength }}', {
191+
index: photoLength - selectedIndex,
192+
photoLength,
193+
})}
194+
</Text>
195+
</View>
196+
)}
197+
{rightElement ? (
198+
rightElement({ openGridView, photo, share, shareMenuOpen })
199+
) : (
200+
<TouchableOpacity onPress={openGridView}>
201+
<View style={[styles.rightContainer, rightContainer]}>
202+
{GridIcon ? GridIcon : <GridIconDefault />}
194203
</View>
195-
)}
196-
{rightElement ? (
197-
rightElement({ openGridView, photo, share, shareMenuOpen })
198-
) : (
199-
<TouchableOpacity onPress={openGridView}>
200-
<View style={[styles.rightContainer, rightContainer]}>
201-
{GridIcon ? GridIcon : <GridIconDefault />}
202-
</View>
203-
</TouchableOpacity>
204-
)}
205-
</View>
206-
</SafeAreaView>
204+
</TouchableOpacity>
205+
)}
206+
</View>
207207
</Animated.View>
208-
</View>
208+
</SafeAreaView>
209209
);
210210
};
211211

@@ -300,7 +300,7 @@ const styles = StyleSheet.create({
300300
},
301301
innerContainer: {
302302
flexDirection: 'row',
303-
height: 56,
303+
paddingVertical: 4,
304304
},
305305
leftContainer: {
306306
flex: 1,

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ export const ImageGalleryHeader = <
9393
};
9494

9595
return (
96-
<View
96+
<SafeAreaView
9797
onLayout={(event) => setHeight(event.nativeEvent.layout.height)}
9898
pointerEvents={'box-none'}
9999
>
100100
<Animated.View style={headerStyle}>
101-
<SafeAreaView style={[styles.container, { backgroundColor: white }, container]}>
101+
<View style={[styles.container, { backgroundColor: white }, container]}>
102102
{leftElement ? (
103103
leftElement({ hideOverlay, photo })
104104
) : (
@@ -123,9 +123,9 @@ export const ImageGalleryHeader = <
123123
) : (
124124
<View style={[styles.rightContainer, rightContainer]} />
125125
)}
126-
</SafeAreaView>
126+
</View>
127127
</Animated.View>
128-
</View>
128+
</SafeAreaView>
129129
);
130130
};
131131

@@ -140,12 +140,11 @@ const styles = StyleSheet.create({
140140
container: {
141141
flexDirection: 'row',
142142
justifyContent: 'space-between',
143-
paddingVertical: 4,
143+
paddingVertical: 8,
144144
},
145145
date: {
146146
fontSize: 12,
147147
fontWeight: '500',
148-
marginBottom: 8,
149148
opacity: 0.5,
150149
},
151150
leftContainer: {

0 commit comments

Comments
 (0)