related-ui-components 2.0.8 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/app.js +16 -10
- package/lib/module/app.js.map +1 -1
- package/lib/module/components/Card/Card.js +68 -83
- package/lib/module/components/Card/Card.js.map +1 -1
- package/lib/module/components/Card/templates/SelaDealCard.js +50 -80
- package/lib/module/components/Card/templates/SelaDealCard.js.map +1 -1
- package/lib/module/index.js +4 -7
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/app.d.ts.map +1 -1
- package/lib/typescript/src/components/Card/Card.d.ts +1 -5
- package/lib/typescript/src/components/Card/Card.d.ts.map +1 -1
- package/lib/typescript/src/components/Card/templates/SelaDealCard.d.ts +2 -2
- package/lib/typescript/src/components/Card/templates/SelaDealCard.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/app.tsx +15 -9
- package/src/components/Card/Card.tsx +86 -83
- package/src/components/Card/templates/SelaDealCard.tsx +98 -146
- package/src/index.ts +4 -4
package/lib/module/app.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { SafeAreaView } from "react-native";
|
|
3
|
+
import React, { useEffect } from "react";
|
|
4
|
+
import { I18nManager, SafeAreaView } from "react-native";
|
|
5
5
|
import { SelaDealCard } from "./components/index.js";
|
|
6
6
|
import { RelatedProvider } from "./theme/index.js";
|
|
7
7
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
8
|
const MyScreen = () => {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
I18nManager.allowRTL(true);
|
|
11
|
+
I18nManager.forceRTL(true);
|
|
12
|
+
}, []);
|
|
9
13
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
10
14
|
children: /*#__PURE__*/_jsx(RelatedProvider, {
|
|
11
15
|
children: /*#__PURE__*/_jsx(SafeAreaView, {
|
|
@@ -13,26 +17,28 @@ const MyScreen = () => {
|
|
|
13
17
|
padding: 50
|
|
14
18
|
},
|
|
15
19
|
children: /*#__PURE__*/_jsx(SelaDealCard, {
|
|
16
|
-
variant: "
|
|
17
|
-
isRTL
|
|
18
|
-
|
|
20
|
+
variant: "vertical"
|
|
21
|
+
// isRTL
|
|
22
|
+
,
|
|
23
|
+
backgroundImage: {
|
|
24
|
+
uri: "https://picsum.photos/seed/lounge/600/700"
|
|
25
|
+
} // Your image for the horizontal card
|
|
19
26
|
,
|
|
20
27
|
label: "Offer",
|
|
21
28
|
lockOverlay: true,
|
|
22
29
|
providerName: "Altanfeethi",
|
|
23
30
|
providerNameStyle: {
|
|
24
|
-
color:
|
|
31
|
+
color: "yellow"
|
|
25
32
|
} // Specific style for provider name
|
|
26
33
|
,
|
|
27
34
|
description: "1 Year Membership",
|
|
28
35
|
descriptionStyle: {
|
|
29
|
-
color:
|
|
36
|
+
color: "white"
|
|
30
37
|
},
|
|
31
38
|
price: "20,000 pts",
|
|
32
39
|
onPress: () => console.log("Horizontal Sela Card Pressed"),
|
|
33
|
-
width:
|
|
34
|
-
|
|
35
|
-
height: 180 // Example height
|
|
40
|
+
width: 177 // Example width
|
|
41
|
+
// height={180} // Example height
|
|
36
42
|
})
|
|
37
43
|
})
|
|
38
44
|
})
|
package/lib/module/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","SafeAreaView","SelaDealCard","RelatedProvider","jsx","_jsx","Fragment","_Fragment","MyScreen","children","style","padding","variant","
|
|
1
|
+
{"version":3,"names":["React","useEffect","I18nManager","SafeAreaView","SelaDealCard","RelatedProvider","jsx","_jsx","Fragment","_Fragment","MyScreen","allowRTL","forceRTL","children","style","padding","variant","backgroundImage","uri","label","lockOverlay","providerName","providerNameStyle","color","description","descriptionStyle","price","onPress","console","log","width"],"sourceRoot":"..\\..\\src","sources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|
|
4
3
|
import React from "react";
|
|
5
|
-
import { View, TouchableOpacity, StyleSheet, ImageBackground
|
|
6
|
-
// Import LayoutChangeEvent
|
|
7
|
-
} from "react-native";
|
|
8
|
-
// Assuming types.ts defines CardProps
|
|
4
|
+
import { View, TouchableOpacity, StyleSheet, ImageBackground } from "react-native";
|
|
9
5
|
import { useTheme } from "../../theme/ThemeContext.js";
|
|
10
6
|
import { LinearGradient } from "expo-linear-gradient";
|
|
11
|
-
|
|
12
|
-
// Extend CardProps to include onLayout
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
8
|
const Card = ({
|
|
15
9
|
children,
|
|
16
10
|
style,
|
|
17
11
|
onPress,
|
|
18
|
-
onLayout,
|
|
19
|
-
// Destructure onLayout
|
|
20
12
|
disabled = false,
|
|
21
|
-
|
|
13
|
+
elevation = 1,
|
|
22
14
|
testID,
|
|
23
|
-
|
|
15
|
+
variant,
|
|
24
16
|
backgroundColor,
|
|
25
|
-
|
|
17
|
+
borderColor,
|
|
26
18
|
borderRadius = 8,
|
|
27
19
|
backgroundImage,
|
|
28
20
|
gradient
|
|
21
|
+
// margin,
|
|
22
|
+
// padding,
|
|
29
23
|
}) => {
|
|
30
24
|
const {
|
|
31
25
|
theme
|
|
32
26
|
} = useTheme();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
backgroundColor: backgroundImage ? "transparent" : backgroundColor || theme.background
|
|
40
|
-
}, disabled && styles.disabled, style // This will include the width and calculated height from SelaDealCard
|
|
41
|
-
];
|
|
42
|
-
const renderCardContent = () => {
|
|
43
|
-
// The children (SelaDealCard's overlayContainer) are rendered on top of
|
|
44
|
-
// the ImageBackground or Gradient.
|
|
45
|
-
return children;
|
|
27
|
+
const getCardStyle = () => {
|
|
28
|
+
const baseStyle = {
|
|
29
|
+
backgroundColor: backgroundColor || theme.background,
|
|
30
|
+
borderRadius
|
|
31
|
+
};
|
|
32
|
+
return baseStyle;
|
|
46
33
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
activeOpacity: 0.9,
|
|
56
|
-
accessibilityRole: "button",
|
|
57
|
-
children: [backgroundImage && /*#__PURE__*/_jsx(ImageBackground, {
|
|
34
|
+
const cardStyle = [styles.card, getCardStyle(), disabled && {
|
|
35
|
+
opacity: 0.6
|
|
36
|
+
}, style, backgroundImage && {
|
|
37
|
+
backgroundColor: "transparent"
|
|
38
|
+
}];
|
|
39
|
+
const renderCardContent = () => {
|
|
40
|
+
if (backgroundImage) {
|
|
41
|
+
return /*#__PURE__*/_jsx(ImageBackground, {
|
|
58
42
|
source: backgroundImage.source,
|
|
59
|
-
style: [
|
|
60
|
-
,
|
|
43
|
+
style: [styles.backgroundImage, backgroundImage.style],
|
|
61
44
|
imageStyle: [{
|
|
62
45
|
borderRadius
|
|
63
46
|
}, backgroundImage.imageStyle],
|
|
64
47
|
resizeMode: backgroundImage.resizeMode || "cover",
|
|
65
|
-
blurRadius: backgroundImage.blurRadius
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
48
|
+
blurRadius: backgroundImage.blurRadius,
|
|
49
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
50
|
+
style: [styles.imageContentContainer, {
|
|
51
|
+
opacity: backgroundImage.opacity !== undefined ? backgroundImage.opacity : 1
|
|
52
|
+
}],
|
|
53
|
+
children: children
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
} else if (gradient) {
|
|
57
|
+
return /*#__PURE__*/_jsx(LinearGradient, {
|
|
70
58
|
colors: gradient.colors,
|
|
71
59
|
start: gradient.start,
|
|
72
60
|
end: gradient.end,
|
|
73
|
-
style: [
|
|
74
|
-
// Gradient also fills
|
|
75
|
-
{
|
|
61
|
+
style: [styles.gradient, {
|
|
76
62
|
borderRadius
|
|
77
|
-
}, gradient.style]
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
63
|
+
}, gradient.style],
|
|
64
|
+
children: children
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
return children;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (onPress) {
|
|
71
|
+
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
72
|
+
style: cardStyle,
|
|
73
|
+
onPress: onPress,
|
|
74
|
+
disabled: disabled,
|
|
75
|
+
testID: testID,
|
|
76
|
+
activeOpacity: 0.9,
|
|
77
|
+
accessibilityRole: "button",
|
|
78
|
+
accessibilityLabel: "Card",
|
|
79
|
+
children: renderCardContent()
|
|
82
80
|
});
|
|
83
81
|
}
|
|
84
|
-
return /*#__PURE__*/
|
|
85
|
-
style:
|
|
82
|
+
return /*#__PURE__*/_jsx(View, {
|
|
83
|
+
style: cardStyle,
|
|
86
84
|
testID: testID,
|
|
87
|
-
|
|
88
|
-
children: [backgroundImage && /*#__PURE__*/_jsx(ImageBackground, {
|
|
89
|
-
source: backgroundImage.source,
|
|
90
|
-
style: [StyleSheet.absoluteFillObject, backgroundImage.style],
|
|
91
|
-
imageStyle: [{
|
|
92
|
-
borderRadius
|
|
93
|
-
}, backgroundImage.imageStyle],
|
|
94
|
-
resizeMode: backgroundImage.resizeMode || "cover",
|
|
95
|
-
blurRadius: backgroundImage.blurRadius
|
|
96
|
-
}), gradient && !backgroundImage && /*#__PURE__*/_jsx(LinearGradient, {
|
|
97
|
-
colors: gradient.colors,
|
|
98
|
-
start: gradient.start,
|
|
99
|
-
end: gradient.end,
|
|
100
|
-
style: [StyleSheet.absoluteFillObject, {
|
|
101
|
-
borderRadius
|
|
102
|
-
}, gradient.style]
|
|
103
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
104
|
-
style: styles.contentWrapper,
|
|
105
|
-
children: renderCardContent()
|
|
106
|
-
})]
|
|
85
|
+
children: renderCardContent()
|
|
107
86
|
});
|
|
108
87
|
};
|
|
109
88
|
const styles = StyleSheet.create({
|
|
110
89
|
card: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
90
|
+
borderRadius: 8,
|
|
91
|
+
flexDirection: "column",
|
|
92
|
+
display: "flex"
|
|
114
93
|
},
|
|
115
|
-
|
|
116
|
-
|
|
94
|
+
backgroundImage: {
|
|
95
|
+
width: "100%",
|
|
96
|
+
height: "100%"
|
|
97
|
+
},
|
|
98
|
+
imageContentContainer: {
|
|
99
|
+
flex: 1,
|
|
100
|
+
backgroundColor: "transparent"
|
|
117
101
|
},
|
|
118
|
-
|
|
119
|
-
// Ensures content is layered above background/gradient
|
|
102
|
+
gradient: {
|
|
120
103
|
flex: 1,
|
|
121
|
-
|
|
104
|
+
width: "100%",
|
|
105
|
+
height: "100%",
|
|
106
|
+
justifyContent: "flex-start",
|
|
107
|
+
alignItems: "flex-start"
|
|
122
108
|
}
|
|
123
|
-
// No specific styles for backgroundImage or gradient here as they use absoluteFillObject
|
|
124
109
|
});
|
|
125
110
|
export default Card;
|
|
126
111
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","TouchableOpacity","StyleSheet","ImageBackground","useTheme","LinearGradient","jsx","_jsx","
|
|
1
|
+
{"version":3,"names":["React","View","TouchableOpacity","StyleSheet","ImageBackground","useTheme","LinearGradient","jsx","_jsx","Card","children","style","onPress","disabled","elevation","testID","variant","backgroundColor","borderColor","borderRadius","backgroundImage","gradient","theme","getCardStyle","baseStyle","background","cardStyle","styles","card","opacity","renderCardContent","source","imageStyle","resizeMode","blurRadius","imageContentContainer","undefined","colors","start","end","activeOpacity","accessibilityRole","accessibilityLabel","create","flexDirection","display","width","height","flex","justifyContent","alignItems"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/Card/Card.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OA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CAAC;EACDzB,eAAe,EAAE;IACf0B,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE;EACV,CAAC;EACDZ,qBAAqB,EAAE;IACrBa,IAAI,EAAE,CAAC;IACP/B,eAAe,EAAE;EACnB,CAAC;EACDI,QAAQ,EAAE;IACR2B,IAAI,EAAE,CAAC;IACPF,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdE,cAAc,EAAE,YAAY;IAC5BC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAezC,IAAI","ignoreList":[]}
|
|
@@ -1,79 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
// src/components/SelaDealCard/SelaDealCard.tsx
|
|
4
|
-
import React, {
|
|
5
|
-
import { View, Text, StyleSheet, Image
|
|
6
|
-
//
|
|
7
|
-
} from "
|
|
8
|
-
|
|
9
|
-
import { useTheme } from "../../../theme/ThemeContext.js";
|
|
4
|
+
import React, { useEffect, useState } from "react";
|
|
5
|
+
import { View, Text, StyleSheet, Image } from "react-native";
|
|
6
|
+
import Card from "../Card.js"; // Adjust path to your Card component
|
|
7
|
+
import { useTheme } from "../../../theme/ThemeContext.js"; // Adjust path
|
|
8
|
+
|
|
10
9
|
import { LockOverlay } from "../../LockOverlay/index.js";
|
|
11
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const SelaDealCard =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} = props;
|
|
11
|
+
const SelaDealCard = ({
|
|
12
|
+
variant,
|
|
13
|
+
backgroundImage,
|
|
14
|
+
label,
|
|
15
|
+
labelStyle,
|
|
16
|
+
labelContainerStyle,
|
|
17
|
+
providerName,
|
|
18
|
+
providerNameStyle,
|
|
19
|
+
description,
|
|
20
|
+
descriptionStyle,
|
|
21
|
+
price,
|
|
22
|
+
priceStyle,
|
|
23
|
+
priceContainerStyle,
|
|
24
|
+
onPress,
|
|
25
|
+
style,
|
|
26
|
+
width = "100%",
|
|
27
|
+
height,
|
|
28
|
+
isRTL: propIsRTL,
|
|
29
|
+
borderRadius = 12,
|
|
30
|
+
// Default based on images
|
|
31
|
+
darkOverlayEnabled = true,
|
|
32
|
+
darkOverlayColor = "rgba(0, 0, 0, 0.3)",
|
|
33
|
+
lockOverlay = false
|
|
34
|
+
}) => {
|
|
37
35
|
const {
|
|
38
36
|
theme,
|
|
39
37
|
isRTL: themeIsRTL
|
|
40
38
|
} = useTheme();
|
|
41
39
|
const isRTL = propIsRTL !== undefined ? propIsRTL : themeIsRTL;
|
|
42
|
-
const
|
|
43
|
-
const [dynamicHeight, setDynamicHeight] = useState(
|
|
40
|
+
const styles = getStyles(theme, isRTL);
|
|
41
|
+
const [dynamicHeight, setDynamicHeight] = useState();
|
|
44
42
|
useEffect(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// You might want a default height or aspect ratio here.
|
|
56
|
-
setDynamicHeight(200); // Example fallback height
|
|
57
|
-
}
|
|
58
|
-
} else if (props.height !== undefined) {
|
|
59
|
-
// If an explicit height is provided, ensure dynamicHeight is not used.
|
|
43
|
+
if (height === undefined && typeof width == "number" && width && backgroundImage && backgroundImage.uri) {
|
|
44
|
+
Image.getSize(backgroundImage.uri, (imgWidth, imgHeight) => {
|
|
45
|
+
if (imgWidth > 0 && imgHeight > 0) {
|
|
46
|
+
const aspectRatio = imgHeight / imgWidth;
|
|
47
|
+
setDynamicHeight(width * aspectRatio);
|
|
48
|
+
} else {
|
|
49
|
+
setDynamicHeight(200);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
} else if (height !== undefined) {
|
|
60
53
|
setDynamicHeight(undefined);
|
|
61
54
|
}
|
|
62
|
-
}, [
|
|
63
|
-
const handleLayout = event => {
|
|
64
|
-
const newWidth = event.nativeEvent.layout.width;
|
|
65
|
-
if (newWidth > 0 && newWidth !== actualCardWidth) {
|
|
66
|
-
setActualCardWidth(newWidth);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// Use explicit props.height if provided, otherwise use the calculated dynamicHeight.
|
|
71
|
-
// Provide a minimum height for initial render or if dynamicHeight is still undefined.
|
|
72
|
-
const finalHeight = props.height !== undefined ? props.height : dynamicHeight !== undefined ? dynamicHeight : 150; // Minimum height before calculation or as fallback
|
|
73
|
-
|
|
74
|
-
const styles = getStyles(theme, isRTL);
|
|
75
|
-
|
|
76
|
-
// ... (rest of your style definitions: finalLabelContainerStyle, etc. remain the same)
|
|
55
|
+
}, [backgroundImage, height, width]);
|
|
77
56
|
const finalLabelContainerStyle = [styles.labelContainerBase, labelContainerStyle];
|
|
78
57
|
const finalLabelStyle = [styles.labelTextBase, labelStyle];
|
|
79
58
|
const finalPriceContainerStyle = [styles.priceContainerBase, variant === "horizontal" ? styles.priceContainerHorizontal : styles.priceContainerVertical, priceContainerStyle];
|
|
@@ -87,30 +66,25 @@ const SelaDealCard = props => {
|
|
|
87
66
|
textAlign: isRTL ? "right" : "left"
|
|
88
67
|
}, descriptionStyle];
|
|
89
68
|
return /*#__PURE__*/_jsxs(Card, {
|
|
90
|
-
onPress: onPress
|
|
91
|
-
// onLayout={handleLayout} // Pass onLayout to Card to get its width
|
|
92
|
-
,
|
|
69
|
+
onPress: onPress,
|
|
93
70
|
style: [styles.cardBase, {
|
|
94
71
|
borderRadius,
|
|
95
72
|
width,
|
|
96
|
-
height:
|
|
97
|
-
},
|
|
98
|
-
// Use the calculated finalHeight
|
|
99
|
-
style],
|
|
73
|
+
height: dynamicHeight || height
|
|
74
|
+
}, style],
|
|
100
75
|
backgroundImage: {
|
|
101
76
|
source: backgroundImage,
|
|
102
|
-
resizeMode: "cover"
|
|
77
|
+
resizeMode: "cover"
|
|
103
78
|
},
|
|
104
79
|
children: [darkOverlayEnabled && /*#__PURE__*/_jsx(View, {
|
|
105
80
|
style: [StyleSheet.absoluteFill, {
|
|
106
81
|
backgroundColor: darkOverlayColor
|
|
107
82
|
}, {
|
|
108
83
|
borderRadius: borderRadius
|
|
109
|
-
}
|
|
110
|
-
]
|
|
84
|
+
}]
|
|
111
85
|
}), /*#__PURE__*/_jsx(LockOverlay, {
|
|
112
86
|
visible: lockOverlay,
|
|
113
|
-
contentPosition:
|
|
87
|
+
contentPosition: isRTL ? "top-left" : "top-right",
|
|
114
88
|
iconSize: 24,
|
|
115
89
|
text: "",
|
|
116
90
|
overlayOpacity: 0.4
|
|
@@ -118,7 +92,7 @@ const SelaDealCard = props => {
|
|
|
118
92
|
style: styles.overlayContainer,
|
|
119
93
|
children: [/*#__PURE__*/_jsx(View, {
|
|
120
94
|
style: [styles.topSection, {
|
|
121
|
-
alignItems:
|
|
95
|
+
alignItems: "flex-start"
|
|
122
96
|
}],
|
|
123
97
|
children: label && /*#__PURE__*/_jsx(View, {
|
|
124
98
|
style: finalLabelContainerStyle,
|
|
@@ -167,15 +141,12 @@ const SelaDealCard = props => {
|
|
|
167
141
|
})]
|
|
168
142
|
});
|
|
169
143
|
};
|
|
170
|
-
|
|
171
|
-
// getStyles function remains the same
|
|
172
144
|
const getStyles = (theme, isRTL) => StyleSheet.create({
|
|
173
145
|
cardBase: {
|
|
174
146
|
overflow: "hidden",
|
|
175
147
|
position: "relative"
|
|
176
148
|
},
|
|
177
149
|
overlayContainer: {
|
|
178
|
-
// This will now fill the calculated height of the card
|
|
179
150
|
flex: 1,
|
|
180
151
|
padding: 16,
|
|
181
152
|
justifyContent: "space-between"
|
|
@@ -218,8 +189,7 @@ const getStyles = (theme, isRTL) => StyleSheet.create({
|
|
|
218
189
|
},
|
|
219
190
|
textBlockHorizontal: {
|
|
220
191
|
flex: 1,
|
|
221
|
-
marginRight:
|
|
222
|
-
marginLeft: isRTL ? 10 : 0
|
|
192
|
+
marginRight: 10
|
|
223
193
|
},
|
|
224
194
|
priceContainerHorizontal: {},
|
|
225
195
|
bottomContentVertical: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","View","Text","StyleSheet","Image","Card","useTheme","LockOverlay","jsx","_jsx","jsxs","_jsxs","SelaDealCard","variant","backgroundImage","label","labelStyle","labelContainerStyle","providerName","providerNameStyle","description","descriptionStyle","price","priceStyle","priceContainerStyle","onPress","style","width","height","isRTL","propIsRTL","borderRadius","darkOverlayEnabled","darkOverlayColor","lockOverlay","theme","themeIsRTL","undefined","styles","getStyles","dynamicHeight","setDynamicHeight","uri","getSize","imgWidth","imgHeight","aspectRatio","finalLabelContainerStyle","labelContainerBase","finalLabelStyle","labelTextBase","finalPriceContainerStyle","priceContainerBase","priceContainerHorizontal","priceContainerVertical","finalPriceStyle","priceTextBase","providerTextStyle","providerNameBase","color","onSurface","textAlign","descriptionTextStyle","descriptionBase","cardBase","source","resizeMode","children","absoluteFill","backgroundColor","visible","contentPosition","iconSize","text","overlayOpacity","overlayContainer","topSection","alignItems","bottomContentHorizontal","textBlockHorizontal","bottomContentVertical","textBlockVertical","create","overflow","position","flex","padding","justifyContent","paddingVertical","paddingHorizontal","background","fontWeight","fontSize","onBackground","marginBottom","secondary","helper","primary","onPrimary","flexDirection","marginRight","alignSelf"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/Card/templates/SelaDealCard.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAIEC,IAAI,EACJC,IAAI,EAGJC,UAAU,EACVC,KAA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
package/lib/module/index.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// registerRootComponent(App);
|
|
9
|
-
|
|
3
|
+
import { registerRootComponent } from 'expo';
|
|
4
|
+
import "react-native-reanimated";
|
|
5
|
+
import App from "./app.js";
|
|
6
|
+
registerRootComponent(App);
|
|
10
7
|
export * from "./theme/index.js";
|
|
11
8
|
export * from "./components/index.js";
|
|
12
9
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;AAAA;
|
|
1
|
+
{"version":3,"names":["registerRootComponent","App"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,MAAM;AAC5C,OAAO,yBAAyB;AAGhC,OAAOC,GAAG,MAAM,UAAO;AAEvBD,qBAAqB,CAACC,GAAG,CAAC;AAE1B,cAAc,kBAAS;AACvB,cAAc,uBAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/app.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/app.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,QAAA,MAAM,QAAQ,yBA8Bb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { CardProps as OriginalCardProps } from "./types";
|
|
4
|
-
interface CardProps extends OriginalCardProps {
|
|
5
|
-
onLayout?: (event: LayoutChangeEvent) => void;
|
|
6
|
-
}
|
|
2
|
+
import { CardProps } from "./types";
|
|
7
3
|
declare const Card: React.FC<CardProps>;
|
|
8
4
|
export default Card;
|
|
9
5
|
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAqG7B,CAAC;AAyBF,eAAe,IAAI,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle, DimensionValue, ImageURISource } from "react-native";
|
|
3
3
|
interface SelaDealCardProps {
|
|
4
4
|
variant: "horizontal" | "vertical";
|
|
5
|
-
backgroundImage:
|
|
5
|
+
backgroundImage: ImageURISource;
|
|
6
6
|
label?: string;
|
|
7
7
|
labelStyle?: StyleProp<TextStyle>;
|
|
8
8
|
labelContainerStyle?: StyleProp<ViewStyle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelaDealCard.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Card/templates/SelaDealCard.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"SelaDealCard.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Card/templates/SelaDealCard.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAEL,SAAS,EACT,SAAS,EAGT,SAAS,EACT,cAAc,EAGd,cAAc,EACf,MAAM,cAAc,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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,yBAAyB,CAAC;AAOjC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
package/src/app.tsx
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { SafeAreaView, Text } from "react-native";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { I18nManager, SafeAreaView, Text } from "react-native";
|
|
3
3
|
import { SelaDealCard } from "./components";
|
|
4
4
|
import { RelatedProvider } from "./theme";
|
|
5
5
|
|
|
6
6
|
const MyScreen = () => {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
I18nManager.allowRTL(true);
|
|
9
|
+
I18nManager.forceRTL(true);
|
|
10
|
+
}, []);
|
|
7
11
|
return (
|
|
8
12
|
<>
|
|
9
13
|
<RelatedProvider>
|
|
10
14
|
<SafeAreaView style={{ padding: 50 }}>
|
|
11
15
|
<SelaDealCard
|
|
12
|
-
variant="
|
|
13
|
-
isRTL
|
|
14
|
-
backgroundImage={
|
|
16
|
+
variant="vertical"
|
|
17
|
+
// isRTL
|
|
18
|
+
backgroundImage={{
|
|
19
|
+
uri: "https://picsum.photos/seed/lounge/600/700",
|
|
20
|
+
}} // Your image for the horizontal card
|
|
15
21
|
label="Offer"
|
|
16
22
|
lockOverlay
|
|
17
23
|
providerName="Altanfeethi"
|
|
18
|
-
providerNameStyle={{ color:
|
|
24
|
+
providerNameStyle={{ color: "yellow" }} // Specific style for provider name
|
|
19
25
|
description="1 Year Membership"
|
|
20
|
-
descriptionStyle={{ color:
|
|
26
|
+
descriptionStyle={{ color: "white" }}
|
|
21
27
|
price="20,000 pts"
|
|
22
28
|
onPress={() => console.log("Horizontal Sela Card Pressed")}
|
|
23
|
-
width={
|
|
24
|
-
height={180} // Example height
|
|
29
|
+
width={177} // Example width
|
|
30
|
+
// height={180} // Example height
|
|
25
31
|
/>
|
|
26
32
|
</SafeAreaView>
|
|
27
33
|
</RelatedProvider>
|
|
@@ -1,136 +1,139 @@
|
|
|
1
|
-
// src/components/Card/Card.tsx
|
|
2
1
|
import React from "react";
|
|
3
2
|
import {
|
|
4
3
|
View,
|
|
5
4
|
TouchableOpacity,
|
|
6
5
|
StyleSheet,
|
|
6
|
+
Platform,
|
|
7
7
|
ImageBackground,
|
|
8
|
-
LayoutChangeEvent, // Import LayoutChangeEvent
|
|
9
8
|
} from "react-native";
|
|
10
|
-
import { CardProps
|
|
9
|
+
import { CardProps } from "./types";
|
|
11
10
|
import { useTheme } from "../../theme/ThemeContext";
|
|
12
11
|
import { LinearGradient } from "expo-linear-gradient";
|
|
13
12
|
|
|
14
|
-
// Extend CardProps to include onLayout
|
|
15
|
-
interface CardProps extends OriginalCardProps {
|
|
16
|
-
onLayout?: (event: LayoutChangeEvent) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
13
|
const Card: React.FC<CardProps> = ({
|
|
20
14
|
children,
|
|
21
15
|
style,
|
|
22
16
|
onPress,
|
|
23
|
-
onLayout, // Destructure onLayout
|
|
24
17
|
disabled = false,
|
|
25
|
-
|
|
18
|
+
elevation = 1,
|
|
26
19
|
testID,
|
|
27
|
-
|
|
20
|
+
variant,
|
|
28
21
|
backgroundColor,
|
|
29
|
-
|
|
22
|
+
borderColor,
|
|
30
23
|
borderRadius = 8,
|
|
31
24
|
backgroundImage,
|
|
32
|
-
gradient
|
|
25
|
+
gradient
|
|
26
|
+
// margin,
|
|
27
|
+
// padding,
|
|
33
28
|
}) => {
|
|
34
|
-
const {
|
|
29
|
+
const {theme} = useTheme();
|
|
30
|
+
|
|
31
|
+
const getCardStyle = () => {
|
|
32
|
+
const baseStyle: any = {
|
|
33
|
+
backgroundColor: backgroundColor || theme.background,
|
|
34
|
+
borderRadius,
|
|
35
|
+
};
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
return baseStyle;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const cardStyle = [
|
|
37
41
|
styles.card,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
backgroundColor: backgroundImage
|
|
43
|
-
? "transparent"
|
|
44
|
-
: backgroundColor || theme.background,
|
|
45
|
-
},
|
|
46
|
-
disabled && styles.disabled,
|
|
47
|
-
style, // This will include the width and calculated height from SelaDealCard
|
|
42
|
+
getCardStyle(),
|
|
43
|
+
disabled && { opacity: 0.6 },
|
|
44
|
+
style,
|
|
45
|
+
backgroundImage && { backgroundColor: "transparent" },
|
|
48
46
|
];
|
|
49
47
|
|
|
50
48
|
const renderCardContent = () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
if (backgroundImage) {
|
|
50
|
+
return (
|
|
51
|
+
<ImageBackground
|
|
52
|
+
source={backgroundImage.source}
|
|
53
|
+
style={[styles.backgroundImage, backgroundImage.style]}
|
|
54
|
+
imageStyle={[{ borderRadius }, backgroundImage.imageStyle]}
|
|
55
|
+
resizeMode={backgroundImage.resizeMode || "cover"}
|
|
56
|
+
blurRadius={backgroundImage.blurRadius}
|
|
57
|
+
>
|
|
58
|
+
<View
|
|
59
|
+
style={[
|
|
60
|
+
styles.imageContentContainer,
|
|
61
|
+
{
|
|
62
|
+
opacity:
|
|
63
|
+
backgroundImage.opacity !== undefined
|
|
64
|
+
? backgroundImage.opacity
|
|
65
|
+
: 1,
|
|
66
|
+
},
|
|
67
|
+
]}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</View>
|
|
71
|
+
</ImageBackground>
|
|
72
|
+
);
|
|
73
|
+
} else if (gradient) {
|
|
74
|
+
return (
|
|
75
|
+
<LinearGradient
|
|
76
|
+
colors={gradient.colors as any}
|
|
77
|
+
start={gradient.start}
|
|
78
|
+
end={gradient.end}
|
|
79
|
+
style={[
|
|
80
|
+
styles.gradient,
|
|
81
|
+
{ borderRadius },
|
|
82
|
+
gradient.style,
|
|
83
|
+
]}
|
|
84
|
+
>
|
|
85
|
+
{children}
|
|
86
|
+
</LinearGradient>
|
|
87
|
+
);
|
|
88
|
+
} else {
|
|
89
|
+
return children;
|
|
90
|
+
}
|
|
54
91
|
};
|
|
55
92
|
|
|
56
93
|
if (onPress) {
|
|
57
94
|
return (
|
|
58
95
|
<TouchableOpacity
|
|
59
|
-
style={
|
|
96
|
+
style={cardStyle}
|
|
60
97
|
onPress={onPress}
|
|
61
|
-
onLayout={onLayout} // Apply onLayout here
|
|
62
98
|
disabled={disabled}
|
|
63
99
|
testID={testID}
|
|
64
100
|
activeOpacity={0.9}
|
|
65
101
|
accessibilityRole="button"
|
|
102
|
+
accessibilityLabel={"Card"}
|
|
66
103
|
>
|
|
67
|
-
{
|
|
68
|
-
<ImageBackground
|
|
69
|
-
source={backgroundImage.source}
|
|
70
|
-
style={[StyleSheet.absoluteFillObject, backgroundImage.style]} // Fills parent
|
|
71
|
-
imageStyle={[{ borderRadius }, backgroundImage.imageStyle]}
|
|
72
|
-
resizeMode={backgroundImage.resizeMode || "cover"}
|
|
73
|
-
blurRadius={backgroundImage.blurRadius}
|
|
74
|
-
/>
|
|
75
|
-
)}
|
|
76
|
-
{gradient && !backgroundImage && ( // Render gradient if no image and gradient exists
|
|
77
|
-
<LinearGradient
|
|
78
|
-
colors={gradient.colors as any}
|
|
79
|
-
start={gradient.start}
|
|
80
|
-
end={gradient.end}
|
|
81
|
-
style={[
|
|
82
|
-
StyleSheet.absoluteFillObject, // Gradient also fills
|
|
83
|
-
{ borderRadius },
|
|
84
|
-
gradient.style,
|
|
85
|
-
]}
|
|
86
|
-
/>
|
|
87
|
-
)}
|
|
88
|
-
<View style={styles.contentWrapper}>{renderCardContent()}</View>
|
|
104
|
+
{renderCardContent()}
|
|
89
105
|
</TouchableOpacity>
|
|
90
106
|
);
|
|
91
107
|
}
|
|
92
108
|
|
|
93
109
|
return (
|
|
94
|
-
<View style={
|
|
95
|
-
{
|
|
96
|
-
<ImageBackground
|
|
97
|
-
source={backgroundImage.source}
|
|
98
|
-
style={[StyleSheet.absoluteFillObject, backgroundImage.style]}
|
|
99
|
-
imageStyle={[{ borderRadius }, backgroundImage.imageStyle]}
|
|
100
|
-
resizeMode={backgroundImage.resizeMode || "cover"}
|
|
101
|
-
blurRadius={backgroundImage.blurRadius}
|
|
102
|
-
/>
|
|
103
|
-
)}
|
|
104
|
-
{gradient && !backgroundImage && (
|
|
105
|
-
<LinearGradient
|
|
106
|
-
colors={gradient.colors as any}
|
|
107
|
-
start={gradient.start}
|
|
108
|
-
end={gradient.end}
|
|
109
|
-
style={[
|
|
110
|
-
StyleSheet.absoluteFillObject,
|
|
111
|
-
{ borderRadius },
|
|
112
|
-
gradient.style,
|
|
113
|
-
]}
|
|
114
|
-
/>
|
|
115
|
-
)}
|
|
116
|
-
<View style={styles.contentWrapper}>{renderCardContent()}</View>
|
|
110
|
+
<View style={cardStyle} testID={testID}>
|
|
111
|
+
{renderCardContent()}
|
|
117
112
|
</View>
|
|
118
113
|
);
|
|
119
114
|
};
|
|
120
115
|
|
|
121
116
|
const styles = StyleSheet.create({
|
|
122
117
|
card: {
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
borderRadius: 8,
|
|
119
|
+
flexDirection: "column",
|
|
120
|
+
display: "flex",
|
|
125
121
|
},
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
backgroundImage: {
|
|
123
|
+
width: "100%",
|
|
124
|
+
height: "100%",
|
|
125
|
+
},
|
|
126
|
+
imageContentContainer: {
|
|
127
|
+
flex: 1,
|
|
128
|
+
backgroundColor: "transparent",
|
|
128
129
|
},
|
|
129
|
-
|
|
130
|
+
gradient: {
|
|
130
131
|
flex: 1,
|
|
131
|
-
|
|
132
|
+
width: "100%",
|
|
133
|
+
height: "100%",
|
|
134
|
+
justifyContent: "flex-start",
|
|
135
|
+
alignItems: "flex-start",
|
|
132
136
|
},
|
|
133
|
-
// No specific styles for backgroundImage or gradient here as they use absoluteFillObject
|
|
134
137
|
});
|
|
135
138
|
|
|
136
|
-
export default Card;
|
|
139
|
+
export default Card;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/SelaDealCard/SelaDealCard.tsx
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
3
|
import {
|
|
4
4
|
ImageSourcePropType,
|
|
5
5
|
StyleProp,
|
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
TextStyle,
|
|
10
10
|
DimensionValue,
|
|
11
11
|
StyleSheet,
|
|
12
|
-
Image,
|
|
13
|
-
|
|
12
|
+
Image,
|
|
13
|
+
ImageURISource,
|
|
14
14
|
} from "react-native";
|
|
15
|
-
import Card from "../Card";
|
|
16
|
-
import { useTheme } from "../../../theme/ThemeContext";
|
|
15
|
+
import Card from "../Card"; // Adjust path to your Card component
|
|
16
|
+
import { useTheme } from "../../../theme/ThemeContext"; // Adjust path
|
|
17
17
|
import { ThemeType } from "../../../theme";
|
|
18
18
|
import { LockOverlay } from "../../LockOverlay";
|
|
19
19
|
|
|
20
20
|
interface SelaDealCardProps {
|
|
21
21
|
variant: "horizontal" | "vertical";
|
|
22
|
-
backgroundImage:
|
|
22
|
+
backgroundImage: ImageURISource;
|
|
23
23
|
label?: string;
|
|
24
24
|
labelStyle?: StyleProp<TextStyle>;
|
|
25
25
|
labelContainerStyle?: StyleProp<ViewStyle>;
|
|
@@ -31,100 +31,72 @@ interface SelaDealCardProps {
|
|
|
31
31
|
priceStyle?: StyleProp<TextStyle>;
|
|
32
32
|
priceContainerStyle?: StyleProp<ViewStyle>;
|
|
33
33
|
onPress?: () => void;
|
|
34
|
-
style?: StyleProp<ViewStyle>;
|
|
34
|
+
style?: StyleProp<ViewStyle>; // Overall card style
|
|
35
35
|
width?: DimensionValue;
|
|
36
|
-
height?: DimensionValue;
|
|
36
|
+
height?: DimensionValue;
|
|
37
37
|
isRTL?: boolean;
|
|
38
38
|
borderRadius?: number;
|
|
39
|
-
contentColor?: string;
|
|
39
|
+
contentColor?: string; // For text like providerName, description on the image
|
|
40
40
|
labelBackgroundColor?: string;
|
|
41
41
|
labelTextColor?: string;
|
|
42
42
|
priceBackgroundColor?: string;
|
|
43
43
|
priceTextColor?: string;
|
|
44
|
-
darkOverlayEnabled?: boolean;
|
|
45
|
-
darkOverlayColor?: string;
|
|
44
|
+
darkOverlayEnabled?: boolean; // New prop
|
|
45
|
+
darkOverlayColor?: string; // New prop for custom overlay color
|
|
46
46
|
lockOverlay?: boolean;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const SelaDealCard: React.FC<SelaDealCardProps> = (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} = props;
|
|
73
|
-
|
|
49
|
+
const SelaDealCard: React.FC<SelaDealCardProps> = ({
|
|
50
|
+
variant,
|
|
51
|
+
backgroundImage,
|
|
52
|
+
label,
|
|
53
|
+
labelStyle,
|
|
54
|
+
labelContainerStyle,
|
|
55
|
+
providerName,
|
|
56
|
+
providerNameStyle,
|
|
57
|
+
description,
|
|
58
|
+
descriptionStyle,
|
|
59
|
+
price,
|
|
60
|
+
priceStyle,
|
|
61
|
+
priceContainerStyle,
|
|
62
|
+
onPress,
|
|
63
|
+
style,
|
|
64
|
+
width = "100%",
|
|
65
|
+
height,
|
|
66
|
+
isRTL: propIsRTL,
|
|
67
|
+
borderRadius = 12, // Default based on images
|
|
68
|
+
darkOverlayEnabled = true,
|
|
69
|
+
darkOverlayColor = "rgba(0, 0, 0, 0.3)",
|
|
70
|
+
lockOverlay = false,
|
|
71
|
+
}) => {
|
|
74
72
|
const { theme, isRTL: themeIsRTL } = useTheme();
|
|
75
73
|
const isRTL = propIsRTL !== undefined ? propIsRTL : themeIsRTL;
|
|
76
74
|
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
);
|
|
80
|
-
const [dynamicHeight, setDynamicHeight] = useState<
|
|
81
|
-
DimensionValue | undefined
|
|
82
|
-
>(undefined);
|
|
75
|
+
const styles = getStyles(theme, isRTL);
|
|
76
|
+
|
|
77
|
+
const [dynamicHeight, setDynamicHeight] = useState<number>();
|
|
83
78
|
|
|
84
79
|
useEffect(() => {
|
|
85
|
-
// Calculate dynamic height if no explicit height is provided via props,
|
|
86
|
-
// and we have the actual card width and a valid background image.
|
|
87
80
|
if (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
backgroundImage
|
|
81
|
+
height === undefined &&
|
|
82
|
+
typeof width == "number" &&
|
|
83
|
+
width &&
|
|
84
|
+
backgroundImage &&
|
|
85
|
+
backgroundImage.uri
|
|
92
86
|
) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
} else if (props.height !== undefined) {
|
|
104
|
-
// If an explicit height is provided, ensure dynamicHeight is not used.
|
|
87
|
+
Image.getSize(backgroundImage.uri, (imgWidth, imgHeight) => {
|
|
88
|
+
if (imgWidth > 0 && imgHeight > 0) {
|
|
89
|
+
const aspectRatio = imgHeight / imgWidth;
|
|
90
|
+
setDynamicHeight(width * aspectRatio);
|
|
91
|
+
} else {
|
|
92
|
+
setDynamicHeight(200);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
} else if (height !== undefined) {
|
|
105
96
|
setDynamicHeight(undefined);
|
|
106
97
|
}
|
|
107
|
-
}, [
|
|
108
|
-
|
|
109
|
-
const handleLayout = (event: LayoutChangeEvent) => {
|
|
110
|
-
const newWidth = event.nativeEvent.layout.width;
|
|
111
|
-
if (newWidth > 0 && newWidth !== actualCardWidth) {
|
|
112
|
-
setActualCardWidth(newWidth);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// Use explicit props.height if provided, otherwise use the calculated dynamicHeight.
|
|
117
|
-
// Provide a minimum height for initial render or if dynamicHeight is still undefined.
|
|
118
|
-
const finalHeight =
|
|
119
|
-
props.height !== undefined
|
|
120
|
-
? props.height
|
|
121
|
-
: dynamicHeight !== undefined
|
|
122
|
-
? dynamicHeight
|
|
123
|
-
: 150; // Minimum height before calculation or as fallback
|
|
124
|
-
|
|
125
|
-
const styles = getStyles(theme, isRTL);
|
|
98
|
+
}, [backgroundImage, height, width]);
|
|
126
99
|
|
|
127
|
-
// ... (rest of your style definitions: finalLabelContainerStyle, etc. remain the same)
|
|
128
100
|
const finalLabelContainerStyle: StyleProp<ViewStyle> = [
|
|
129
101
|
styles.labelContainerBase,
|
|
130
102
|
labelContainerStyle,
|
|
@@ -161,15 +133,10 @@ const SelaDealCard: React.FC<SelaDealCardProps> = (props) => {
|
|
|
161
133
|
return (
|
|
162
134
|
<Card
|
|
163
135
|
onPress={onPress}
|
|
164
|
-
|
|
165
|
-
style={[
|
|
166
|
-
styles.cardBase,
|
|
167
|
-
{ borderRadius, width, height: finalHeight }, // Use the calculated finalHeight
|
|
168
|
-
style,
|
|
169
|
-
]}
|
|
136
|
+
style={[styles.cardBase, { borderRadius, width, height: dynamicHeight || height }, style]}
|
|
170
137
|
backgroundImage={{
|
|
171
138
|
source: backgroundImage,
|
|
172
|
-
resizeMode: "cover",
|
|
139
|
+
resizeMode: "cover",
|
|
173
140
|
}}
|
|
174
141
|
>
|
|
175
142
|
{darkOverlayEnabled && (
|
|
@@ -177,39 +144,27 @@ const SelaDealCard: React.FC<SelaDealCardProps> = (props) => {
|
|
|
177
144
|
style={[
|
|
178
145
|
StyleSheet.absoluteFill,
|
|
179
146
|
{ backgroundColor: darkOverlayColor },
|
|
180
|
-
{ borderRadius: borderRadius },
|
|
147
|
+
{ borderRadius: borderRadius },
|
|
181
148
|
]}
|
|
182
149
|
/>
|
|
183
150
|
)}
|
|
151
|
+
|
|
184
152
|
<LockOverlay
|
|
185
153
|
visible={lockOverlay}
|
|
186
154
|
contentPosition={
|
|
187
|
-
|
|
188
|
-
? isRTL
|
|
189
|
-
? "top-left"
|
|
190
|
-
: "top-right"
|
|
191
|
-
: isRTL
|
|
192
|
-
? "top-right"
|
|
193
|
-
: "top-left"
|
|
155
|
+
isRTL ? "top-left" : "top-right"
|
|
194
156
|
}
|
|
195
157
|
iconSize={24}
|
|
196
158
|
text={""}
|
|
197
159
|
overlayOpacity={0.4}
|
|
198
160
|
/>
|
|
199
|
-
|
|
161
|
+
|
|
200
162
|
<View style={styles.overlayContainer}>
|
|
201
163
|
<View
|
|
202
164
|
style={[
|
|
203
165
|
styles.topSection,
|
|
204
166
|
{
|
|
205
|
-
alignItems:
|
|
206
|
-
variant === "horizontal"
|
|
207
|
-
? isRTL
|
|
208
|
-
? "flex-end"
|
|
209
|
-
: "flex-start"
|
|
210
|
-
: isRTL
|
|
211
|
-
? "flex-start"
|
|
212
|
-
: "flex-end",
|
|
167
|
+
alignItems: "flex-start"
|
|
213
168
|
},
|
|
214
169
|
]}
|
|
215
170
|
>
|
|
@@ -258,71 +213,68 @@ const SelaDealCard: React.FC<SelaDealCardProps> = (props) => {
|
|
|
258
213
|
);
|
|
259
214
|
};
|
|
260
215
|
|
|
261
|
-
|
|
262
|
-
|
|
216
|
+
const getStyles = (theme: ThemeType, isRTL: boolean) =>
|
|
217
|
+
StyleSheet.create({
|
|
263
218
|
cardBase: {
|
|
264
|
-
|
|
265
|
-
|
|
219
|
+
overflow: "hidden",
|
|
220
|
+
position: "relative",
|
|
266
221
|
},
|
|
267
|
-
overlayContainer: {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
},
|
|
272
|
-
topSection: {
|
|
222
|
+
overlayContainer: {
|
|
223
|
+
flex: 1,
|
|
224
|
+
padding: 16,
|
|
225
|
+
justifyContent: "space-between",
|
|
273
226
|
},
|
|
227
|
+
topSection: {},
|
|
274
228
|
labelContainerBase: {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
229
|
+
paddingVertical: 6,
|
|
230
|
+
paddingHorizontal: 12,
|
|
231
|
+
borderRadius: 8,
|
|
232
|
+
backgroundColor: theme.background,
|
|
279
233
|
},
|
|
280
234
|
labelTextBase: {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
235
|
+
fontWeight: "600",
|
|
236
|
+
fontSize: 13,
|
|
237
|
+
color: theme.onBackground,
|
|
284
238
|
},
|
|
285
239
|
providerNameBase: {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
240
|
+
fontSize: 20,
|
|
241
|
+
marginBottom: 2,
|
|
242
|
+
color: theme.secondary,
|
|
289
243
|
},
|
|
290
244
|
descriptionBase: {
|
|
291
|
-
|
|
292
|
-
|
|
245
|
+
fontSize: 14,
|
|
246
|
+
color: theme.helper,
|
|
293
247
|
},
|
|
294
248
|
priceContainerBase: {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
249
|
+
paddingVertical: 8,
|
|
250
|
+
paddingHorizontal: 16,
|
|
251
|
+
borderRadius: 10,
|
|
252
|
+
backgroundColor: theme.primary,
|
|
299
253
|
},
|
|
300
254
|
priceTextBase: {
|
|
301
|
-
|
|
302
|
-
|
|
255
|
+
fontSize: 16,
|
|
256
|
+
color: theme.onPrimary,
|
|
303
257
|
},
|
|
304
258
|
bottomContentHorizontal: {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
259
|
+
flexDirection: isRTL ? "row-reverse" : "row",
|
|
260
|
+
justifyContent: "space-between",
|
|
261
|
+
alignItems: "flex-end",
|
|
308
262
|
},
|
|
309
263
|
textBlockHorizontal: {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
marginLeft: isRTL ? 10 : 0,
|
|
313
|
-
},
|
|
314
|
-
priceContainerHorizontal: {
|
|
264
|
+
flex: 1,
|
|
265
|
+
marginRight: 10,
|
|
315
266
|
},
|
|
267
|
+
priceContainerHorizontal: {},
|
|
316
268
|
bottomContentVertical: {
|
|
317
|
-
|
|
269
|
+
flexDirection: "column",
|
|
318
270
|
},
|
|
319
271
|
textBlockVertical: {
|
|
320
|
-
|
|
272
|
+
marginBottom: 12,
|
|
321
273
|
},
|
|
322
274
|
priceContainerVertical: {
|
|
323
|
-
|
|
324
|
-
|
|
275
|
+
alignSelf: "stretch",
|
|
276
|
+
alignItems: "center",
|
|
325
277
|
},
|
|
326
|
-
});
|
|
278
|
+
});
|
|
327
279
|
|
|
328
|
-
export default SelaDealCard;
|
|
280
|
+
export default SelaDealCard;
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { registerRootComponent } from 'expo';
|
|
2
|
+
import "react-native-reanimated";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import App from "./app";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
registerRootComponent(App);
|
|
8
8
|
|
|
9
9
|
export * from "./theme"
|
|
10
10
|
export * from "./components";
|