1 | var __rest = (this && this.__rest) || function (s, e) {
|
2 | var t = {};
|
3 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4 | t[p] = s[p];
|
5 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8 | t[p[i]] = s[p[i]];
|
9 | }
|
10 | return t;
|
11 | };
|
12 | import React from 'react';
|
13 | import { View, Platform, StyleSheet } from 'react-native';
|
14 | import { withTheme } from '../config';
|
15 | import CardTitle from './CardTitle';
|
16 | import CardDivider from './CardDivider';
|
17 | import CardImage from './CardImage';
|
18 | import CardFeaturedTitle from './CardFeaturedTitle';
|
19 | import CardFeaturedSubtitle from './CardFeaturedSubtitle';
|
20 | const Card = (props) => {
|
21 | var _a, _b;
|
22 | const { children, containerStyle, wrapperStyle, theme } = props, attributes = __rest(props, ["children", "containerStyle", "wrapperStyle", "theme"]);
|
23 | return (<View {...attributes} style={StyleSheet.flatten([
|
24 | Object.assign({ backgroundColor: (_a = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _a === void 0 ? void 0 : _a.white, borderWidth: 1, padding: 15, margin: 15, marginBottom: 0, borderColor: (_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b.grey5 }, Platform.select({
|
25 | android: {
|
26 | elevation: 1,
|
27 | },
|
28 | default: {
|
29 | shadowColor: 'rgba(0,0,0, .2)',
|
30 | shadowOffset: { height: 0, width: 0 },
|
31 | shadowOpacity: 1,
|
32 | shadowRadius: 1,
|
33 | },
|
34 | })),
|
35 | containerStyle && containerStyle,
|
36 | ])}>
|
37 | <View style={StyleSheet.flatten([
|
38 | styles.wrapper,
|
39 | wrapperStyle && wrapperStyle,
|
40 | ])}>
|
41 | {children}
|
42 | </View>
|
43 | </View>);
|
44 | };
|
45 | const styles = StyleSheet.create({
|
46 | wrapper: {
|
47 | backgroundColor: 'transparent',
|
48 | },
|
49 | });
|
50 | export { Card };
|
51 | const ThemedCard = Object.assign(withTheme(Card, 'Card'), {
|
52 | Divider: CardDivider,
|
53 | Image: CardImage,
|
54 | Title: CardTitle,
|
55 | FeaturedTitle: CardFeaturedTitle,
|
56 | FeaturedSubtitle: CardFeaturedSubtitle,
|
57 | });
|
58 | export default ThemedCard;
|