@whatmore-repo/whatmore-reactnative-sdk 1.0.23 → 1.0.25

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatmore-repo/whatmore-reactnative-sdk",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "index.js",
@@ -8,46 +8,46 @@ import CrossIcon from '../icons/icon-components/CloseIcon.jsx';
8
8
  export default function EventShoppingOverlay(props) {
9
9
  var event = props.event;
10
10
  return (
11
- <View
11
+ <View
12
12
  style={{
13
13
  width: '100%', height: '100%',
14
- flex: 1, flexDirection: 'column',
14
+ flex: 1, flexDirection: 'column',
15
15
  justifyContent: 'flex-start', alignItems: 'center'
16
16
  }}
17
17
  >
18
18
  {/* <Text style={{fontSize: 20, fontWeight: 'bold'}}> ABCD </Text> */}
19
- <View style={{
20
- width: '100%',
21
- flexDirection: 'row',
22
- justifyContent: 'space-between',
23
- alignItems: 'center',
24
- backgroundColor: 'transparent',
25
- paddingTop: 10,
26
- }}>
27
- <TouchableOpacity onPress={()=>props.setIsModalOpen(false)} style={{paddingLeft: 20}}>
28
- <CrossIcon/>
19
+ <View style={{
20
+ width: '100%',
21
+ flexDirection: 'row',
22
+ justifyContent: 'space-between',
23
+ alignItems: 'center',
24
+ backgroundColor: 'transparent',
25
+ paddingTop: 10,
26
+ }}>
27
+ <TouchableOpacity onPress={() => props.setIsModalOpen(false)} style={{ paddingLeft: 20 }}>
28
+ <CrossIcon />
29
29
  </TouchableOpacity>
30
-
30
+
31
31
  <AppMuteUnmuteIcon />
32
32
  </View>
33
33
  <View
34
34
  style={{
35
- width: '100%',
35
+ width: '100%',
36
36
  height: 'auto',
37
37
  flex: 1,
38
38
  flexDirection: 'column',
39
39
  justifyContent: 'space-between', alignItems: 'center', backgroundColor: 'transparent'
40
40
  }}
41
- >
41
+ >
42
42
  <TouchableOpacity
43
43
  style={{
44
- width: '100%',
44
+ width: '100%',
45
45
  height: 'auto',
46
46
  flex: 1,
47
47
  flexDirection: 'row',
48
48
  justifyContent: 'center', alignItems: 'center', backgroundColor: 'transparent'
49
49
  }}
50
- onPress={()=>{
50
+ onPress={() => {
51
51
  setGlobalState("isAppMuted", getGlobalState("isAppMuted") ? false : true);
52
52
  }}
53
53
  >
@@ -63,15 +63,15 @@ export default function EventShoppingOverlay(props) {
63
63
  {
64
64
  event.products.map((product, index) => {
65
65
  return (
66
- index == 0 && <ProductTileV1 setIsModalOpen={props.setIsModalOpen} key={index} onAction={props.onAction} event={event} product={product} />
66
+ index == 0 && <ProductTileV1 setIsModalOpen={props.setIsModalOpen} key={index} onAction={props.onAction} event={event} product={product} />
67
67
  );
68
68
  })
69
69
  }
70
70
  </View>
71
71
  </View>
72
-
72
+
73
73
 
74
74
  </View>
75
75
  );
76
-
76
+
77
77
  }
@@ -1,8 +1,8 @@
1
1
  import React, { useState, useEffect, lazy } from 'react';
2
-
3
2
  import { WHATMORE_BACKEND_BASE_URL } from '../constants/AppGlobalVars';
4
3
  import { extractEvents, removeInvalidEvents } from '../utils/EventSanityUtils';
5
4
  import { View } from 'react-native';
5
+ // import EventTileWithProduct from './carousel-view/EventTileWithProduct.js';
6
6
 
7
7
  const EventTileWithProduct = lazy(() => import('./carousel-view/EventTileWithProduct.js'));
8
8
  const EventClickComponent = lazy(() => import('./EventClickComponent'));
@@ -1,95 +1,114 @@
1
1
  import * as React from 'react';
2
- import { Text, TouchableOpacity, View, StyleSheet, SafeAreaView, Dimensions } from "react-native";
3
- import { getGlobalState } from '../../globals/useAppState_APP';
2
+ import { Text, TouchableOpacity, View, StyleSheet, SafeAreaView, Dimensions, ScrollView, FlatList, Animated, Image } from "react-native";
4
3
  import Video from 'react-native-video';
5
- import { useState, useEffect } from 'react';
6
- import Carousel from 'react-native-snap-carousel'
7
-
4
+ import { useState, useRef } from 'react';
5
+ import ChevronRightIcon from '../../icons/icon-components/ChevronRight';
6
+ import ChevronLeftIcon from '../../icons/icon-components/ChevronLeft';
8
7
 
9
8
  export default function EventTileWithProduct(props) {
10
-
11
- const events = props.events;
12
- const [renderedEvents, setRenderedEvents] = useState(6);
13
- const isCarousel = React.useRef(null)
14
- const videoRef = React.useRef(null);
15
-
16
- const { width, height } = Dimensions.get('window');
17
- const SLIDER_WIDTH = width + 75;
18
- const ITEM_WIDTH = Math.round(SLIDER_WIDTH * 0.3)
19
- const CARD_HEIGHT = height * 0.2;
9
+ const [activeIndex, setActiveIndex] = useState(1);
10
+ const [renderedEvents, setRenderedEvents] = useState(5)
11
+ const { width } = Dimensions.get('window');
12
+ const ITEM_WIDTH = width * 0.33;
13
+ const CARD_HEIGHT = 200;
14
+
20
15
  const styles = StyleSheet.create({
16
+ container: {
17
+ width: '100%',
18
+ height: 250,
19
+ },
21
20
  cardContainer: {
22
- borderRadius: 30,
23
- width: ITEM_WIDTH*0.7,
21
+ width: ITEM_WIDTH,
24
22
  height: CARD_HEIGHT,
25
- position: 'absolute',
26
- borderRadius: 30,
27
- elevation: 3,
28
-
29
- top: 40,
30
- transform: [{ scale: 1.3 }],
23
+ marginHorizontal: 8,
24
+ top: 20,
31
25
 
32
- },
33
- video: {
34
- width: '100%',
35
- height: '100%',
36
- borderRadius: 10,
37
- elevation: 8
38
26
  }
39
27
  });
40
28
 
41
- // const [currentIndex, setCurrentIndex] = useState(1);
29
+ const handleClick = (index) => {
30
+ setInitialEventIndex(index);
31
+ setIsModalOpen(true);
32
+ };
42
33
 
43
- // const handleVideoLoad = (index) => {
44
- // if (index !== currentIndex && videoRef.current) {
45
- // videoRef.current.setNativeProps({ paused: false });
46
-
47
- // }
48
- // };
49
- const CarouselCardItem = ({ item, index }) => {
34
+ const { events, isModalOpen, setInitialEventIndex, setIsModalOpen } = props;
35
+ const [pausedVideos, setPausedVideos] = useState({});
36
+ const handleVideoLoad = (index) => {
37
+ setPausedVideos((prevState) => ({
38
+ ...prevState,
39
+ [index]: true
40
+ }));
41
+ };
50
42
 
43
+ const renderItem = ({ item, index }) => {
51
44
  return (
52
- <TouchableOpacity onPress={()=>handleClick(props, index)} key={index}>
53
- <View style={styles.cardContainer}>
45
+ <TouchableOpacity onPress={() => handleClick(index)} key={index}>
46
+ <Animated.View style={[styles.cardContainer]}>
47
+ {
48
+ <Image src={item.poster_image}/>
49
+ }
54
50
  <Video
55
- ref={videoRef}
56
-
57
- source={{ uri: item?.thumbnail_image }}
51
+ source={{ uri: item?.thumbnail_image }}
58
52
  controls={false}
59
53
  repeat
60
54
  muted
61
- style={styles.video}
62
- // paused={!isFocused}
63
- // onLoad={() => handleVideoLoad(index)}
55
+ resizeMode={"cover"}
56
+ paused={false}
57
+ onLoad={() => handleVideoLoad(index)}
58
+
59
+ style={{
60
+ aspectRatio: 0.5625,
61
+ width: "100%",
62
+ height: '100%',
63
+ borderRadius: 10,
64
+ transform: [{ scale: 1.1 }]
65
+ }}
64
66
  />
65
- </View>
67
+ </Animated.View>
66
68
  </TouchableOpacity>
67
- )
68
- }
69
-
70
- function handleClick(props, index) {
71
- console.log('hello', index)
72
- props.setInitialEventIndex(index);
73
- props.setIsModalOpen(true);
74
- }
75
- function handleSnapToItem(index) {
76
- setRenderedEvents(prev => prev+1);
77
- }
78
-
69
+ );
70
+ };
71
+ const flatListRef = useRef(null);
72
+ const handleScroll = (event) => {
73
+ const offsetX = event.nativeEvent.contentOffset.x;
74
+ const index = Math.round(offsetX / ITEM_WIDTH);
75
+ setRenderedEvents(prev => prev + 1)
76
+ setActiveIndex(index);
77
+ };
79
78
  return (
80
- <SafeAreaView style={{width: '100%', height: 250}}>
81
- <Carousel
82
- layout="default"
83
- ref={isCarousel}
79
+ <SafeAreaView style={styles.container}>
80
+ <Animated.FlatList
81
+ horizontal
84
82
  data={events.slice(0,renderedEvents)}
85
- renderItem={CarouselCardItem}
86
- sliderWidth={SLIDER_WIDTH}
87
- itemWidth={ITEM_WIDTH}
88
- inactiveSlideShift={0}
89
- firstItem={1}
90
- useScrollView={true}
91
- onSnapToItem={handleSnapToItem}
83
+ renderItem={renderItem}
84
+ keyExtractor={(item, index) => index.toString()}
85
+ contentInsetAdjustmentBehavior="never"
86
+ decelerationRate="fast"
87
+ automaticallyAdjustContentInsets={false}
88
+ showsHorizontalScrollIndicator={false}
89
+ onScroll={handleScroll}
90
+ scrollEventThrottle={16}
91
+ ref={flatListRef}
92
92
  />
93
93
  </SafeAreaView>
94
- )
95
- }
94
+ );
95
+ }
96
+
97
+
98
+ // onScroll={Animated.event(
99
+ // [{ nativeEvent: { contentOffset: { x: scrollX } } }],
100
+ // { useNativeDriver: true }
101
+ // )}
102
+
103
+ // snapToAlignment="center"
104
+ // const scale = scrollX.interpolate({
105
+ // inputRange,
106
+ // outputRange: [0.9, 1.1, 0.9],
107
+ // extrapolate: 'clamp',
108
+ // });
109
+
110
+ // const inputRange = [
111
+ // (index - 1) * ITEM_WIDTH,
112
+ // index * ITEM_WIDTH,
113
+ // (index +1) * ITEM_WIDTH,
114
+ // ];
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Svg, Circle, Path } from 'react-native-svg';
3
+
4
+ const ChevronLeftIcon = ({ width, height, color }) => (
5
+ <Svg width={width} height={height} viewBox="0 0 24 24" fill="none">
6
+ <Circle cx="12" cy="12" r="12" fill="white" />
7
+ <Path d="M15.7071 7.70711C16.0976 7.31658 16.0976 6.68342 15.7071 6.29289C15.3166 5.90237 14.6834 5.90237 14.2929 6.29289L9.29289 11.2929C8.90237 11.6834 8.90237 12.3166 9.29289 12.7071L14.2929 17.7071C14.6834 18.0976 15.3166 18.0976 15.7071 17.7071C16.0976 17.3166 16.0976 16.6834 15.7071 16.2929L11.4142 12L15.7071 7.70711Z" fill={'black'} />
8
+ </Svg>
9
+ );
10
+
11
+ export default ChevronLeftIcon;
@@ -0,0 +1,11 @@
1
+ import { Svg, Circle, Path } from 'react-native-svg'; // Assuming you're using react-native-svg
2
+ import React from 'react';
3
+
4
+ const ChevronRightIcon = ({ width, height, color }) => (
5
+ <Svg width={width} height={height} viewBox="0 0 24 24" fill="none">
6
+ <Circle cx="12" cy="12" r="12" fill="white" />
7
+ <Path d="M8.29289 16.2929C7.90237 16.6834 7.90237 17.3166 8.29289 17.7071C8.68342 18.0976 9.31658 18.0976 9.70711 17.7071L14.7071 12.7071C15.0976 12.3166 15.0976 11.6834 14.7071 11.2929L9.70711 6.29289C9.31658 5.90237 8.68342 5.90237 8.29289 6.29289C7.90237 6.68342 7.90237 7.31658 8.29289 7.70711L12.5858 12L8.29289 16.2929Z" fill={'black'} />
8
+ </Svg>
9
+ );
10
+
11
+ export default ChevronRightIcon;