@quintype/native-components 2.19.15-chore-webview-version-pin.0 → 2.19.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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.19.17](https://github.com/quintype/native-components/compare/v2.19.14...v2.19.17) (2022-06-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **story-page:** Fixes crash if image-metadata is null 🔨 ([#184](https://github.com/quintype/native-components/issues/184)) ([8f703d1](https://github.com/quintype/native-components/commit/8f703d19c90c4a5c7844e2251c6691263f9b3d4b))
|
|
11
|
+
* **story-template:** Fixed story-template-icon color :hammer: ([#182](https://github.com/quintype/native-components/issues/182)) ([95f750d](https://github.com/quintype/native-components/commit/95f750d7df5f7cc400095317be26900c0cffd3e1))
|
|
12
|
+
|
|
13
|
+
### [2.19.16](https://github.com/quintype/native-components/compare/v2.19.15...v2.19.16) (2022-05-09)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **story-template:** Fixed story-template-icon color :hammer: ([#182](https://github.com/quintype/native-components/issues/182)) ([95f750d](https://github.com/quintype/native-components/commit/95f750d7df5f7cc400095317be26900c0cffd3e1))
|
|
19
|
+
|
|
20
|
+
### [2.19.15](https://github.com/quintype/native-components/compare/v2.19.14...v2.19.15) (2022-04-12)
|
|
21
|
+
|
|
5
22
|
### [2.19.14](https://github.com/quintype/native-components/compare/v2.19.7...v2.19.14) (2022-04-04)
|
|
6
23
|
|
|
7
24
|
|
package/package.json
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import { get, throttle } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React, { useContext, memo } from
|
|
4
|
-
import { StyleSheet, TouchableOpacity, View } from
|
|
5
|
-
import Icon from
|
|
1
|
+
import { get, throttle } from 'lodash';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import React, { useContext, memo } from 'react';
|
|
4
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import Icon from 'react-native-vector-icons/FontAwesome';
|
|
6
6
|
import {
|
|
7
7
|
AppTheme,
|
|
8
8
|
getImageMetadata,
|
|
9
9
|
getImageSlug,
|
|
10
10
|
getTimeForStoryCards,
|
|
11
|
-
} from
|
|
12
|
-
import { getStoryHeadline } from
|
|
13
|
-
import { ResponsiveImage, Text } from
|
|
14
|
-
import { storyStyles } from
|
|
11
|
+
} from '../../utils';
|
|
12
|
+
import { getStoryHeadline } from '../../utils/story';
|
|
13
|
+
import { ResponsiveImage, Text } from '../index';
|
|
14
|
+
import { storyStyles } from './styles';
|
|
15
15
|
import {
|
|
16
16
|
COMP_GENERAL_CONSTANTS,
|
|
17
17
|
COMP_CONTENT_CONSTANTS,
|
|
18
|
-
} from
|
|
18
|
+
} from '../../constants/component-constants';
|
|
19
19
|
|
|
20
20
|
const PrimaryStoryCardNewBase = (props) => {
|
|
21
21
|
const { story = {} } = props;
|
|
22
22
|
const { theme } = useContext(AppTheme);
|
|
23
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
COLORS, FONT_SIZE, locale, DARK_MODE,
|
|
25
|
+
} = theme || {};
|
|
24
26
|
|
|
25
|
-
const translate = get(theme, [
|
|
27
|
+
const translate = get(theme, ['translate'], (word) => word);
|
|
26
28
|
|
|
27
29
|
const styles = storyStyles(COLORS, FONT_SIZE, DARK_MODE);
|
|
28
30
|
const containerStyle = StyleSheet.flatten([
|
|
@@ -38,16 +40,16 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
38
40
|
props.timestampStyle,
|
|
39
41
|
]);
|
|
40
42
|
|
|
41
|
-
const DATE_FORMAT =
|
|
42
|
-
const readTime = story[
|
|
43
|
-
? `${story[
|
|
44
|
-
:
|
|
43
|
+
const DATE_FORMAT = 'd MMM, yyyy';
|
|
44
|
+
const readTime = story['read-time']
|
|
45
|
+
? `${story['read-time']} ${translate('min read')} · `
|
|
46
|
+
: '';
|
|
45
47
|
|
|
46
48
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
47
49
|
|
|
48
50
|
const showIcon = (name) => (
|
|
49
51
|
<View style={styles.storyType}>
|
|
50
|
-
<Icon name={name} size={22} color={COLORS.
|
|
52
|
+
<Icon name={name} size={22} color={COLORS.MONO7} />
|
|
51
53
|
</View>
|
|
52
54
|
);
|
|
53
55
|
|
|
@@ -58,14 +60,14 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
58
60
|
</View>
|
|
59
61
|
);
|
|
60
62
|
const showStoryType = () => {
|
|
61
|
-
switch (story[
|
|
62
|
-
case
|
|
63
|
+
switch (story['story-template']) {
|
|
64
|
+
case 'text':
|
|
63
65
|
return null;
|
|
64
|
-
case
|
|
65
|
-
return showIcon(
|
|
66
|
-
case
|
|
67
|
-
return showIcon(
|
|
68
|
-
case
|
|
66
|
+
case 'photo':
|
|
67
|
+
return showIcon('photo');
|
|
68
|
+
case 'video':
|
|
69
|
+
return showIcon('play');
|
|
70
|
+
case 'live-blog':
|
|
69
71
|
return showLiveBlogIcon();
|
|
70
72
|
default:
|
|
71
73
|
null;
|
|
@@ -103,12 +105,12 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
103
105
|
numberOfLines={2}
|
|
104
106
|
testID={COMP_CONTENT_CONSTANTS.publishedDate}
|
|
105
107
|
>
|
|
106
|
-
{readTime
|
|
107
|
-
getTimeForStoryCards(
|
|
108
|
-
story[
|
|
108
|
+
{readTime
|
|
109
|
+
+ getTimeForStoryCards(
|
|
110
|
+
story['published-at'],
|
|
109
111
|
DATE_FORMAT,
|
|
110
112
|
locale,
|
|
111
|
-
translate
|
|
113
|
+
translate,
|
|
112
114
|
)}
|
|
113
115
|
</Text>
|
|
114
116
|
</View>
|
|
@@ -130,7 +132,7 @@ PrimaryStoryCardNewBase.propTypes = {
|
|
|
130
132
|
};
|
|
131
133
|
|
|
132
134
|
PrimaryStoryCardNewBase.defaultProps = {
|
|
133
|
-
cdn:
|
|
135
|
+
cdn: '',
|
|
134
136
|
horizontalPadding: 12,
|
|
135
137
|
};
|
|
136
138
|
|
|
@@ -119,8 +119,9 @@ const getStoryCards = (
|
|
|
119
119
|
)}
|
|
120
120
|
{/* Skip first card if it's a listicle */}
|
|
121
121
|
|
|
122
|
-
{source.length > 1 && isMiddleIndexOfArray(index, source) && getAd(true)}
|
|
123
|
-
{/* ^ Requesting Ad if there are multiple cards. Sending param true for mid-content ad
|
|
122
|
+
{source.length > 1 && (!STORY_TYPES.VIDEO_STORY || source.length > 2) && isMiddleIndexOfArray(index, source) && getAd(true)}
|
|
123
|
+
{/* ^ Requesting Ad if there are multiple cards. Sending param true for mid-content ad
|
|
124
|
+
If the story is from video template and have single card then not showing mid-ad */}
|
|
124
125
|
|
|
125
126
|
{(card['story-elements'] || []).map((storyElement, index, source) => {
|
|
126
127
|
/* Skip the first video element for video story */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
import { getImageHeight } from '../../utils';
|
|
3
3
|
|
|
4
|
-
export const storyImageStyles = ({ COLORS, FONT_SIZE }, metadata) => {
|
|
5
|
-
const { width, height } = metadata;
|
|
4
|
+
export const storyImageStyles = ({ COLORS, FONT_SIZE }, metadata = {}) => {
|
|
5
|
+
const { width, height } = metadata || {};
|
|
6
6
|
const imageHeight = getImageHeight(width, height);
|
|
7
7
|
|
|
8
8
|
return StyleSheet.create({
|