Skip to content

Commit

Permalink
fix: image gallery header and footer safe area view (#2840)
Browse files Browse the repository at this point in the history
  • Loading branch information
khushal87 authored Dec 11, 2024
1 parent abbcdf8 commit 875c6a4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ export const ImageGalleryFooterWithContext = <
};

return (
<View
<SafeAreaView
accessibilityLabel={accessibilityLabel}
onLayout={(event) => setHeight(event.nativeEvent.layout.height)}
pointerEvents={'box-none'}
style={styles.wrapper}
>
<Animated.View style={footerStyle}>
<SafeAreaView style={[{ backgroundColor: white }, container]}>
<View style={[{ backgroundColor: white }, container]}>
{photo.type === FileTypes.Video ? (
videoControlElement ? (
videoControlElement({ duration, onPlayPause, paused, progress, videoRef })
Expand All @@ -175,37 +175,37 @@ export const ImageGalleryFooterWithContext = <
/>
)
) : null}
<View style={[styles.innerContainer, { backgroundColor: white }, innerContainer]}>
{leftElement ? (
leftElement({ openGridView, photo, share, shareMenuOpen })
) : (
<ShareButton share={share} ShareIcon={ShareIcon} shareMenuOpen={shareMenuOpen} />
)}
{centerElement ? (
centerElement({ openGridView, photo, share, shareMenuOpen })
) : (
<View style={[styles.centerContainer, centerContainer]}>
<Text style={[styles.imageCountText, { color: black }, imageCountText]}>
{t<string>('{{ index }} of {{ photoLength }}', {
index: photoLength - selectedIndex,
photoLength,
})}
</Text>
</View>
<View style={[styles.innerContainer, { backgroundColor: white }, innerContainer]}>
{leftElement ? (
leftElement({ openGridView, photo, share, shareMenuOpen })
) : (
<ShareButton share={share} ShareIcon={ShareIcon} shareMenuOpen={shareMenuOpen} />
)}
{centerElement ? (
centerElement({ openGridView, photo, share, shareMenuOpen })
) : (
<View style={[styles.centerContainer, centerContainer]}>
<Text style={[styles.imageCountText, { color: black }, imageCountText]}>
{t<string>('{{ index }} of {{ photoLength }}', {
index: photoLength - selectedIndex,
photoLength,
})}
</Text>
</View>
)}
{rightElement ? (
rightElement({ openGridView, photo, share, shareMenuOpen })
) : (
<TouchableOpacity onPress={openGridView}>
<View style={[styles.rightContainer, rightContainer]}>
{GridIcon ? GridIcon : <GridIconDefault />}
</View>
)}
{rightElement ? (
rightElement({ openGridView, photo, share, shareMenuOpen })
) : (
<TouchableOpacity onPress={openGridView}>
<View style={[styles.rightContainer, rightContainer]}>
{GridIcon ? GridIcon : <GridIconDefault />}
</View>
</TouchableOpacity>
)}
</View>
</SafeAreaView>
</TouchableOpacity>
)}
</View>
</Animated.View>
</View>
</SafeAreaView>
);
};

Expand Down Expand Up @@ -300,7 +300,7 @@ const styles = StyleSheet.create({
},
innerContainer: {
flexDirection: 'row',
height: 56,
paddingVertical: 4,
},
leftContainer: {
flex: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ export const ImageGalleryHeader = <
};

return (
<View
<SafeAreaView
onLayout={(event) => setHeight(event.nativeEvent.layout.height)}
pointerEvents={'box-none'}
>
<Animated.View style={headerStyle}>
<SafeAreaView style={[styles.container, { backgroundColor: white }, container]}>
<View style={[styles.container, { backgroundColor: white }, container]}>
{leftElement ? (
leftElement({ hideOverlay, photo })
) : (
Expand All @@ -123,9 +123,9 @@ export const ImageGalleryHeader = <
) : (
<View style={[styles.rightContainer, rightContainer]} />
)}
</SafeAreaView>
</View>
</Animated.View>
</View>
</SafeAreaView>
);
};

Expand All @@ -140,12 +140,11 @@ const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingVertical: 4,
paddingVertical: 8,
},
date: {
fontSize: 12,
fontWeight: '500',
marginBottom: 8,
opacity: 0.5,
},
leftContainer: {
Expand Down

0 comments on commit 875c6a4

Please sign in to comment.