@quintype/native-components 2.19.9 → 2.19.14

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,29 @@
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
+
14
+ ### [2.19.11](https://github.com/quintype/native-components/compare/v2.19.9...v2.19.11) (2022-01-24)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **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))
20
+
21
+ ### [2.19.10](https://github.com/quintype/native-components/compare/v2.19.9...v2.19.10) (2022-01-24)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * **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))
27
+
5
28
  ### [2.19.9](https://github.com/quintype/native-components/compare/v2.19.8...v2.19.9) (2022-01-13)
6
29
 
7
30
  ### [2.19.8](https://github.com/quintype/native-components/compare/v2.19.7...v2.19.8) (2022-01-10)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.19.9",
3
+ "version": "2.19.14",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -24,7 +24,7 @@
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",
27
+ "react-native-webview": "^11.0.0",
28
28
  "rn-fetch-blob": "^0.10.16"
29
29
  },
30
30
  "peerDependencies": {
@@ -34,7 +34,7 @@
34
34
  "react-native": ">=0.63.2",
35
35
  "react-native-fast-image": ">=8.3.2",
36
36
  "react-native-pdf": ">=6.2.0",
37
- "react-native-webview": ">=10.6.0",
37
+ "react-native-webview": ">=11.0.0",
38
38
  "rn-fetch-blob": ">=0.12.0"
39
39
  },
40
40
  "devDependencies": {
@@ -55,10 +55,10 @@
55
55
  "jest": "^26.4.0",
56
56
  "metro-react-native-babel-preset": "^0.62.0",
57
57
  "react": "^16.13.1",
58
- "react-native": ">=0.63.2",
58
+ "react-native": "^0.68.0",
59
59
  "react-native-device-info": "^5.6.5",
60
60
  "react-native-gesture-handler": "^1.9.0",
61
- "react-native-svg": "^12.1.0",
61
+ "react-native-svg": "^12.3.0",
62
62
  "react-navigation-hooks": "^1.1.0",
63
63
  "react-test-renderer": "16.13.1"
64
64
  },
@@ -81,7 +81,9 @@ export const JSEmbedElement = (props) => {
81
81
  <View testID="embed-js">
82
82
  <WebView
83
83
  ref={webViewRef}
84
- style={{ width, height, flex: 0 }}
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 'lodash';
2
- import get from 'lodash/get';
3
- import PropTypes from 'prop-types';
4
- import React, { useContext } from 'react';
5
- import {
6
- StyleSheet, TouchableOpacity, View,
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
- getTimeInFormat,
14
- } from '../../utils';
15
- import { getStoryHeadline } from '../../utils/story';
16
- import { ResponsiveImage, Text } from '../index';
17
- import { storyStyles } from './styles';
18
- import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
11
+ getTimeForStoryCards,
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, ['translate'], (word) => word);
25
+ const translate = get(theme, ["translate"], (word) => word);
25
26
 
26
27
  const { COLORS, FONT_SIZE, locale } = theme || {};
27
28
 
