Live video on the AT Protocol
1import { Text, zero } from "@streamplace/components";
2import { Pressable, View, ViewStyle } from "react-native";
3
4interface PopupProps {
5 onClose: () => void;
6 onPress?: () => void;
7 containerProps: { style?: ViewStyle };
8 bubbleProps: { style?: ViewStyle };
9 children: React.ReactNode;
10}
11
12export default function Popup({
13 onClose,
14 containerProps,
15 bubbleProps,
16 children,
17 onPress,
18}: PopupProps) {
19 return (
20 <View
21 style={[
22 { position: "absolute" },
23 zero.bottom[32],
24 zero.flex.values[1],
25 { alignItems: "center" },
26 zero.w.percent[100],
27 { backgroundColor: "blue", height: 0 },
28 containerProps.style,
29 ]}
30 >
31 <Pressable
32 style={[
33 zero.flex.values[1],
34 { alignSelf: "stretch" },
35 zero.p[4],
36 zero.r.lg,
37 { position: "absolute" },
38 zero.bottom[0],
39 {
40 boxShadow: "0 0 10px 0 rgba(0, 0, 0, 0.1)",
41 elevation: 5, // Android shadow
42 },
43 bubbleProps.style,
44 ]}
45 onPress={() => {
46 if (onPress) {
47 onPress();
48 }
49 }}
50 >
51 <Pressable
52 style={[
53 { position: "absolute" },
54 zero.top[0],
55 zero.right[0],
56 { marginRight: -15, marginTop: -5 },
57 zero.bg.transparent,
58 zero.p[2],
59 ]}
60 onPress={(e) => {
61 e.stopPropagation();
62 onClose();
63 }}
64 >
65 <Text style={[{ fontSize: 18 }]}>✕</Text>
66 </Pressable>
67 {children}
68 </Pressable>
69 </View>
70 );
71}