react-native-simi-comps
Version:
Simple Minimal Components for React Native
37 lines • 2.02 kB
JavaScript
import React from "react";
import { View as DefaultView } from "react-native";
import useThemeColor from "../useThemeColor";
export default function View(_a) {
var children = _a.children, style = _a.style, _b = _a.flexed, flexed = _b === void 0 ? false : _b, _c = _a.padded, padded = _c === void 0 ? false : _c, _d = _a.centered, centered = _d === void 0 ? false : _d, _e = _a.bordered, bordered = _e === void 0 ? false : _e, _f = _a.row, row = _f === void 0 ? false : _f, _g = _a.wrap, wrap = _g === void 0 ? false : _g, _h = _a.separate, separate = _h === void 0 ? false : _h, margin = _a.margin, marginHorizontal = _a.marginHorizontal, marginVertical = _a.marginVertical, marginTop = _a.marginTop, marginRight = _a.marginRight, marginBottom = _a.marginBottom, marginLeft = _a.marginLeft;
var backgroundColor = useThemeColor("background");
var borderColor = useThemeColor("border");
var styles = [
{
backgroundColor: backgroundColor,
flex: flexed ? 1 : undefined,
padding: padded ? 16 : undefined,
// eslint-disable-next-line no-nested-ternary
justifyContent: centered
? "center"
: separate
? "space-between"
: "flex-start",
alignItems: centered || row ? "center" : undefined,
borderColor: bordered ? borderColor : undefined,
borderWidth: bordered ? 1 : undefined,
borderRadius: bordered ? 4 : undefined,
flexDirection: row ? "row" : undefined,
flexWrap: wrap ? "wrap" : undefined,
margin: margin,
marginHorizontal: marginHorizontal,
marginVertical: marginVertical,
marginTop: marginTop,
marginRight: marginRight,
marginBottom: marginBottom,
marginLeft: marginLeft
},
style,
];
return React.createElement(DefaultView, { style: styles }, children);
}
//# sourceMappingURL=View.js.map