@paraboly/react-native-card
Version:
Fully customizable Card View for React Native.
40 lines • 2.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_native_1 = require("react-native");
const react_native_androw_1 = tslib_1.__importDefault(require("react-native-androw"));
const react_native_bounceable_1 = tslib_1.__importDefault(require("@freakycoder/react-native-bounceable"));
/**
* ? Local Imports
*/
const Card_style_1 = tslib_1.__importStar(require("./Card.style"));
const TextContainer_1 = tslib_1.__importDefault(require("./components/TextContainer/TextContainer"));
const IconContainer_1 = tslib_1.__importDefault(require("./components/IconContainer/IconContainer"));
const Card = ({ style, onPress, shadowStyle, topRightText, bottomRightText, topRightTextStyle, topRightComponent, bottomRightTextStyle, bottomRightComponent, borderRadius = 15, iconDisable = false, backgroundColor = "#fff", containerHeight = undefined, ...rest }) => {
const renderTopRightComponent = () => topRightComponent || (<react_native_1.View style={Card_style_1.default.topRightContainer}>
<react_native_1.Text style={[Card_style_1.default.topRightTextStyle, topRightTextStyle]}>
{topRightText}
</react_native_1.Text>
</react_native_1.View>);
const renderBottomRightComponent = () => bottomRightComponent || (<react_native_1.View style={Card_style_1.default.bottomRightContainer}>
<react_native_1.Text style={[Card_style_1.default.bottomRightTextStyle, bottomRightTextStyle]}>
{bottomRightText}
</react_native_1.Text>
</react_native_1.View>);
return (<react_native_androw_1.default style={[Card_style_1.default.shadowStyle, shadowStyle]}>
<react_native_bounceable_1.default {...rest} style={[
Card_style_1._container(containerHeight, iconDisable, borderRadius, backgroundColor),
style,
]} onPress={onPress}>
<react_native_1.View style={Card_style_1.default.contentContainer}>
<IconContainer_1.default iconDisable={iconDisable} {...rest}/>
<TextContainer_1.default iconDisable={iconDisable} {...rest}/>
{renderTopRightComponent()}
{renderBottomRightComponent()}
</react_native_1.View>
</react_native_bounceable_1.default>
</react_native_androw_1.default>);
};
exports.default = Card;
//# sourceMappingURL=Card.js.map