28
- const DATE_FORMAT = 'd MMM, yyyy';
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, 'name']);
45
- const authorName = name ? `${translate('By')} ${name} | ` : '';
46
- const readTime = story['read-time'] ? `${story['read-time']} ${translate('min read')}` : '';
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['story-template']) {
64
- case 'text':
66
+ switch (story["story-template"]) {
67
+ case "text":
65
68
  return null;
66
- case 'photo':
67
- return showIcon('photo');
68
- case 'video':
69
- return showIcon('play');
70
- case 'live-blog':
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;
@@ -96,21 +99,20 @@ export const PrimaryStoryCard = (props) => {
96
99
  </Text>
97
100
  <View style={styles.storyTypeContainer}>{showStoryType()}</View>
98
101
  </ResponsiveImage>
99
-
100
- <View style={styles.authorBlockContainer}>
101
- <Text
102
- style={autorStyle}
103
- testID={COMP_GENERAL_CONSTANTS.primaryStoryAuthor}
104
- >
105
- {authorName}
106
- </Text>
107
- <Text
108
- style={autorStyle}
109
- testID={COMP_GENERAL_CONSTANTS.primaryStoryPubishedAt}
110
- >
111
- {getTimeInFormat(story['published-at'], DATE_FORMAT, locale)}
112
- </Text>
113
- </View>
102
+ <Text
103
+ style={autorStyle}
104
+ numberOfLines={2}
105
+ // TODO: Add corrected testID here
106
+ testID={COMP_CONTENT_CONSTANTS.authorName}
107
+ >
108
+ {authorName +
109
+ getTimeForStoryCards(
110
+ story["published-at"],
111
+ DATE_FORMAT,
112
+ locale,
113
+ translate
114
+ )}
115
+ </Text>
114
116
  <Text
115
117
  primary
116
118
  numberOfLines={3}
@@ -135,6 +137,6 @@ PrimaryStoryCard.propTypes = {
135
137
  };
136
138
 
137
139
  PrimaryStoryCard.defaultProps = {
138
- cdn: '',
140
+ cdn: "",
139
141
  horizontalPadding: 12,
140
142
  };
@@ -3,15 +3,11 @@ export const storyStyles = (COLORS = {}, FONT_SIZE = {}, DARK_MODE = {}) => ({
3
3
  backgroundColor: COLORS.BRAND_WHITE,
4
4
  marginTop: 12,
5
5
  },
6
- authorBlockContainer: {
7
- alignItems: 'center',
8
- flexDirection: 'row',
9
- paddingVertical: 8,
10
- },
11
6
  autorText: {
12
7
  color: COLORS?.BRAND_6,
13
8
  fontSize: FONT_SIZE.h5,
14
9
  lineHeight: FONT_SIZE.h5 * 1.3,
10
+ paddingVertical: 8,
15
11
  },
16
12
  divider: {
17
13
  backgroundColor: COLORS.BRAND_6,
@@ -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 { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
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;
@@ -37,7 +40,7 @@ const PrimaryStoryCardNewBase = (props) => {
37
40
 
38
41
  const DATE_FORMAT = "d MMM, yyyy";
39
42
  const readTime = story["read-time"]
40
- ? `${story["read-time"]} ${translate("min read")}`
43
+ ? `${story["read-time"]} ${translate("min read")} · `
41
44
  : "";
42
45
 
43
46
  const throttledOnpress = throttle(props.onPress, 1000);
@@ -95,20 +98,19 @@ const PrimaryStoryCardNewBase = (props) => {
95
98
  >
96
99
  {getStoryHeadline(story)}
97
100
  </Text>
98
- <View style={styles.timestampContainer}>
99
- {readTime ? (
100
- <Text
101
- style={timestampStyle}
102
- testID={COMP_GENERAL_CONSTANTS.primaryStoryReadTime}
103
- >{`${readTime} · `}</Text>
104
- ) : null}
105
- <Text
106
- style={timestampStyle}
107
- testID={COMP_GENERAL_CONSTANTS.primaryStoryPubishedAt}
108
- >
109
- {getTimeForStoryCards(story["published-at"], DATE_FORMAT, locale)}
110
- </Text>
111
- </View>
101
+ <Text
102
+ style={timestampStyle}
103
+ numberOfLines={2}
104
+ testID={COMP_CONTENT_CONSTANTS.publishedDate}
105
+ >
106
+ {readTime +
107
+ getTimeForStoryCards(
108
+ story["published-at"],
109
+ DATE_FORMAT,
110
+ locale,
111
+ translate
112
+ )}
113
+ </Text>
112
114
  </View>
113
115
  <View style={styles.icon}>{props.iconComponent}</View>
114
116
  </View>
@@ -12,16 +12,12 @@ export const storyStyles = (COLORS = {}, FONT_SIZE = {}) => ({
12
12
  flexShrink: 1,
13
13
  flex: 1,
14
14
  },
15
- timestampContainer: {
16
- alignItems: 'center',
17
- flexDirection: 'row',
18
- marginTop: 4,
19
- },
20
15
  timestamp: {
21
16
  color: COLORS?.BRAND_BLACK,
22
17
  fontSize: FONT_SIZE.h5,
23
18
  lineHeight: FONT_SIZE.h5 * 1.2,
24
19
  opacity: 0.6,
20
+ marginTop: 4,
25
21
  },
26
22
  headline: {
27
23
  fontSize: FONT_SIZE.title,
@@ -1,7 +1,7 @@
1
- import { throttle } from 'lodash';
2
- import get from 'lodash/get';
3
- import PropTypes from 'prop-types';
4
- import React, { useContext } from 'react';
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 'react-native';
13
- import Icon from 'react-native-vector-icons/FontAwesome';
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
- getTimeInFormat,
19
- } from '../../utils';
20
- import { getStoryHeadline } from '../../utils/story';
21
- import { ResponsiveImage, Text } from '../index';
22
- import { secStoryCardStyles } from './styles';
23
- import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants/general-constants/constants';
18
+ getTimeForStoryCards,
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, ['translate'], (word) => word);
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 = 'd MMM, yyyy';
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, 'name']);
53
- const authorName = name ? `${translate('By')} ${name} | ` : '';
54
- const readTime = story['read-time'] ? `${story['read-time']} ${translate('min read')}` : '';
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['story-template']) {
73
- case 'text':
77
+ switch (story["story-template"]) {
78
+ case "text":
74
79
  return null;
75
- case 'photo':
76
- return showIcon('photo');
77
- case 'video':
78
- return showIcon('play');
79
- case 'live-blog':
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}>
@@ -116,20 +121,19 @@ export const SecondaryStoryCard = (props) => {
116
121
  {getStoryHeadline(story)?.trim()}
117
122
  </Text>
118
123
  <View style={styles.authorAndIconContainer}>
119
- <View style={authorTextContainerStyle}>
120
- <Text
121
- style={authorTextStyle}
122
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryAuthor}
123
- >
124
- {authorName}
125
- </Text>
126
- <Text
127
- style={authorTextStyle}
128
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryPubishedAt}
129
- >
130
- {getTimeInFormat(story['published-at'], DATE_FORMAT, locale)}
131
- </Text>
132
- </View>
124
+ <Text
125
+ style={authorTextStyle}
126
+ numberOfLines={2}
127
+ testID={COMP_CONTENT_CONSTANTS.authorName}
128
+ >
129
+ {authorName +
130
+ getTimeForStoryCards(
131
+ story["published-at"],
132
+ DATE_FORMAT,
133
+ locale,
134
+ translate
135
+ )}
136
+ </Text>
133
137
  <View style={iconStyles}>{props.iconComponent}</View>
134
138
  </View>
135
139
  </View>
@@ -149,6 +153,6 @@ SecondaryStoryCard.propTypes = TouchableOpacityProps && {
149
153
  };
150
154
 
151
155
  SecondaryStoryCard.defaultProps = {
152
- cdn: '',
156
+ cdn: "",
153
157
  horizontalPadding: 12,
154
158
  };
@@ -22,10 +22,7 @@ export const secStoryCardStyles = ({ COLORS, FONT_SIZE, DARK_MODE }) => StyleShe
22
22
  lineHeight: FONT_SIZE.h6 * 1.3,
23
23
  opacity: 0.5,
24
24
  fontWeight: '500',
25
- },
26
- authorTextContainer: {
27
- alignItems: 'center',
28
- flexDirection: 'row',
25
+ paddingTop: 8,
29
26
  },
30
27
  headline: {
31
28
  color: COLORS.BRAND_BLACK,
@@ -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 { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
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;
@@ -44,7 +47,7 @@ const SecondaryStoryCardNewBase = (props) => {
44
47
 
45
48
  const DATE_FORMAT = "d MMM, yyyy";
46
49
  const readTime = story["read-time"]
47
- ? `${story["read-time"]} ${translate("min read")}`
50
+ ? `${story["read-time"]} ${translate("min read")} · `
48
51
  : "";
49
52
 
50
53
  const throttledOnpress = throttle(props.onPress, 1000);
@@ -102,20 +105,20 @@ const SecondaryStoryCardNewBase = (props) => {
102
105
  >
103
106
  {getStoryHeadline(story)?.trim()}
104
107
  </Text>
105
- <View style={styles.timestampContainer}>
106
- {readTime ? (
107
- <Text
108
- style={timestampStyle}
109
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryReadTime}
110
- >{`${readTime} · `}</Text>
111
- ) : null}
112
- <Text
113
- style={timestampStyle}
114
- testID={COMP_GENERAL_CONSTANTS.secondaryStoryPubishedAt}
115
- >
116
- {getTimeForStoryCards(story["published-at"], DATE_FORMAT, locale)}
117
- </Text>
118
- </View>
108
+ <Text
109
+ style={timestampStyle}
110
+ numberOfLines={2}
111
+ // TODO: Add corrected testID here
112
+ testID={COMP_CONTENT_CONSTANTS.publishedDate}
113
+ >
114
+ {readTime +
115
+ getTimeForStoryCards(
116
+ story["published-at"],
117
+ DATE_FORMAT,
118
+ locale,
119
+ translate
120
+ )}
121
+ </Text>
119
122
  </View>
120
123
  <View style={styles.icon}>{props.iconComponent}</View>
121
124
  </TouchableOpacity>
@@ -128,7 +131,6 @@ SecondaryStoryCardNewBase.propTypes = TouchableOpacityProps && {
128
131
  headlineStyle: TextStyle,
129
132
  timestampStyle: TextStyle,
130
133
  story: PropTypes.any.isRequired,
131
- collectionTestID: PropTypes.string,
132
134
  iconComponent: PropTypes.element,
133
135
  horizontalPadding: PropTypes.number,
134
136
  };
@@ -18,10 +18,6 @@ export const storyStyles = ({ COLORS, FONT_SIZE }) => StyleSheet.create({
18
18
  fontSize: FONT_SIZE.h5,
19
19
  lineHeight: FONT_SIZE.h5 * 1.2,
20
20
  opacity: 0.6,
21
- },
22
- timestampContainer: {
23
- alignItems: 'center',
24
- flexDirection: 'row',
25
21
  marginTop: 4,
26
22
  },
27
23
  headline: {
@@ -15,14 +15,14 @@ export function getTimeInFormat(date, format, localTime) {
15
15
  return '';
16
16
  }
17
17
 
18
- export const getTimeForStoryCards = (date, format, localTime) => {
18
+ export const getTimeForStoryCards = (date, format, localTime, translate) => {
19
19
  if (date) {
20
20
  const currentDate = new Date();
21
21
  const dateToFormat = new Date(date);
22
22
  const locale = dateFNSlocale[localTime];
23
23
  const distanceInMinutes = differenceInMinutes(currentDate, dateToFormat);
24
24
  if (distanceInMinutes <= 1440) {
25
- return `published ${formatDistanceToNow(dateToFormat, { locale })} ago`;
25
+ return `${translate("published")} ${formatDistanceToNow(dateToFormat, { locale })} ${translate("ago")}`;
26
26
  }
27
27
  return dateFormat(dateToFormat, format, { locale });
28
28
  }