This commit is contained in:
Philip Cesar Garay
2025-07-31 21:25:33 +08:00
parent 5cfbc81e3a
commit 84fc719a10
307 changed files with 46470 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
import React, { useState, useRef, createContext } from "react";
import { View, TouchableOpacity } from "react-native";
import { Motion } from "@legendapp/motion";
import { mainBorderRadius } from "../styles/Style";
import { Palette } from "../styles";
export const BottomSheetContext = createContext();
export default ({ children }) => {
const [showSheet, setShowSheet] = useState(false);
const [sheetContent, setSheetContent] = useState(null);
const bottomSheetRef = useRef();
return (
<BottomSheetContext.Provider
value={{ showSheet, setShowSheet, setSheetContent }}
>
{children}
{showSheet && (
<Motion.View
initial={{ scale: 0.9, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
exit={{ scale: 0.9, opacity: 0 }}
style={{
position: "fixed",
right: 0,
top: 0,
left: 0,
bottom: 0,
flex: 1,
zIndex: 1000000,
justifyContent: "center",
alignItems: "center",
}}
>
<TouchableOpacity
onPress={() => setShowSheet(false)}
ref={bottomSheetRef}
style={{
position: "absolute",
right: 0,
top: 0,
left: 0,
bottom: 0,
flex: 1,
backgroundColor: "rgba(0,0,0,0.4)",
}}
/>
<View
style={{
width: "70%",
height: "auto",
maxWidth: 500,
maxHeight: "60vh",
minHeight: 400,
alignSelf: "center",
backgroundColor: Palette.lightPurple,
position: "absolute",
overflow: "scroll",
borderRadius: mainBorderRadius,
}}
>
{sheetContent}
</View>
</Motion.View>
)}
</BottomSheetContext.Provider>
);
};