@whatmore-repo/whatmore-reactnative-sdk 1.0.26 → 1.0.28
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/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export function WhatmoreBase(props){
|
|
|
24
24
|
// );
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
|
-
<WhatmoreRootComponent shopId={props.shopId} onAction={props.onAction} />
|
|
27
|
+
<WhatmoreRootComponent shopId={props.shopId} onAction={props.onAction} customStyles={props.customStyles} />
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whatmore-repo/whatmore-reactnative-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "index.js",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"currency-symbol-map": "^5.1.0",
|
|
15
15
|
"react-hooks-global-state": "^2.1.0",
|
|
16
16
|
"react-native-animatable": "^1.3.3",
|
|
17
|
-
"react-native-intersection-observer": "^0.0.9"
|
|
18
|
-
"react-native-snap-carousel": "^3.9.1"
|
|
17
|
+
"react-native-intersection-observer": "^0.0.9"
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|
|
21
20
|
"@babel/core": "^7.20.0"
|
|
@@ -34,7 +34,8 @@ export default function WhatmoreRootComponent(props) {
|
|
|
34
34
|
var brandId = props.shopId;
|
|
35
35
|
const [data, setData] = useState();
|
|
36
36
|
const [error, setError] = useState();
|
|
37
|
-
const [
|
|
37
|
+
const isInstaReelView = ["27358003275", "STR60LW4WMA"];
|
|
38
|
+
const [isModalOpen, setIsModalOpen] = useState(!isInstaReelView.includes(brandId));
|
|
38
39
|
const [initialEventIndex, setInitialEventIndex] = useState(0)
|
|
39
40
|
|
|
40
41
|
var eventStatuses = "live,upcoming";
|
|
@@ -88,8 +89,8 @@ export default function WhatmoreRootComponent(props) {
|
|
|
88
89
|
|
|
89
90
|
return (
|
|
90
91
|
<>
|
|
91
|
-
{brandId
|
|
92
|
-
{(isModalOpen
|
|
92
|
+
{isInstaReelView.includes(brandId) && <EventTileWithProduct customStyles={props.customStyles} isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} events={data} setInitialEventIndex={setInitialEventIndex} />}
|
|
93
|
+
{(isModalOpen) && <EventClickComponent isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} events={data} initialEventIndex={initialEventIndex} onAction={props.onAction} /> }
|
|
93
94
|
</>
|
|
94
95
|
);
|
|
95
96
|
}
|
|
@@ -4,29 +4,26 @@ import Video from 'react-native-video';
|
|
|
4
4
|
import { useState, useRef } from 'react';
|
|
5
5
|
import ChevronRightIcon from '../../icons/icon-components/ChevronRight';
|
|
6
6
|
import ChevronLeftIcon from '../../icons/icon-components/ChevronLeft';
|
|
7
|
+
import { getGlobalState } from '../../globals/useAppState_APP';
|
|
7
8
|
|
|
8
9
|
export default function EventTileWithProduct(props) {
|
|
9
10
|
const [activeIndex, setActiveIndex] = useState(1);
|
|
10
11
|
const [renderedEvents, setRenderedEvents] = useState(5)
|
|
11
12
|
const { width } = Dimensions.get('window');
|
|
13
|
+
const customStyles = props.customStyles;
|
|
12
14
|
const ITEM_WIDTH = width * 0.33;
|
|
13
|
-
const CARD_HEIGHT =
|
|
15
|
+
const CARD_HEIGHT = 40*(customStyles?.videoTileSize ?? 5);
|
|
14
16
|
|
|
15
17
|
const styles = StyleSheet.create({
|
|
16
18
|
container: {
|
|
17
19
|
position: 'relative',
|
|
18
20
|
width: '100%',
|
|
19
|
-
height:
|
|
20
|
-
},
|
|
21
|
-
cardContainer: {
|
|
22
|
-
width: ITEM_WIDTH,
|
|
23
|
-
height: CARD_HEIGHT,
|
|
24
|
-
marginHorizontal: 8,
|
|
25
|
-
top: 20,
|
|
21
|
+
height: CARD_HEIGHT + 50,
|
|
26
22
|
},
|
|
27
23
|
arrowContainerRight: {
|
|
28
24
|
position: 'absolute',
|
|
29
|
-
top:
|
|
25
|
+
top: '50%',
|
|
26
|
+
transform: [{ translateY: -30 }],
|
|
30
27
|
right: 0,
|
|
31
28
|
width: 28,
|
|
32
29
|
height: 28,
|
|
@@ -34,7 +31,8 @@ export default function EventTileWithProduct(props) {
|
|
|
34
31
|
},
|
|
35
32
|
arrowContainerLeft: {
|
|
36
33
|
position: 'absolute',
|
|
37
|
-
top:
|
|
34
|
+
top: '50%',
|
|
35
|
+
transform: [{ translateY: -30 }],
|
|
38
36
|
width: 28,
|
|
39
37
|
height: 28,
|
|
40
38
|
marginHorizontal: 5,
|
|
@@ -45,7 +43,7 @@ export default function EventTileWithProduct(props) {
|
|
|
45
43
|
setInitialEventIndex(index);
|
|
46
44
|
setIsModalOpen(true);
|
|
47
45
|
};
|
|
48
|
-
|
|
46
|
+
|
|
49
47
|
const { events, isModalOpen, setInitialEventIndex, setIsModalOpen } = props;
|
|
50
48
|
// const [pausedVideos, setPausedVideos] = useState({});
|
|
51
49
|
// const handleVideoLoad = (index) => {
|
|
@@ -85,7 +83,6 @@ export default function EventTileWithProduct(props) {
|
|
|
85
83
|
const renderItem = ({ item, index }) => {
|
|
86
84
|
return (
|
|
87
85
|
<TouchableOpacity onPress={() => handleClick(index)} key={index}>
|
|
88
|
-
<Animated.View style={[styles.cardContainer]}>
|
|
89
86
|
<Video
|
|
90
87
|
ref={videoRef}
|
|
91
88
|
source={{ uri: item?.thumbnail_image }}
|
|
@@ -98,30 +95,29 @@ export default function EventTileWithProduct(props) {
|
|
|
98
95
|
|
|
99
96
|
style={{
|
|
100
97
|
aspectRatio: 0.5625,
|
|
101
|
-
width: "100%",
|
|
102
|
-
height: '100%',
|
|
103
98
|
borderRadius: 10,
|
|
104
99
|
transform: [{ scale: 1.1 }],
|
|
100
|
+
width: ITEM_WIDTH,
|
|
101
|
+
height: CARD_HEIGHT,
|
|
102
|
+
marginHorizontal: 5*(customStyles?.videoTileSpacing ?? 3),
|
|
103
|
+
top: 20,
|
|
105
104
|
// elevation: 1
|
|
106
|
-
|
|
107
105
|
}}
|
|
108
106
|
/>
|
|
109
|
-
</Animated.View>
|
|
110
107
|
</TouchableOpacity>
|
|
111
108
|
);
|
|
112
109
|
};
|
|
113
110
|
const flatListRef = useRef(null);
|
|
114
|
-
|
|
111
|
+
const brandDomainContext = getGlobalState('brandDomainContext')
|
|
115
112
|
return (
|
|
116
113
|
<SafeAreaView style={styles.container}>
|
|
117
114
|
<Animated.FlatList
|
|
118
115
|
horizontal
|
|
119
|
-
style={{paddingLeft: 10}}
|
|
120
116
|
data={events.slice(0,renderedEvents)}
|
|
121
117
|
renderItem={renderItem}
|
|
122
118
|
contentInsetAdjustmentBehavior="never"
|
|
123
119
|
decelerationRate="fast"
|
|
124
|
-
scrollEnabled={
|
|
120
|
+
scrollEnabled={brandDomainContext != "appmaker"}
|
|
125
121
|
automaticallyAdjustContentInsets={false}
|
|
126
122
|
showsHorizontalScrollIndicator={false}
|
|
127
123
|
scrollEventThrottle={16}
|
|
@@ -130,7 +126,7 @@ export default function EventTileWithProduct(props) {
|
|
|
130
126
|
<TouchableOpacity style={styles.arrowContainerLeft} onPress={scrollLeft}>
|
|
131
127
|
<ChevronLeftIcon />
|
|
132
128
|
</TouchableOpacity>
|
|
133
|
-
|
|
129
|
+
<TouchableOpacity style={styles.arrowContainerRight} onPress={scrollRight}>
|
|
134
130
|
<ChevronRightIcon />
|
|
135
131
|
</TouchableOpacity>
|
|
136
132
|
</SafeAreaView>
|
|
@@ -142,4 +138,8 @@ export default function EventTileWithProduct(props) {
|
|
|
142
138
|
// const index = Math.round((offsetX + ITEM_WIDTH)/ ITEM_WIDTH);
|
|
143
139
|
// setRenderedEvents(prev => prev + 1)
|
|
144
140
|
// setActiveIndex(index);
|
|
145
|
-
// };
|
|
141
|
+
// };
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
// "react-native-video": "github:freeboub/react-native-video#chore/fixAppBoot"
|