@quintype/native-components 2.19.11 → 2.19.15-chore-webview-version-pin.0
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 +9 -0
- package/package.json +4 -5
- package/src/components/JSEmbedElement/index.js +3 -1
- package/src/components/PrimaryStoryCard/index.js +30 -26
- package/src/components/PrimaryStoryCardNew/index.js +5 -2
- package/src/components/SecondaryStoryCard/index.js +32 -27
- package/src/components/SecondaryStoryCardNew/index.js +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
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.14](https://github.com/quintype/native-components/compare/v2.19.7...v2.19.14) (2022-04-04)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **story-cards:** Adds missing translations, fixes text overflow issue by adding multiline ([#179](https://github.com/quintype/native-components/issues/179)) ([93ab137](https://github.com/quintype/native-components/commit/93ab1372fad312b653e5d6d6992d625d217c9455))
|
|
11
|
+
|
|
12
|
+
### [2.19.12](https://github.com/quintype/native-components/compare/v2.19.11...v2.19.12) (2022-02-08)
|
|
13
|
+
|
|
5
14
|
### [2.19.11](https://github.com/quintype/native-components/compare/v2.19.9...v2.19.11) (2022-01-24)
|
|
6
15
|
|
|
7
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/native-components",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.15-chore-webview-version-pin.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"react-native-share": "^3.7.0",
|
|
25
25
|
"react-native-render-html": "^4.2.3",
|
|
26
26
|
"react-native-vector-icons": "^7.0.0",
|
|
27
|
-
"react-native-webview": "^10.6.0",
|
|
28
27
|
"rn-fetch-blob": "^0.10.16"
|
|
29
28
|
},
|
|
30
29
|
"peerDependencies": {
|
|
@@ -34,7 +33,7 @@
|
|
|
34
33
|
"react-native": ">=0.63.2",
|
|
35
34
|
"react-native-fast-image": ">=8.3.2",
|
|
36
35
|
"react-native-pdf": ">=6.2.0",
|
|
37
|
-
"react-native-webview": ">=
|
|
36
|
+
"react-native-webview": ">=11.0.0",
|
|
38
37
|
"rn-fetch-blob": ">=0.12.0"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
@@ -55,10 +54,10 @@
|
|
|
55
54
|
"jest": "^26.4.0",
|
|
56
55
|
"metro-react-native-babel-preset": "^0.62.0",
|
|
57
56
|
"react": "^16.13.1",
|
|
58
|
-
"react-native": "
|
|
57
|
+
"react-native": "^0.68.0",
|
|
59
58
|
"react-native-device-info": "^5.6.5",
|
|
60
59
|
"react-native-gesture-handler": "^1.9.0",
|
|
61
|
-
"react-native-svg": "^12.
|
|
60
|
+
"react-native-svg": "^12.3.0",
|
|
62
61
|
"react-navigation-hooks": "^1.1.0",
|
|
63
62
|
"react-test-renderer": "16.13.1"
|
|
64
63
|
},
|
|
@@ -81,7 +81,9 @@ export const JSEmbedElement = (props) => {
|
|
|
81
81
|
<View testID="embed-js">
|
|
82
82
|
<WebView
|
|
83
83
|
ref={webViewRef}
|
|
84
|
-
style={{
|
|
84
|
+
style={{
|
|
85
|
+
width, height, flex: 0, opacity: 0.99,
|
|
86
|
+
}}
|
|
85
87
|
automaticallyAdjustContentInsets={false}
|
|
86
88
|
scrollEnabled={false}
|
|
87
89
|
onMessage={handleOnMessage}
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { throttle } from
|
|
2
|
-
import get from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import React, { useContext } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
import Icon from 'react-native-vector-icons/FontAwesome';
|
|
1
|
+
import { throttle } from "lodash";
|
|
2
|
+
import get from "lodash/get";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import { StyleSheet, TouchableOpacity, View } from "react-native";
|
|
6
|
+
import Icon from "react-native-vector-icons/FontAwesome";
|
|
9
7
|
import {
|
|
10
8
|
AppTheme,
|
|
11
9
|
getImageMetadata,
|
|
12
10
|
getImageSlug,
|
|
13
11
|
getTimeForStoryCards,
|
|
14
|
-
} from
|
|
15
|
-
import { getStoryHeadline } from
|
|
16
|
-
import { ResponsiveImage, Text } from
|
|
17
|
-
import { storyStyles } from
|
|
18
|
-
import {
|
|
12
|
+
} from "../../utils";
|
|
13
|
+
import { getStoryHeadline } from "../../utils/story";
|
|
14
|
+
import { ResponsiveImage, Text } from "../index";
|
|
15
|
+
import { storyStyles } from "./styles";
|
|
16
|
+
import {
|
|
17
|
+
COMP_GENERAL_CONSTANTS,
|
|
18
|
+
COMP_CONTENT_CONSTANTS,
|
|
19
|
+
} from "../../constants/component-constants";
|
|
19
20
|
|
|
20
21
|
export const PrimaryStoryCard = (props) => {
|
|
21
22
|
const { story = {} } = props;
|
|
22
23
|
const { theme } = useContext(AppTheme);
|
|
23
24
|
|
|
24
|
-
const translate = get(theme, [
|
|
25
|
+
const translate = get(theme, ["translate"], (word) => word);
|
|
25
26
|
|
|
26
27
|
const { COLORS, FONT_SIZE, locale } = theme || {};
|
|
27
28
|
|
|
28
|
-
const DATE_FORMAT =
|
|
29
|
+
const DATE_FORMAT = "d MMM, yyyy";
|
|
29
30
|
|
|
30
31
|
const styles = storyStyles(COLORS, FONT_SIZE);
|
|
31
32
|
const containerStyle = StyleSheet.flatten([
|
|
@@ -41,9 +42,11 @@ export const PrimaryStoryCard = (props) => {
|
|
|
41
42
|
props.authorTextStyle,
|
|
42
43
|
]);
|
|
43
44
|
|
|
44
|
-
const name = get(story.authors, [0,
|
|
45
|
-
const authorName = name ? `${translate(
|
|
46
|
-
const readTime = story[
|
|
45
|
+
const name = get(story.authors, [0, "name"]);
|
|
46
|
+
const authorName = name ? `${translate("By")} ${name} | ` : "";
|
|
47
|
+
const readTime = story["read-time"]
|
|
48
|
+
? `${story["read-time"]} ${translate("min read")}`
|
|
49
|
+
: "";
|
|
47
50
|
|
|
48
51
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
49
52
|
|
|
@@ -60,14 +63,14 @@ export const PrimaryStoryCard = (props) => {
|
|
|
60
63
|
</View>
|
|
61
64
|
);
|
|
62
65
|
const showStoryType = () => {
|
|
63
|
-
switch (story[
|
|
64
|
-
case
|
|
66
|
+
switch (story["story-template"]) {
|
|
67
|
+
case "text":
|
|
65
68
|
return null;
|
|
66
|
-
case
|
|
67
|
-
return showIcon(
|
|
68
|
-
case
|
|
69
|
-
return showIcon(
|
|
70
|
-
case
|
|
69
|
+
case "photo":
|
|
70
|
+
return showIcon("photo");
|
|
71
|
+
case "video":
|
|
72
|
+
return showIcon("play");
|
|
73
|
+
case "live-blog":
|
|
71
74
|
return showLiveBlogIcon();
|
|
72
75
|
default:
|
|
73
76
|
null;
|
|
@@ -100,6 +103,7 @@ export const PrimaryStoryCard = (props) => {
|
|
|
100
103
|
style={autorStyle}
|
|
101
104
|
numberOfLines={2}
|
|
102
105
|
// TODO: Add corrected testID here
|
|
106
|
+
testID={COMP_CONTENT_CONSTANTS.authorName}
|
|
103
107
|
>
|
|
104
108
|
{authorName +
|
|
105
109
|
getTimeForStoryCards(
|
|
@@ -133,6 +137,6 @@ PrimaryStoryCard.propTypes = {
|
|
|
133
137
|
};
|
|
134
138
|
|
|
135
139
|
PrimaryStoryCard.defaultProps = {
|
|
136
|
-
cdn:
|
|
140
|
+
cdn: "",
|
|
137
141
|
horizontalPadding: 12,
|
|
138
142
|
};
|
|
@@ -12,7 +12,10 @@ import {
|
|
|
12
12
|
import { getStoryHeadline } from "../../utils/story";
|
|
13
13
|
import { ResponsiveImage, Text } from "../index";
|
|
14
14
|
import { storyStyles } from "./styles";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
COMP_GENERAL_CONSTANTS,
|
|
17
|
+
COMP_CONTENT_CONSTANTS,
|
|
18
|
+
} from "../../constants/component-constants";
|
|
16
19
|
|
|
17
20
|
const PrimaryStoryCardNewBase = (props) => {
|
|
18
21
|
const { story = {} } = props;
|
|
@@ -98,7 +101,7 @@ const PrimaryStoryCardNewBase = (props) => {
|
|
|
98
101
|
<Text
|
|
99
102
|
style={timestampStyle}
|
|
100
103
|
numberOfLines={2}
|
|
101
|
-
|
|
104
|
+
testID={COMP_CONTENT_CONSTANTS.publishedDate}
|
|
102
105
|
>
|
|
103
106
|
{readTime +
|
|
104
107
|
getTimeForStoryCards(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { throttle } from
|
|
2
|
-
import get from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import React, { useContext } from
|
|
1
|
+
import { throttle } from "lodash";
|
|
2
|
+
import get from "lodash/get";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
5
|
import {
|
|
6
6
|
Image,
|
|
7
7
|
StyleSheet,
|
|
@@ -9,28 +9,31 @@ import {
|
|
|
9
9
|
View,
|
|
10
10
|
TextStyle,
|
|
11
11
|
TouchableOpacityProps,
|
|
12
|
-
} from
|
|
13
|
-
import Icon from
|
|
12
|
+
} from "react-native";
|
|
13
|
+
import Icon from "react-native-vector-icons/FontAwesome";
|
|
14
14
|
import {
|
|
15
15
|
AppTheme,
|
|
16
16
|
getImageMetadata,
|
|
17
17
|
getImageSlug,
|
|
18
18
|
getTimeForStoryCards,
|
|
19
|
-
} from
|
|
20
|
-
import { getStoryHeadline } from
|
|
21
|
-
import { ResponsiveImage, Text } from
|
|
22
|
-
import { secStoryCardStyles } from
|
|
23
|
-
import {
|
|
19
|
+
} from "../../utils";
|
|
20
|
+
import { getStoryHeadline } from "../../utils/story";
|
|
21
|
+
import { ResponsiveImage, Text } from "../index";
|
|
22
|
+
import { secStoryCardStyles } from "./styles";
|
|
23
|
+
import {
|
|
24
|
+
COMP_GENERAL_CONSTANTS,
|
|
25
|
+
COMP_CONTENT_CONSTANTS,
|
|
26
|
+
} from "../../constants/component-constants";
|
|
24
27
|
|
|
25
28
|
export const SecondaryStoryCard = (props) => {
|
|
26
29
|
const { theme } = useContext(AppTheme);
|
|
27
|
-
const translate = get(theme, [
|
|
30
|
+
const translate = get(theme, ["translate"], (word) => word);
|
|
28
31
|
|
|
29
32
|
const { locale, COLORS } = theme;
|
|
30
33
|
const styles = secStoryCardStyles(theme);
|
|
31
34
|
const { story = {} } = props;
|
|
32
35
|
|
|
33
|
-
const DATE_FORMAT =
|
|
36
|
+
const DATE_FORMAT = "d MMM, yyyy";
|
|
34
37
|
|
|
35
38
|
const containerStyle = StyleSheet.flatten([
|
|
36
39
|
styles.container,
|
|
@@ -49,9 +52,11 @@ export const SecondaryStoryCard = (props) => {
|
|
|
49
52
|
styles.authorTextContainer,
|
|
50
53
|
props.authorTextContainer,
|
|
51
54
|
]);
|
|
52
|
-
const name = get(story.authors, [0,
|
|
53
|
-
const authorName = name ? `${translate(
|
|
54
|
-
const readTime = story[
|
|
55
|
+
const name = get(story.authors, [0, "name"]);
|
|
56
|
+
const authorName = name ? `${translate("By")} ${name} | ` : "";
|
|
57
|
+
const readTime = story["read-time"]
|
|
58
|
+
? `${story["read-time"]} ${translate("min read")}`
|
|
59
|
+
: "";
|
|
55
60
|
|
|
56
61
|
const throttledOnpress = throttle(props.onPress, 1000);
|
|
57
62
|
|
|
@@ -69,14 +74,14 @@ export const SecondaryStoryCard = (props) => {
|
|
|
69
74
|
);
|
|
70
75
|
|
|
71
76
|
const showStoryType = () => {
|
|
72
|
-
switch (story[
|
|
73
|
-
case
|
|
77
|
+
switch (story["story-template"]) {
|
|
78
|
+
case "text":
|
|
74
79
|
return null;
|
|
75
|
-
case
|
|
76
|
-
return showIcon(
|
|
77
|
-
case
|
|
78
|
-
return showIcon(
|
|
79
|
-
case
|
|
80
|
+
case "photo":
|
|
81
|
+
return showIcon("photo");
|
|
82
|
+
case "video":
|
|
83
|
+
return showIcon("play");
|
|
84
|
+
case "live-blog":
|
|
80
85
|
return showLiveBlogIcon();
|
|
81
86
|
default:
|
|
82
87
|
null;
|
|
@@ -92,8 +97,8 @@ export const SecondaryStoryCard = (props) => {
|
|
|
92
97
|
>
|
|
93
98
|
<ResponsiveImage
|
|
94
99
|
metaData={getImageMetadata(story)}
|
|
95
|
-
slug={getImageSlug(story) ||
|
|
96
|
-
cdn={props.cdn ||
|
|
100
|
+
slug={getImageSlug(story) || ""}
|
|
101
|
+
cdn={props.cdn || ""}
|
|
97
102
|
imageWidth={props.imageWidth}
|
|
98
103
|
>
|
|
99
104
|
<Text style={styles.xminContainer}>
|
|
@@ -119,7 +124,7 @@ export const SecondaryStoryCard = (props) => {
|
|
|
119
124
|
<Text
|
|
120
125
|
style={authorTextStyle}
|
|
121
126
|
numberOfLines={2}
|
|
122
|
-
|
|
127
|
+
testID={COMP_CONTENT_CONSTANTS.authorName}
|
|
123
128
|
>
|
|
124
129
|
{authorName +
|
|
125
130
|
getTimeForStoryCards(
|
|
@@ -148,6 +153,6 @@ SecondaryStoryCard.propTypes = TouchableOpacityProps && {
|
|
|
148
153
|
};
|
|
149
154
|
|
|
150
155
|
SecondaryStoryCard.defaultProps = {
|
|
151
|
-
cdn:
|
|
156
|
+
cdn: "",
|
|
152
157
|
horizontalPadding: 12,
|
|
153
158
|
};
|
|
@@ -19,7 +19,10 @@ import {
|
|
|
19
19
|
import { getStoryHeadline } from "../../utils/story";
|
|
20
20
|
import { ResponsiveImage, Text } from "../index";
|
|
21
21
|
import { storyStyles } from "./styles";
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
COMP_GENERAL_CONSTANTS,
|
|
24
|
+
COMP_CONTENT_CONSTANTS,
|
|
25
|
+
} from "../../constants/component-constants";
|
|
23
26
|
|
|
24
27
|
const SecondaryStoryCardNewBase = (props) => {
|
|
25
28
|
const { story = {} } = props;
|
|
@@ -106,6 +109,7 @@ const SecondaryStoryCardNewBase = (props) => {
|
|
|
106
109
|
style={timestampStyle}
|
|
107
110
|
numberOfLines={2}
|
|
108
111
|
// TODO: Add corrected testID here
|
|
112
|
+
testID={COMP_CONTENT_CONSTANTS.publishedDate}
|
|
109
113
|
>
|
|
110
114
|
{readTime +
|
|
111
115
|
getTimeForStoryCards(
|
|
@@ -127,7 +131,6 @@ SecondaryStoryCardNewBase.propTypes = TouchableOpacityProps && {
|
|
|
127
131
|
headlineStyle: TextStyle,
|
|
128
132
|
timestampStyle: TextStyle,
|
|
129
133
|
story: PropTypes.any.isRequired,
|
|
130
|
-
collectionTestID: PropTypes.string,
|
|
131
134
|
iconComponent: PropTypes.element,
|
|
132
135
|
horizontalPadding: PropTypes.number,
|
|
133
136
|
};
|