@whatmore-repo/whatmore-reactnative-sdk 1.0.16 → 1.0.17
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/package.json +1 -1
- package/src/components/EventShoppingView.js +9 -4
- package/src/components/EventsVerticalSwipeView.js +1 -8
- package/src/components/cta-buttons/AddToCartButton.jsx +1 -1
- package/src/components/cta-buttons/ShopNowButton.jsx +50 -0
- package/src/components/product-tiles/ProductTileV1.js +5 -16
- package/src/components/video-player/AppVideoPlayer.js +32 -16
package/package.json
CHANGED
|
@@ -3,20 +3,25 @@ import { View } from "react-native";
|
|
|
3
3
|
import AppVideoPlayer from './video-player/AppVideoPlayer.js'
|
|
4
4
|
import { useGlobalState } from '../globals/useAppState_APP.js';
|
|
5
5
|
import EventShoppingOverlay from './EventShoppingOverlay.js';
|
|
6
|
+
import { useState, useEffect } from 'react';
|
|
6
7
|
|
|
7
8
|
export default function EventShoppingView(props) {
|
|
8
9
|
const [activeSwiperIndex, setActiveSwiperIndex] = useGlobalState('verticalSwiperViewActiveIndex');
|
|
9
|
-
|
|
10
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
10
11
|
var event = props.event;
|
|
11
12
|
var eventIndex = props.eventIndex;
|
|
12
|
-
|
|
13
|
+
useEffect(()=>{
|
|
14
|
+
setIsLoading(true);
|
|
15
|
+
}, [activeSwiperIndex])
|
|
13
16
|
return (
|
|
14
17
|
<View
|
|
15
18
|
style={{
|
|
16
|
-
width: '100%', height: '100%'
|
|
19
|
+
width: '100%', height: '100%', backgroundColor: 'gray'
|
|
17
20
|
}}
|
|
18
21
|
>
|
|
19
|
-
<AppVideoPlayer videoUrl={event.event_hls_url} isMuted={activeSwiperIndex != eventIndex}
|
|
22
|
+
<AppVideoPlayer videoUrl={event.event_hls_url} isMuted={activeSwiperIndex != eventIndex}
|
|
23
|
+
isLoading={isLoading} setIsLoading={setIsLoading}
|
|
24
|
+
/>
|
|
20
25
|
<View
|
|
21
26
|
style={{
|
|
22
27
|
width: '100%', height: '100%',
|
|
@@ -5,16 +5,10 @@ import Swiper from 'react-native-swiper'
|
|
|
5
5
|
import { InView } from 'react-native-intersection-observer'
|
|
6
6
|
import EventShoppingView from './EventShoppingView.js';
|
|
7
7
|
import { setGlobalState } from '../globals/useAppState_APP.js';
|
|
8
|
-
import {handleAction} from '@appmaker-xyz/react-native';
|
|
9
8
|
|
|
10
9
|
export default function EventsVerticalSwipeView(props) {
|
|
11
10
|
const [modalVisible, setModalVisible] = React.useState(true);
|
|
12
11
|
var events = props.events;
|
|
13
|
-
function customAction(){
|
|
14
|
-
handleAction({
|
|
15
|
-
action: "OPEN_WHATMORE_SHOPPABLE"
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
12
|
return (
|
|
19
13
|
<Modal
|
|
20
14
|
style={{
|
|
@@ -23,7 +17,7 @@ export default function EventsVerticalSwipeView(props) {
|
|
|
23
17
|
width: '100%'
|
|
24
18
|
}}
|
|
25
19
|
animationType="slide"
|
|
26
|
-
transparent={
|
|
20
|
+
transparent={false}
|
|
27
21
|
visible={modalVisible}
|
|
28
22
|
onRequestClose={() => {
|
|
29
23
|
setModalVisible(!modalVisible);
|
|
@@ -38,7 +32,6 @@ export default function EventsVerticalSwipeView(props) {
|
|
|
38
32
|
loadMinimalSize={1}
|
|
39
33
|
index={props.initialEventIndex}
|
|
40
34
|
onIndexChanged={(index) => {
|
|
41
|
-
customAction()
|
|
42
35
|
setGlobalState('verticalSwiperViewActiveIndex', index);
|
|
43
36
|
}}
|
|
44
37
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getGlobalState } from "../../globals/useAppState_APP";
|
|
2
|
+
import { Text, TouchableOpacity, View } from "react-native";
|
|
3
|
+
|
|
4
|
+
function ShopNow(props){
|
|
5
|
+
const whatmorePrimaryColor = getGlobalState('whatmorePrimaryColor');
|
|
6
|
+
const whatmorePrimaryFont = getGlobalState('whatmorePrimaryFont');
|
|
7
|
+
|
|
8
|
+
const onClick = props.onClick;
|
|
9
|
+
const height = props.height;
|
|
10
|
+
|
|
11
|
+
const BOX_PADDING = 2;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<TouchableOpacity
|
|
15
|
+
style={{
|
|
16
|
+
width: '100%',
|
|
17
|
+
height: height,
|
|
18
|
+
padding: BOX_PADDING,
|
|
19
|
+
backgroundColor: whatmorePrimaryColor
|
|
20
|
+
}}
|
|
21
|
+
onPress={(e) => {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
onClick();
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<View
|
|
27
|
+
style={{
|
|
28
|
+
width: '100%',
|
|
29
|
+
height: 'auto',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
paddingVertical: 5
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Text
|
|
36
|
+
style={{
|
|
37
|
+
fontSize: 26,
|
|
38
|
+
fontWeight: 'bold',
|
|
39
|
+
fontFamily: whatmorePrimaryFont,
|
|
40
|
+
color: 'white'
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{"SHOP NOW"}
|
|
44
|
+
</Text>
|
|
45
|
+
</View>
|
|
46
|
+
</TouchableOpacity>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default ShopNow
|
|
@@ -10,6 +10,7 @@ import AddToCartButton from '../cta-buttons/AddToCartButton.jsx';
|
|
|
10
10
|
import * as Animatable from 'react-native-animatable';
|
|
11
11
|
import { navigateToProductPage } from '../../api/navigation-commands/NavigationCommands.js';
|
|
12
12
|
import {handleAction} from '@appmaker-xyz/react-native';
|
|
13
|
+
import ShopNow from '../cta-buttons/ShopNowButton.jsx';
|
|
13
14
|
|
|
14
15
|
export default function ProductTileV1(props) {
|
|
15
16
|
const event = props.event;
|
|
@@ -191,23 +192,11 @@ export default function ProductTileV1(props) {
|
|
|
191
192
|
</ScrollView>
|
|
192
193
|
}
|
|
193
194
|
|
|
194
|
-
<View style={{ flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center'
|
|
195
|
-
<
|
|
196
|
-
baseFontSize={BASE_FONT_SIZE * 0.3}
|
|
197
|
-
event={event}
|
|
198
|
-
product={product}
|
|
199
|
-
cartState={cartState['state']}
|
|
200
|
-
cartCount={cartState['cart_count']}
|
|
201
|
-
onClickAtc={(e) => {
|
|
202
|
-
if(cartState['state'] == "init"){
|
|
203
|
-
initiateVariantSelection();
|
|
204
|
-
} else if(cartState['state'] == "awaitingVariantSelection"){
|
|
205
|
-
initiateAtcApiCall(selectedOptions);
|
|
206
|
-
}
|
|
207
|
-
}}
|
|
208
|
-
onCartIconClick={initiateAtcCartIconClickAction}
|
|
195
|
+
<View style={{ flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center'}}>
|
|
196
|
+
<ShopNow
|
|
209
197
|
height={PRODUCT_TILE_TOTAL_HEIGHT * 0.3}
|
|
210
|
-
|
|
198
|
+
onClick={handleClick}
|
|
199
|
+
/>
|
|
211
200
|
</View>
|
|
212
201
|
</View>
|
|
213
202
|
</Animatable.View>
|
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import { ActivityIndicator } from 'react-native';
|
|
2
4
|
import { useGlobalState } from '../../globals/useAppState_APP';
|
|
3
5
|
import Video from 'react-native-video';
|
|
4
6
|
|
|
5
7
|
export default function AppVideoPlayer(props) {
|
|
6
8
|
const video = React.useRef(null);
|
|
7
9
|
const [isAppMuted] = useGlobalState("isAppMuted");
|
|
8
|
-
|
|
10
|
+
|
|
11
|
+
const handleLoad = () => {
|
|
12
|
+
props.setIsLoading(false);
|
|
13
|
+
}
|
|
9
14
|
return (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
<>
|
|
16
|
+
{props.isLoading && (
|
|
17
|
+
<View style={{ position: 'absolute',
|
|
18
|
+
top: '42%',
|
|
19
|
+
width: '100%', height: '100%'}}>
|
|
20
|
+
<ActivityIndicator size="large" color="#fff" />
|
|
21
|
+
</View>
|
|
22
|
+
)}
|
|
23
|
+
<Video
|
|
24
|
+
source={{uri: props.videoUrl}}
|
|
25
|
+
ref={video}
|
|
26
|
+
repeat
|
|
27
|
+
muted={isAppMuted ? true : props.isMuted}
|
|
28
|
+
controls={false}
|
|
29
|
+
resizeMode='cover'
|
|
30
|
+
style={{
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
top: 0,
|
|
33
|
+
left: 0,
|
|
34
|
+
bottom: 0,
|
|
35
|
+
right: 0,
|
|
36
|
+
width: '100%', height: '100%'
|
|
37
|
+
}}
|
|
38
|
+
onLoad={handleLoad} // Call handleLoad when video is loaded
|
|
39
|
+
/>
|
|
40
|
+
</>
|
|
25
41
|
)
|
|
26
42
|
}
|