@kietpt2003/react-native-core-ui
Version:
React Native Core UI components by KietPT
42 lines (41 loc) • 1.6 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, StyleSheet, } from 'react-native';
const CardActions = React.forwardRef(function CardActions(props, ref) {
const { children, disableSpacing = false, style } = props, other = __rest(props, ["children", "disableSpacing", "style"]);
const childrenArray = React.Children.toArray(children);
return (_jsx(View, Object.assign({ ref: ref, style: [
styles.root,
style,
] }, other, { children: childrenArray.map((child, index) => {
if (!React.isValidElement(child))
return child;
const spacingStyle = !disableSpacing && index > 0
? styles.spacing
: null;
return (_jsx(View, { style: spacingStyle, children: child }, index));
}) })));
});
CardActions.displayName = 'CardActions';
const styles = StyleSheet.create({
root: {
flexDirection: 'row',
alignItems: 'center',
padding: 8,
},
spacing: {
marginLeft: 8,
},
});
export default CardActions;