@quintype/native-components 2.30.11-beta.0 → 2.30.11

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": "@quintype/native-components",
3
- "version": "2.30.11-beta.0",
3
+ "version": "2.30.11",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -9,6 +9,5 @@ export const CloseIcon = (props) => {
9
9
  const color = COLORS.BRAND_BLACK;
10
10
  return <Svg height={24} width={24} {...props}>
11
11
  <Path fill={color} d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" />
12
- <Path d="M0 0h24v24H0z" />
13
12
  </Svg>
14
13
  }
@@ -17,7 +17,7 @@ const CollectionCardBase = ({
17
17
  onStoryPress,
18
18
  collectionTestID,
19
19
  offset,
20
- horizontalPadding,
20
+ horizontalPadding = 12,
21
21
  initialOffset, /* Number of items to load on first load */
22
22
  hideCollectionTitle,
23
23
  }) => {
@@ -74,8 +74,4 @@ CollectionCardBase.propTypes = {
74
74
  hideCollectionTitle: PropTypes.bool,
75
75
  };
76
76
 
77
- CollectionCardBase.defaultProps = {
78
- horizontalPadding: 12,
79
- };
80
-
81
77
  export const CollectionCard = memo(CollectionCardBase);
@@ -10,11 +10,12 @@ import { Text } from '../index';
10
10
  import { collectionTitleStyles } from './styles';
11
11
 
12
12
  const CollectionTitleBase = (props) => {
13
+ const horizontalPadding = props.horizontalPadding ?? 12;
13
14
  const { theme } = useContext(AppTheme);
14
15
  const styles = collectionTitleStyles(theme);
15
16
  const containerStyle = StyleSheet.flatten([
16
17
  styles.container,
17
- { paddingHorizontal: props.horizontalPadding },
18
+ { paddingHorizontal: horizontalPadding },
18
19
  ]);
19
20
  const titleStyle = StyleSheet.flatten([styles.title, props.titleStyle]);
20
21
 
@@ -36,8 +37,4 @@ CollectionTitleBase.propTypes = TouchableOpacityProps
36
37
  horizontalPadding: PropTypes.number,
37
38
  };
38
39
 
39
- CollectionTitleBase.defaultProps = {
40
- horizontalPadding: 12,
41
- };
42
-
43
40
  export const CollectionTitle = memo(CollectionTitleBase);
@@ -1,8 +1,7 @@
1
1
  import PropTypes from "prop-types";
2
2
  import React, { useContext } from "react";
3
- import { Switch, View } from "react-native";
3
+ import { Platform, Switch, View } from "react-native";
4
4
  import Icon from "react-native-vector-icons/FontAwesome";
5
- import { Platform } from "react-native";
6
5
 
7
6
  import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
8
7
  import { AppTheme } from "../../utils";
@@ -21,9 +20,9 @@ export const CustomSwitch = ({
21
20
  const { COLORS } = theme;
22
21
  const styles = customSwitchStyles();
23
22
 
24
- const handleToggle = () => {
23
+ const handleToggle = (nextValue) => {
25
24
  if (typeof callback === "function") {
26
- callback(!isEnabled);
25
+ callback(nextValue);
27
26
  }
28
27
  };
29
28
 
@@ -12,7 +12,6 @@ export const relatedStoriesStyles = (appThemeContext) => {
12
12
  marginVertical: 8,
13
13
  },
14
14
  relatedStoriesContainer: {
15
- paddingHorizontal: 8,
16
15
  paddingBottom: 20,
17
16
  },
18
17
  });
@@ -25,6 +25,7 @@ import PremiumIcons from '../../Icons/PremiumIcons/index';
25
25
 
26
26
  const SecondaryStoryCardBase = (props) => {
27
27
  const { story = {} } = props;
28
+ const horizontalPadding = props.horizontalPadding ?? 12;
28
29
  const { theme } = useContext(AppTheme);
29
30
  const {
30
31
  COLORS,
@@ -36,7 +37,7 @@ const SecondaryStoryCardBase = (props) => {
36
37
  const styles = storyStyles(theme);
37
38
  const containerStyle = StyleSheet.flatten([
38
39
  styles.container,
39
- { paddingHorizontal: props.horizontalPadding },
40
+ { paddingHorizontal: horizontalPadding },
40
41
  ]);
41
42
  const headlineStyle = StyleSheet.flatten([
42
43
  styles.headline,
@@ -93,7 +94,7 @@ const SecondaryStoryCardBase = (props) => {
93
94
  </View>
94
95
  <View style={styles.icon}>{props.iconComponent}</View>
95
96
  </TouchableOpacity>
96
- <View style={[styles.separatorLine, { marginHorizontal: props.horizontalPadding }]} />
97
+ <View style={[styles.separatorLine, { marginHorizontal: horizontalPadding }]} />
97
98
  </>
98
99
  );
99
100
  };
@@ -106,9 +107,4 @@ SecondaryStoryCardBase.propTypes = TouchableOpacityProps && {
106
107
  horizontalPadding: PropTypes.number,
107
108
  };
108
109
 
109
- SecondaryStoryCardBase.defaultProps = {
110
- cdn: '',
111
- horizontalPadding: 12,
112
- };
113
-
114
- export const SecondaryStoryCard = memo(SecondaryStoryCardBase);
110
+ export const SecondaryStoryCard = memo(SecondaryStoryCardBase);
@@ -69,26 +69,6 @@ export const StoryGallery = ({ cdn, card }) => {
69
69
  );
70
70
  };
71
71
 
72
- const handleScroll = (event) => {
73
- const xOffset = event.nativeEvent?.contentOffset?.x;
74
- const contentWidth = event.nativeEvent?.contentSize?.width;
75
- const layoutWidth = event.nativeEvent?.layoutMeasurement?.width;
76
- const value = xOffset / contentWidth;
77
- const leftThreshold = contentWidth / (2 * totalSlides);
78
- const rightThreshold = contentWidth - 1.5 * layoutWidth;
79
-
80
- if (
81
- leftThreshold <= xOffset
82
- && (layoutWidth > xOffset || rightThreshold > xOffset)
83
- ) {
84
- setCurrentTabIndex(value * totalSlides);
85
- } else if (xOffset < leftThreshold) {
86
- setCurrentTabIndex(0);
87
- } else if (xOffset >= rightThreshold) {
88
- setCurrentTabIndex(totalSlides - 1);
89
- }
90
- };
91
-
92
72
  const closeModalHandler = () => {
93
73
  setShowModal(false);
94
74
  setCurrentTabIndex(0);
@@ -140,7 +120,7 @@ export const StoryGallery = ({ cdn, card }) => {
140
120
 
141
121
  const style = galleryStyles.fullWidth;
142
122
  return (
143
- <TouchableOpacity style={[galleryStyles.subContainer,{margin:4}]}>
123
+ <TouchableOpacity style={[galleryStyles.subContainer, { margin: 4 }]}>
144
124
  <LightBoxImage
145
125
  onClickHandler={onPressHandler}
146
126
  hero={!!data.metaData['focus-point']}
@@ -204,7 +184,13 @@ export const StoryGallery = ({ cdn, card }) => {
204
184
  keyExtractor={(item) => item.id}
205
185
  horizontal
206
186
  extraData={currentIndex}
207
- onScroll={handleScroll}
187
+ onMomentumScrollEnd={(event) => {
188
+ const index = Math.round(
189
+ event.nativeEvent.contentOffset.x /
190
+ event.nativeEvent.layoutMeasurement.width
191
+ );
192
+ setCurrentTabIndex(index);
193
+ }}
208
194
  initialScrollIndex={index}
209
195
  onScrollToIndexFailed={(info) => {
210
196
  const wait = new Promise((resolve) => setTimeout(resolve, 500));
@@ -12,11 +12,10 @@ import { STORY_TYPES } from '../../utils/story-types';
12
12
  import { YouTubePlayer } from '../YouTubePlayer';
13
13
  import {
14
14
  AuthorRow, ResponsiveImage,
15
- StoryTitle, Text
15
+ StoryTitle, Text, JSEmbedElement
16
16
  } from '../index';
17
17
  import { storyHeaderStyles } from './styles';
18
18
 
19
- import { DailyMotionPlayer } from '../DailyMotionPlayer';
20
19
  import { RatingLayout } from '../Rating';
21
20
  import CustomHtmlParser from './../Html/index';
22
21
 
@@ -44,7 +43,7 @@ const getHeroComponent = (props) => {
44
43
  if (!firstVideoElement) return null;
45
44
  switch (firstVideoElement.type) {
46
45
  case 'jsembed': {
47
- return <DailyMotionPlayer element={firstVideoElement} />;
46
+ return <JSEmbedElement element={firstVideoElement} appReferer={appReferer} />;
48
47
  }
49
48
  case 'youtube-video': {
50
49
  return (
@@ -20,7 +20,7 @@ const TwoColLayoutBase = ({
20
20
  onStoryPress,
21
21
  collectionTestID,
22
22
  offset,
23
- horizontalPadding,
23
+ horizontalPadding = 12,
24
24
  initialOffset,
25
25
  hideCollectionTitle,
26
26
  }) => {
@@ -96,8 +96,4 @@ TwoColLayoutBase.propTypes = {
96
96
  hideCollectionTitle: PropTypes.bool,
97
97
  };
98
98
 
99
- TwoColLayoutBase.defaultProps = {
100
- horizontalPadding: 12,
101
- };
102
-
103
99
  export const TwoColLayout = memo(TwoColLayoutBase);
@@ -7,7 +7,7 @@ export const alterQuoteData = (node) => {
7
7
 
8
8
  const bigFactAttribution = parent.attribs.class === 'bigfact-description';
9
9
 
10
- if (parent && parent.name === 'span' && attribution) return ' ';
10
+ if (parent && parent.name === 'span' && attribution) return '\n';
11
11
 
12
- if (parent && parent.name === 'div' && bigFactAttribution) return ' ';
12
+ if (parent && parent.name === 'div' && bigFactAttribution) return '\n';
13
13
  };