@kietpt2003/react-native-core-ui
Version:
React Native Core UI components by KietPT
29 lines (28 loc) • 1.25 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import { jsx as _jsx } from "react/jsx-runtime";
import React from 'react';
import { View } from 'react-native';
const Flex = React.forwardRef((_a, ref) => {
var { align, children, flex = 0, gap = 0, justify = 'flex-start', style, vertical = false, wrap = false } = _a, rest = __rest(_a, ["align", "children", "flex", "gap", "justify", "style", "vertical", "wrap"]);
const containerStyle = {
alignItems: align,
flex,
flexDirection: vertical ? 'column' : 'row',
flexWrap: wrap ? 'wrap' : 'nowrap',
gap,
justifyContent: justify,
};
return (_jsx(View, Object.assign({ ref: ref, style: [containerStyle, style] }, rest, { children: children })));
});
Flex.displayName = 'Flex';
export default Flex;