Skip to content

Commit 547a4fd

Browse files
authored
feat(mobile): lightbox (#3882)
* feat(mobile): lightbox * chore: auto-fix linting and formatting issues * feat: enhance back handler to close lightbox when active * feat: integrate Lightbox component and move SafeAreaProvider to RootProviders * refactor: update renderItem function to use destructured props * feat: add Android manifest plugin to enable large heap size * fix: add rounded corners to AspectRatioImage * feat: set priority to high for image loading in ImageItem component * chore: remove unused zIndex from ImageViewing * feat: update ImageDefaultHeader and LightboxFooter for improved layout * chore: simplify renderItem function signature in PagerList and Subscriptions components * refactor: update galeria * chore: tweak component * feat: integrate lightbox functionality for media previews
1 parent 8d6489f commit 547a4fd

File tree

23 files changed

+2081
-65
lines changed

23 files changed

+2081
-65
lines changed

apps/mobile/app.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
131131
],
132132

133133
require("./plugins/with-gradle-jvm-heap-size-increase.js"),
134+
require("./plugins/with-android-manifest-plugin.js"),
134135
"expo-secure-store",
135136
"@react-native-firebase/app",
136137
"@react-native-firebase/crashlytics",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const { withAndroidManifest } = require("expo/config-plugins")
2+
3+
// Ported from https://github.com/bluesky-social/social-app/blob/a5e25a7a16cdcde64628e942c073a119bc1d7a1e/plugins/withAndroidManifestPlugin.js
4+
module.exports = function withAndroidManifestPlugin(appConfig) {
5+
return withAndroidManifest(appConfig, (decoratedAppConfig) => {
6+
try {
7+
decoratedAppConfig.modResults.manifest.application[0].$["android:largeHeap"] = "true"
8+
} catch (e) {
9+
console.error(`withAndroidManifestPlugin failed`, e)
10+
}
11+
return decoratedAppConfig
12+
})
13+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright (c) JOB TODAY S.A. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
9+
import type { TransformsStyle } from "react-native"
10+
import type { MeasuredDimensions } from "react-native-reanimated"
11+
12+
export type Dimensions = {
13+
width: number
14+
height: number
15+
}
16+
17+
export type Position = {
18+
x: number
19+
y: number
20+
}
21+
22+
export type ImageSource = {
23+
uri: string
24+
dimensions: Dimensions | null
25+
thumbUri: string
26+
thumbDimensions: Dimensions | null
27+
thumbRect: MeasuredDimensions | null
28+
alt?: string
29+
type: "image" | "circle-avi" | "rect-avi"
30+
}
31+
32+
export type Transform = Exclude<TransformsStyle["transform"], string | undefined>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* Copyright (c) JOB TODAY S.A. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
import type { ViewStyle } from "react-native"
9+
import { StyleSheet, TouchableOpacity, View } from "react-native"
10+
import { useSafeAreaInsets } from "react-native-safe-area-context"
11+
12+
import { CloseCuteReIcon } from "@/src/icons/close_cute_re"
13+
14+
type Props = {
15+
onRequestClose: () => void
16+
}
17+
18+
const ImageDefaultHeader = ({ onRequestClose }: Props) => {
19+
const insets = useSafeAreaInsets()
20+
return (
21+
<View style={[styles.root, { marginTop: insets.top, marginRight: insets.right }]}>
22+
<TouchableOpacity
23+
style={[styles.closeButton, styles.blurredBackground]}
24+
onPress={onRequestClose}
25+
hitSlop={16}
26+
accessibilityRole="button"
27+
accessibilityLabel={`Close image`}
28+
accessibilityHint={`Closes viewer for header image`}
29+
onAccessibilityEscape={onRequestClose}
30+
>
31+
<CloseCuteReIcon color="#fff" />
32+
</TouchableOpacity>
33+
</View>
34+
)
35+
}
36+
37+
const styles = StyleSheet.create({
38+
root: {
39+
alignItems: "flex-end",
40+
pointerEvents: "box-none",
41+
},
42+
closeButton: {
43+
marginRight: 10,
44+
marginTop: 10,
45+
width: 44,
46+
height: 44,
47+
alignItems: "center",
48+
justifyContent: "center",
49+
borderRadius: 22,
50+
backgroundColor: "#00000077",
51+
},
52+
blurredBackground: {
53+
backdropFilter: "blur(10px)",
54+
WebkitBackdropFilter: "blur(10px)",
55+
} as ViewStyle,
56+
})
57+
58+
export default ImageDefaultHeader

0 commit comments

Comments
 (0)