Files
hipmi-mobile/components/_ShareComponent/ViewWrapper.tsx
Bagasbanuna02 3849e03a1a feature home
deskripsi:
- tampilan home
2025-06-26 17:43:47 +08:00

50 lines
1.3 KiB
TypeScript

import { Styles } from "@/styles/global-styles";
import { ImageBackground, ScrollView, View } from "react-native";
import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
interface ViewWrapperProps {
children: React.ReactNode;
withBackground?: boolean;
tabBarComponent?: React.ReactNode;
}
const ViewWrapper = ({
children,
withBackground = false,
tabBarComponent,
}: ViewWrapperProps) => {
const assetBackground = require("../../assets/images/main-background.png");
return (
<SafeAreaProvider>
<SafeAreaView
edges={[
"bottom",
// "top",
]}
style={{
flex: 1,
// paddingTop: StatusBar.currentHeight,
}}
>
<ScrollView contentContainerStyle={{ flexGrow: 1 }}>
{withBackground ? (
<ImageBackground
source={assetBackground}
resizeMode="cover"
style={Styles.imageBackground}
>
<View style={Styles.containerWithBackground}>{children}</View>
</ImageBackground>
) : (
<View style={Styles.container}>{children}</View>
)}
</ScrollView>
{tabBarComponent}
</SafeAreaView>
</SafeAreaProvider>
);
};
export default ViewWrapper;