import * as React from "react"; import { View, ImageBackground, ImageSourcePropType, StyleProp, StyleSheet, ViewStyle, } from "react-native"; import { withTheme } from "@draftbit/theme"; import Elevation from "../components/Elevation"; import type { ReadTheme } from "@draftbit/theme"; type ResizeModeType = | "cover" | "contain" | "stretch" | "repeat" | "center" | undefined; type Props = { theme: ReadTheme; useThemeGutterPadding: boolean; borderColor: string; borderWidth: number; backgroundColor: string; backgroundImage?: string | ImageSourcePropType; backgroundImageResizeMode?: ResizeModeType; elevation?: number; style?: StyleProp; children?: React.ReactNode; }; /** * @deprecated DEPRECATED */ const Container: React.FC> = ({ useThemeGutterPadding, borderColor, borderWidth, backgroundColor, backgroundImage, backgroundImageResizeMode, elevation, style, children, theme, ...rest }) => { const { flex, flexGrow, flexWrap, flexBasis, flexShrink, flexDirection, alignContent, justifyContent, alignItems, padding, paddingTop, paddingBottom, paddingLeft, paddingRight, paddingVertical, paddingHorizontal, ...styleProp } = StyleSheet.flatten(style) || {}; const containerStyle: StyleProp = { backgroundColor, borderColor, borderWidth, width: "100%", ...styleProp, }; const innerStyle: StyleProp = { flex, flexGrow, flexWrap, flexBasis, flexShrink, flexDirection, alignContent, justifyContent, alignItems, padding, paddingTop, paddingBottom, paddingLeft, paddingRight, paddingVertical, paddingHorizontal: paddingHorizontal || useThemeGutterPadding ? 16 : 0, }; const Wrap = elevation ? Elevation : View; if (elevation) containerStyle.elevation = elevation; return ( {backgroundImage ? ( {children} ) : ( {children} )} ); }; export default withTheme(Container);