@quintype/native-components 2.20.0-fix-rtl-issues.2 → 2.20.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 +122 -0
- package/package.json +7 -8
- package/src/Icons/ClockIcon/index.js +9 -5
- package/src/components/ActionText/ActionText.js +7 -9
- package/src/components/ActionText/ActionText.test.js +5 -12
- package/src/components/AlsoRead/index.js +1 -1
- package/src/components/AlsoRead/styles.js +2 -0
- package/src/components/AuthorRow/AuthorRow.test.js +4 -9
- package/src/components/AuthorRow/index.js +16 -12
- package/src/components/BackNavigator/styles.js +2 -0
- package/src/components/Button/index.js +13 -9
- package/src/components/CollectionCard/index.js +6 -1
- package/src/components/CollectionCardNew/index.js +5 -1
- package/src/components/CollectionTitleNew/styles.js +0 -1
- package/src/components/CustomSwitch/index.js +16 -10
- package/src/components/Header/index.js +13 -9
- package/src/components/JSEmbedElement/index.js +3 -1
- package/src/components/PDFReader/styles.js +1 -0
- package/src/components/PrimaryStoryCard/index.js +60 -24
- package/src/components/PrimaryStoryCard/styles.js +29 -5
- package/src/components/PrimaryStoryCardNew/index.js +74 -29
- package/src/components/PrimaryStoryCardNew/styles.js +29 -5
- package/src/components/RadioButton/index.js +24 -9
- package/src/components/SecondaryStoryCard/index.js +60 -22
- package/src/components/SecondaryStoryCard/styles.js +29 -4
- package/src/components/SecondaryStoryCardNew/index.js +78 -31
- package/src/components/SecondaryStoryCardNew/styles.js +28 -4
- package/src/components/ShareButton/index.js +8 -3
- package/src/components/SlideshowStoryCard/styles.js +3 -2
- package/src/components/Story/index.js +14 -10
- package/src/components/StoryHeader/index.js +9 -7
- package/src/components/StoryHeader/styles.js +4 -2
- package/src/components/StoryImage/index.js +1 -1
- package/src/components/StoryImage/styles.js +2 -2
- package/src/components/StoryText/styles.js +2 -0
- package/src/components/Table/index.js +1 -1
- package/src/components/Table/styles.js +5 -2
- package/src/components/TextBigFact/index.js +1 -2
- package/src/components/TextBigFact/styles.js +3 -0
- package/src/components/TextBlockQuote/index.js +5 -4
- package/src/components/TextBlockQuote/styles.js +8 -0
- package/src/components/TextBlurb/styles.js +2 -0
- package/src/components/TextQandA/styles.js +3 -3
- package/src/components/TextQuote/styles.js +5 -2
- package/src/components/TextSummary/styles.js +2 -0
- package/src/components/YouTubePlayer/index.js +1 -0
- package/src/constants/component-constants/content-constants/constants.js +7 -5
- package/src/constants/component-constants/general-constants/constants.js +25 -14
- package/src/constants/renderHTML.js +10 -0
- package/src/utils/story.js +7 -3
- package/src/utils/timeUtils.js +13 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,128 @@
|
|
|
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.20.0](https://github.com/quintype/native-components/compare/v2.19.28...v2.20.0) (2023-01-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **enhancement:** Adds toggles for hideCollectionTitle, readTime, shareButton 🔧 ([#193](https://github.com/quintype/native-components/issues/193)) ([53fcafc](https://github.com/quintype/native-components/commit/53fcafc2d8546abb5eea1e36820dc37c22436644))
|
|
11
|
+
|
|
12
|
+
### [2.19.28](https://github.com/quintype/native-components/compare/v2.19.27...v2.19.28) (2022-12-28)
|
|
13
|
+
|
|
14
|
+
### [2.19.27](https://github.com/quintype/native-components/compare/v2.19.26...v2.19.27) (2022-12-16)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **time-util:** Fix spacing for time-distance from now :hammer: ([67d9f37](https://github.com/quintype/native-components/commit/67d9f37459ee220f3c1ef1dd38b12ca7b65cf50e))
|
|
20
|
+
|
|
21
|
+
### [2.19.26](https://github.com/quintype/native-components/compare/v2.19.25...v2.19.26) (2022-12-16)
|
|
22
|
+
|
|
23
|
+
### [2.19.25](https://github.com/quintype/native-components/compare/v2.19.24...v2.19.25) (2022-12-07)
|
|
24
|
+
|
|
25
|
+
### [2.19.24](https://github.com/quintype/native-components/compare/v2.19.23...v2.19.24) (2022-12-06)
|
|
26
|
+
|
|
27
|
+
### [2.19.23](https://github.com/quintype/native-components/compare/v2.19.22...v2.19.23) (2022-12-06)
|
|
28
|
+
|
|
29
|
+
### [2.19.22](https://github.com/quintype/native-components/compare/v2.19.21...v2.19.22) (2022-12-06)
|
|
30
|
+
|
|
31
|
+
### [2.19.21](https://github.com/quintype/native-components/compare/v2.19.20...v2.19.21) (2022-11-18)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* **fonts:** Fixes fonts for CollectionTitle and Caption/Attribution HTML 🔨 ([#188](https://github.com/quintype/native-components/issues/188)) ([94c61ff](https://github.com/quintype/native-components/commit/94c61ff385df2225f6a3d1b14c1f5d2ce3a1ed89))
|
|
37
|
+
|
|
38
|
+
### [2.19.20](https://github.com/quintype/native-components/compare/v2.19.19...v2.19.20) (2022-11-07)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* **android:** Fixes Nov 4 critical issue that breaks Android :hammer: ([e6d6c27](https://github.com/quintype/native-components/commit/e6d6c27e55ddbe9542ef3c7733273e4bbe9a1aa2))
|
|
44
|
+
|
|
45
|
+
### [2.19.19](https://github.com/quintype/native-components/compare/v2.19.18...v2.19.19) (2022-08-24)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
49
|
+
|
|
50
|
+
* **Ads:** Change midcontentAd logic for video-story :hammer: ([#186](https://github.com/quintype/native-components/issues/186)) ([b04a16c](https://github.com/quintype/native-components/commit/b04a16cb74f06c3a3f5639df31b39b2ecd4b6704))
|
|
51
|
+
* **deps:** Fixes dependency-conflict due to incorrect react-native version :hammer: ([b43e8ae](https://github.com/quintype/native-components/commit/b43e8ae0e4cf92d3fce21336c3cdd6c2d73db582))
|
|
52
|
+
|
|
53
|
+
### [2.19.18](https://github.com/quintype/native-components/compare/v2.19.17...v2.19.18) (2022-07-04)
|
|
54
|
+
|
|
55
|
+
### [2.19.17](https://github.com/quintype/native-components/compare/v2.19.14...v2.19.17) (2022-06-29)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Bug Fixes
|
|
59
|
+
|
|
60
|
+
* **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))
|
|
61
|
+
* **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))
|
|
62
|
+
|
|
63
|
+
### [2.19.16](https://github.com/quintype/native-components/compare/v2.19.15...v2.19.16) (2022-05-09)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* **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))
|
|
69
|
+
|
|
70
|
+
### [2.19.15](https://github.com/quintype/native-components/compare/v2.19.14...v2.19.15) (2022-04-12)
|
|
71
|
+
|
|
72
|
+
### [2.19.14](https://github.com/quintype/native-components/compare/v2.19.7...v2.19.14) (2022-04-04)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
* **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))
|
|
78
|
+
|
|
79
|
+
### [2.19.12](https://github.com/quintype/native-components/compare/v2.19.11...v2.19.12) (2022-02-08)
|
|
80
|
+
|
|
81
|
+
### [2.19.11](https://github.com/quintype/native-components/compare/v2.19.9...v2.19.11) (2022-01-24)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Bug Fixes
|
|
85
|
+
|
|
86
|
+
* **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))
|
|
87
|
+
|
|
88
|
+
### [2.19.10](https://github.com/quintype/native-components/compare/v2.19.9...v2.19.10) (2022-01-24)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Bug Fixes
|
|
92
|
+
|
|
93
|
+
* **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))
|
|
94
|
+
|
|
95
|
+
### [2.19.9](https://github.com/quintype/native-components/compare/v2.19.8...v2.19.9) (2022-01-13)
|
|
96
|
+
|
|
97
|
+
### [2.19.8](https://github.com/quintype/native-components/compare/v2.19.7...v2.19.8) (2022-01-10)
|
|
98
|
+
|
|
99
|
+
### [2.19.7](https://github.com/quintype/native-components/compare/v2.19.0...v2.19.7) (2022-01-07)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
### Bug Fixes
|
|
103
|
+
|
|
104
|
+
* **AlsoRead:** Changed dark-mode color for the text :hammer: ([#170](https://github.com/quintype/native-components/issues/170)) ([67f1e61](https://github.com/quintype/native-components/commit/67f1e61fd4b76ea6fa65f565006214981d0bb8a8))
|
|
105
|
+
* **AlsoRead:** Fixed card height :hammer: ([#174](https://github.com/quintype/native-components/issues/174)) ([6ce7a60](https://github.com/quintype/native-components/commit/6ce7a6078ec699f0f3df74d8136fc64070921caa))
|
|
106
|
+
* **Navigator:** Fixed Section title text overflow :hammer: ([#176](https://github.com/quintype/native-components/issues/176)) ([249672b](https://github.com/quintype/native-components/commit/249672b44f6559190e930fc78a11d83a8e94c009))
|
|
107
|
+
* **old-UI:** Fixes all padding/image-aspect-ratio inconsistencies 🔨 ([#169](https://github.com/quintype/native-components/issues/169)) ([f3b8850](https://github.com/quintype/native-components/commit/f3b88507c02985ff83aadd266e0dbd04438fd441))
|
|
108
|
+
|
|
109
|
+
### [2.19.6](https://github.com/quintype/native-components/compare/v2.19.5...v2.19.6) (2021-12-30)
|
|
110
|
+
|
|
111
|
+
### [2.19.5](https://github.com/quintype/native-components/compare/v2.19.3...v2.19.5) (2021-12-29)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Bug Fixes
|
|
115
|
+
|
|
116
|
+
* **Navigator:** Fixed Section title text overflow :hammer: ([#176](https://github.com/quintype/native-components/issues/176)) ([249672b](https://github.com/quintype/native-components/commit/249672b44f6559190e930fc78a11d83a8e94c009))
|
|
117
|
+
|
|
118
|
+
### [2.19.3](https://github.com/quintype/native-components/compare/v2.18.4...v2.19.3) (2021-10-28)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Bug Fixes
|
|
122
|
+
|
|
123
|
+
* **AlsoRead:** Changed dark-mode color for the text :hammer: ([#170](https://github.com/quintype/native-components/issues/170)) ([67f1e61](https://github.com/quintype/native-components/commit/67f1e61fd4b76ea6fa65f565006214981d0bb8a8))
|
|
124
|
+
* **AlsoRead:** Fixed card height :hammer: ([#174](https://github.com/quintype/native-components/issues/174)) ([6ce7a60](https://github.com/quintype/native-components/commit/6ce7a6078ec699f0f3df74d8136fc64070921caa))
|
|
125
|
+
* **old-UI:** Fixes all padding/image-aspect-ratio inconsistencies 🔨 ([#169](https://github.com/quintype/native-components/issues/169)) ([f3b8850](https://github.com/quintype/native-components/commit/f3b88507c02985ff83aadd266e0dbd04438fd441))
|
|
126
|
+
|
|
5
127
|
### [2.19.2](https://github.com/quintype/native-components/compare/v2.19.1...v2.19.2) (2021-10-19)
|
|
6
128
|
|
|
7
129
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/native-components",
|
|
3
|
-
"version": "2.20.0
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,17 +24,16 @@
|
|
|
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": {
|
|
31
30
|
"@react-navigation/native": ">=5.7.3",
|
|
32
31
|
"lodash": ">=4.17.20",
|
|
33
|
-
"react": ">=
|
|
34
|
-
"react-native": ">=0.
|
|
32
|
+
"react": ">=17.0.2",
|
|
33
|
+
"react-native": ">=0.67.5",
|
|
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": {
|
|
@@ -54,11 +53,11 @@
|
|
|
54
53
|
"husky": "^4.2.5",
|
|
55
54
|
"jest": "^26.4.0",
|
|
56
55
|
"metro-react-native-babel-preset": "^0.62.0",
|
|
57
|
-
"react": "
|
|
58
|
-
"react-native": "
|
|
56
|
+
"react": "17.0.2",
|
|
57
|
+
"react-native": "0.67.4",
|
|
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
|
},
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import Svg, { Path } from 'react-native-svg';
|
|
3
|
+
import { AppTheme } from "../../utils/context";
|
|
3
4
|
|
|
4
|
-
export const ClockIcon = (props) =>
|
|
5
|
-
|
|
5
|
+
export const ClockIcon = (props) => {
|
|
6
|
+
const { theme } = useContext(AppTheme);
|
|
7
|
+
const { COLORS } = theme;
|
|
8
|
+
const color = COLORS.BRAND_BLACK;
|
|
9
|
+
return <Svg width={24} height={24} {...props}>
|
|
6
10
|
<Path
|
|
7
|
-
fill=
|
|
11
|
+
fill={color}
|
|
8
12
|
d="M12 4.25c1.396 0 2.687.349 3.875 1.047a7.831 7.831 0 012.828 2.828A7.513 7.513 0 0119.75 12a7.513 7.513 0 01-1.047 3.875 7.831 7.831 0 01-2.828 2.828A7.513 7.513 0 0112 19.75a7.513 7.513 0 01-3.875-1.047 7.831 7.831 0 01-2.828-2.828A7.513 7.513 0 014.25 12c0-1.396.349-2.687 1.047-3.875a7.831 7.831 0 012.828-2.828A7.513 7.513 0 0112 4.25zM18.75 12a6.58 6.58 0 00-.906-3.39 6.72 6.72 0 00-2.469-2.454 6.641 6.641 0 00-3.39-.906 6.558 6.558 0 00-3.376.906 6.72 6.72 0 00-2.453 2.469 6.641 6.641 0 00-.906 3.39c0 1.22.302 2.344.906 3.376a6.72 6.72 0 002.469 2.453 6.641 6.641 0 003.39.906 6.558 6.558 0 003.376-.906 6.72 6.72 0 002.453-2.469A6.613 6.613 0 0018.75 12zm-4.656 2.75l-2.532-1.844a.307.307 0 01-.156-.281v-5c0-.104.037-.193.11-.266a.362.362 0 01.265-.109h.438c.104 0 .192.036.265.11.073.072.11.16.11.265v4.563l2.218 1.625a.33.33 0 01.141.234.349.349 0 01-.038.202l-.29.439a.342.342 0 01-.25.14.389.389 0 01-.281-.078z"
|
|
9
13
|
/>
|
|
10
14
|
</Svg>
|
|
11
|
-
|
|
15
|
+
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { throttle } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import React from
|
|
4
|
-
import { TouchableOpacity } from
|
|
1
|
+
import { throttle } from "lodash";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { TouchableOpacity } from "react-native";
|
|
5
|
+
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
|
|
5
6
|
|
|
6
|
-
export const ActionText = ({
|
|
7
|
-
onPress, endPoint, children, actionTextID, disablePress,
|
|
8
|
-
}) => {
|
|
7
|
+
export const ActionText = ({ onPress, endPoint, children, disablePress }) => {
|
|
9
8
|
const handleTagPress = () => onPress(endPoint);
|
|
10
9
|
const throttledOnpress = throttle(handleTagPress, 1000);
|
|
11
10
|
|
|
12
11
|
return (
|
|
13
12
|
<TouchableOpacity
|
|
14
13
|
onPress={throttledOnpress}
|
|
15
|
-
testID={
|
|
14
|
+
testID={COMP_GENERAL_CONSTANTS.actionTextTouch}
|
|
16
15
|
disabled={disablePress}
|
|
17
16
|
>
|
|
18
17
|
{children}
|
|
@@ -25,5 +24,4 @@ ActionText.propTypes = {
|
|
|
25
24
|
endPoint: PropTypes.object,
|
|
26
25
|
disablePress: PropTypes.bool,
|
|
27
26
|
children: PropTypes.any,
|
|
28
|
-
actionTextID: PropTypes.string,
|
|
29
27
|
};
|
|
@@ -4,22 +4,19 @@ import 'react-native';
|
|
|
4
4
|
import { mockContext } from '../../utils';
|
|
5
5
|
import { Text } from '../Text';
|
|
6
6
|
import { ActionText } from './ActionText';
|
|
7
|
+
import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants';
|
|
7
8
|
|
|
8
9
|
describe('Test Action Text :', () => {
|
|
9
10
|
test('should render properly :', () => {
|
|
10
11
|
const throttle = jest.fn();
|
|
11
12
|
const { getByTestId } = render(
|
|
12
13
|
mockContext(
|
|
13
|
-
<ActionText
|
|
14
|
-
onPress={throttle}
|
|
15
|
-
endPoint={{ slug: '/sample-data' }}
|
|
16
|
-
actionTextID="actionText"
|
|
17
|
-
>
|
|
14
|
+
<ActionText onPress={throttle} endPoint={{ slug: '/sample-data' }}>
|
|
18
15
|
<Text testID="sampleText">Sample Data</Text>
|
|
19
16
|
</ActionText>,
|
|
20
17
|
),
|
|
21
18
|
);
|
|
22
|
-
const element = getByTestId(
|
|
19
|
+
const element = getByTestId(COMP_GENERAL_CONSTANTS.actionTextTouch);
|
|
23
20
|
expect(element.props.children).toBeDefined();
|
|
24
21
|
});
|
|
25
22
|
|
|
@@ -27,17 +24,13 @@ describe('Test Action Text :', () => {
|
|
|
27
24
|
const throttle = await jest.fn();
|
|
28
25
|
const { getByTestId } = render(
|
|
29
26
|
mockContext(
|
|
30
|
-
<ActionText
|
|
31
|
-
onPress={throttle}
|
|
32
|
-
endPoint={{ slug: '/sample-data' }}
|
|
33
|
-
actionTextID="actionText"
|
|
34
|
-
>
|
|
27
|
+
<ActionText onPress={throttle} endPoint={{ slug: '/sample-data' }}>
|
|
35
28
|
<Text testID="sampleText">Sample Data</Text>
|
|
36
29
|
</ActionText>,
|
|
37
30
|
),
|
|
38
31
|
);
|
|
39
32
|
|
|
40
|
-
const element = getByTestId(
|
|
33
|
+
const element = getByTestId(COMP_GENERAL_CONSTANTS.actionTextTouch);
|
|
41
34
|
fireEvent(element, 'press');
|
|
42
35
|
expect(throttle).toHaveBeenCalled();
|
|
43
36
|
});
|
|
@@ -58,7 +58,7 @@ export const AlsoRead = (props) => {
|
|
|
58
58
|
{getImageComponent()}
|
|
59
59
|
<View style={styles.alsoReadContentWrapper}>
|
|
60
60
|
<Text style={styles.alsoReadText}>{translate("Also Read")}</Text>
|
|
61
|
-
<Text primary numberOfLines={
|
|
61
|
+
<Text primary numberOfLines={2} style={styles.alsoReadTitle}>
|
|
62
62
|
{text}
|
|
63
63
|
</Text>
|
|
64
64
|
</View>
|
|
@@ -13,10 +13,12 @@ export const alsoReadStyles = (COLORS, FONT_SIZE, DARK_MODE) => StyleSheet.creat
|
|
|
13
13
|
},
|
|
14
14
|
alsoReadText: {
|
|
15
15
|
fontSize: FONT_SIZE.h2,
|
|
16
|
+
fontWeight: 'bold',
|
|
16
17
|
color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_1,
|
|
17
18
|
},
|
|
18
19
|
alsoReadTitle: {
|
|
19
20
|
fontSize: FONT_SIZE.h2,
|
|
21
|
+
color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_1,
|
|
20
22
|
},
|
|
21
23
|
fallBackImageWrapper: {
|
|
22
24
|
backgroundColor: COLORS.BRAND_WHITE,
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import 'react-native';
|
|
4
4
|
import { mockContext } from '../../utils';
|
|
5
5
|
import { AuthorRow } from './index';
|
|
6
|
+
import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants';
|
|
6
7
|
|
|
7
8
|
const data = [
|
|
8
9
|
{
|
|
@@ -26,15 +27,9 @@ const data = [
|
|
|
26
27
|
describe('Test Author Row :', () => {
|
|
27
28
|
test('should render Author name properly', () => {
|
|
28
29
|
const { getByTestId } = render(
|
|
29
|
-
mockContext(
|
|
30
|
-
<AuthorRow
|
|
31
|
-
authors={data}
|
|
32
|
-
authorNameTestID="authorName"
|
|
33
|
-
cdn="gumlet.assettype.com"
|
|
34
|
-
/>,
|
|
35
|
-
),
|
|
30
|
+
mockContext(<AuthorRow authors={data} cdn="gumlet.assettype.com" />),
|
|
36
31
|
);
|
|
37
|
-
const element = getByTestId(
|
|
32
|
+
const element = getByTestId(COMP_CONTENT_CONSTANTS.authorName);
|
|
38
33
|
expect(element.props.children).toBe('Raghavendra Vaidya');
|
|
39
34
|
});
|
|
40
35
|
|
|
@@ -49,7 +44,7 @@ describe('Test Author Row :', () => {
|
|
|
49
44
|
/>,
|
|
50
45
|
),
|
|
51
46
|
);
|
|
52
|
-
const element = getByTestId(
|
|
47
|
+
const element = getByTestId(COMP_CONTENT_CONSTANTS.authorImage);
|
|
53
48
|
expect(element.props.children).toBeDefined();
|
|
54
49
|
});
|
|
55
50
|
});
|
|
@@ -7,20 +7,18 @@ import { ActionText } from '../ActionText/ActionText';
|
|
|
7
7
|
|
|
8
8
|
import { authorRowStyleSheet } from './styles';
|
|
9
9
|
import { AppTheme } from '../../utils';
|
|
10
|
+
import { COMP_CONTENT_CONSTANTS } from '../../constants/component-constants/content-constants/constants';
|
|
10
11
|
|
|
11
12
|
export const AuthorRow = ({
|
|
12
13
|
authors,
|
|
13
14
|
onPress,
|
|
14
15
|
cdn,
|
|
15
|
-
authorImageTestID,
|
|
16
|
-
actionTextID,
|
|
17
16
|
authorFallBackTestID,
|
|
18
|
-
authorNameTestID,
|
|
19
17
|
readtime,
|
|
20
18
|
disablePress,
|
|
21
19
|
}) => {
|
|
22
20
|
const { theme } = useContext(AppTheme);
|
|
23
|
-
const { COLORS ,
|
|
21
|
+
const { COLORS, translate, enableReadTimeOnStoryScreen } = theme;
|
|
24
22
|
const styles = authorRowStyleSheet(theme);
|
|
25
23
|
|
|
26
24
|
return (
|
|
@@ -31,7 +29,10 @@ export const AuthorRow = ({
|
|
|
31
29
|
}
|
|
32
30
|
return (
|
|
33
31
|
<View style={styles.container} key={author.id}>
|
|
34
|
-
<View
|
|
32
|
+
<View
|
|
33
|
+
style={styles.imageBlock}
|
|
34
|
+
testID={COMP_CONTENT_CONSTANTS.authorImage}
|
|
35
|
+
>
|
|
35
36
|
{author?.['avatar-s3-key'] ? (
|
|
36
37
|
<ResponsiveImage
|
|
37
38
|
source={{
|
|
@@ -55,11 +56,13 @@ export const AuthorRow = ({
|
|
|
55
56
|
<ActionText
|
|
56
57
|
onPress={onPress}
|
|
57
58
|
endPoint={author}
|
|
58
|
-
testID={actionTextID}
|
|
59
59
|
disablePress={disablePress}
|
|
60
60
|
>
|
|
61
61
|
<View style={styles.descriptionBlock}>
|
|
62
|
-
<Text
|
|
62
|
+
<Text
|
|
63
|
+
style={styles.authorStyle}
|
|
64
|
+
testID={COMP_CONTENT_CONSTANTS.authorName}
|
|
65
|
+
>
|
|
63
66
|
{author.name}
|
|
64
67
|
</Text>
|
|
65
68
|
</View>
|
|
@@ -67,9 +70,13 @@ export const AuthorRow = ({
|
|
|
67
70
|
</View>
|
|
68
71
|
);
|
|
69
72
|
})}
|
|
70
|
-
{readtime ? (
|
|
73
|
+
{enableReadTimeOnStoryScreen && readtime ? (
|
|
71
74
|
<View style={styles.readtimeComponent}>
|
|
72
|
-
<Text style={styles.readtime}>
|
|
75
|
+
<Text style={styles.readtime}>
|
|
76
|
+
{`| ${readtime} ${translate(
|
|
77
|
+
'min read',
|
|
78
|
+
)}`}
|
|
79
|
+
</Text>
|
|
73
80
|
</View>
|
|
74
81
|
) : null}
|
|
75
82
|
</View>
|
|
@@ -82,8 +89,5 @@ AuthorRow.propTypes = {
|
|
|
82
89
|
cdn: PropTypes.string.isRequired,
|
|
83
90
|
disablePress: PropTypes.bool,
|
|
84
91
|
authorFallBackTestID: PropTypes.string,
|
|
85
|
-
authorImageTestID: PropTypes.string,
|
|
86
|
-
authorNameTestID: PropTypes.string,
|
|
87
|
-
actionTextID: PropTypes.string,
|
|
88
92
|
readtime: PropTypes.number,
|
|
89
93
|
};
|
|
@@ -6,6 +6,7 @@ export const backNavigatorStyles = (appThemeContext) => {
|
|
|
6
6
|
container: {
|
|
7
7
|
flexDirection: 'row',
|
|
8
8
|
justifyContent: 'flex-start',
|
|
9
|
+
marginRight: 20,
|
|
9
10
|
alignItems: 'center',
|
|
10
11
|
backgroundColor: DARK_MODE ? COLORS.MONO6 : COLORS.BRAND_WHITE,
|
|
11
12
|
},
|
|
@@ -29,6 +30,7 @@ export const backNavigatorStyles = (appThemeContext) => {
|
|
|
29
30
|
text: {
|
|
30
31
|
marginLeft: 10,
|
|
31
32
|
opacity: 0.9,
|
|
33
|
+
flexShrink: 1,
|
|
32
34
|
},
|
|
33
35
|
});
|
|
34
36
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import PropTypes from
|
|
2
|
-
import React, { useContext } from
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React, { useContext } from "react";
|
|
3
3
|
import {
|
|
4
|
-
StyleSheet,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
TouchableOpacity,
|
|
5
6
|
View,
|
|
6
|
-
|
|
7
7
|
ViewPropTypes,
|
|
8
|
-
} from
|
|
9
|
-
import { AppTheme } from
|
|
10
|
-
import { Text } from
|
|
11
|
-
import { styles } from
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import { AppTheme } from "../../utils";
|
|
10
|
+
import { Text } from "../Text";
|
|
11
|
+
import { styles } from "./styles";
|
|
12
|
+
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
|
|
12
13
|
|
|
13
14
|
export const Button = (props) => {
|
|
14
15
|
const { icon, text, onPress } = props;
|
|
@@ -21,7 +22,10 @@ export const Button = (props) => {
|
|
|
21
22
|
|
|
22
23
|
return (
|
|
23
24
|
<View>
|
|
24
|
-
<TouchableOpacity
|
|
25
|
+
<TouchableOpacity
|
|
26
|
+
onPress={onPress}
|
|
27
|
+
testID={COMP_GENERAL_CONSTANTS.buttonTouch}
|
|
28
|
+
>
|
|
25
29
|
<View style={btnStyle}>
|
|
26
30
|
<Text style={textStyle}>{text}</Text>
|
|
27
31
|
{icon}
|
|
@@ -17,17 +17,21 @@ export const CollectionCard = ({
|
|
|
17
17
|
onStoryPress,
|
|
18
18
|
offset,
|
|
19
19
|
horizontalPadding,
|
|
20
|
-
initialOffset /* Number of items to load on first load
|
|
20
|
+
initialOffset, /* Number of items to load on first load */
|
|
21
|
+
hideCollectionTitle,
|
|
21
22
|
}) => {
|
|
22
23
|
const sliceLimit = offset || initialOffset || 5;
|
|
23
24
|
const primaryStory = !isEmpty(stories) && get(stories, [0, 'story'], stories[0]);
|
|
24
25
|
return (
|
|
25
26
|
<>
|
|
27
|
+
{!hideCollectionTitle
|
|
28
|
+
&& (
|
|
26
29
|
<CollectionTitle
|
|
27
30
|
title={collectionName}
|
|
28
31
|
onPress={onCollectionPress}
|
|
29
32
|
horizontalPadding={horizontalPadding}
|
|
30
33
|
/>
|
|
34
|
+
)}
|
|
31
35
|
<PrimaryStoryCard
|
|
32
36
|
onPress={() => {
|
|
33
37
|
!isEmpty(stories) && onStoryPress(primaryStory);
|
|
@@ -62,6 +66,7 @@ CollectionCard.propTypes = {
|
|
|
62
66
|
onStoryPress: PropTypes.func,
|
|
63
67
|
offset: PropTypes.number,
|
|
64
68
|
horizontalPadding: PropTypes.number,
|
|
69
|
+
hideCollectionTitle: PropTypes.bool,
|
|
65
70
|
};
|
|
66
71
|
|
|
67
72
|
CollectionCard.defaultProps = {
|
|
@@ -19,18 +19,21 @@ const CollectionCardNewBase = ({
|
|
|
19
19
|
collectionTestID,
|
|
20
20
|
offset,
|
|
21
21
|
horizontalPadding,
|
|
22
|
-
initialOffset /* Number of items to load on first load
|
|
22
|
+
initialOffset, /* Number of items to load on first load */
|
|
23
|
+
hideCollectionTitle,
|
|
23
24
|
}) => {
|
|
24
25
|
const sliceLimit = offset || initialOffset || 5;
|
|
25
26
|
const primaryStory = !isEmpty(stories) && get(stories, [0, 'story'], stories[0]);
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
29
|
<>
|
|
30
|
+
{!hideCollectionTitle && (
|
|
29
31
|
<CollectionTitleNew
|
|
30
32
|
title={collectionName}
|
|
31
33
|
onPress={onCollectionPress}
|
|
32
34
|
horizontalPadding={horizontalPadding}
|
|
33
35
|
/>
|
|
36
|
+
)}
|
|
34
37
|
<PrimaryStoryCardNew
|
|
35
38
|
collectionTestID={collectionTestID}
|
|
36
39
|
onPress={() => {
|
|
@@ -71,6 +74,7 @@ CollectionCardNewBase.propTypes = {
|
|
|
71
74
|
onStoryPress: PropTypes.func,
|
|
72
75
|
collectionTestID: PropTypes.string,
|
|
73
76
|
horizontalPadding: PropTypes.number,
|
|
77
|
+
hideCollectionTitle: PropTypes.bool,
|
|
74
78
|
};
|
|
75
79
|
|
|
76
80
|
CollectionCardNewBase.defaultProps = {
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import React, { useContext, useState } from
|
|
2
|
-
import { Switch, View } from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import Icon from
|
|
5
|
-
import { Text } from
|
|
6
|
-
import { AppTheme } from
|
|
7
|
-
import { customSwitchStyles } from
|
|
1
|
+
import React, { useContext, useState } from "react";
|
|
2
|
+
import { Switch, View } from "react-native";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import Icon from "react-native-vector-icons/FontAwesome";
|
|
5
|
+
import { Text } from "../Text";
|
|
6
|
+
import { AppTheme } from "../../utils";
|
|
7
|
+
import { customSwitchStyles } from "./styles";
|
|
8
|
+
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants/general-constants/constants";
|
|
8
9
|
|
|
9
10
|
export const CustomSwitch = ({
|
|
10
|
-
label =
|
|
11
|
+
label = "",
|
|
12
|
+
callback,
|
|
13
|
+
isEnabled = true,
|
|
14
|
+
iconSize = 20,
|
|
15
|
+
iconName,
|
|
16
|
+
isSwitchDisabled = false,
|
|
11
17
|
}) => {
|
|
12
18
|
const { theme } = useContext(AppTheme);
|
|
13
19
|
const { COLORS } = theme;
|
|
14
20
|
const styles = customSwitchStyles();
|
|
15
21
|
const handleToggle = () => {
|
|
16
|
-
typeof callback ===
|
|
22
|
+
typeof callback === "function" && callback(!isEnabled);
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
return (
|
|
20
|
-
<View style={styles.container}>
|
|
26
|
+
<View style={styles.container} testID={COMP_GENERAL_CONSTANTS.customSwitch}>
|
|
21
27
|
<View style={styles.textContainer}>
|
|
22
28
|
{!iconName ? null : (
|
|
23
29
|
<View style={styles.iconStyle}>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import PropTypes from
|
|
2
|
-
import React, { useContext } from
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React, { useContext } from "react";
|
|
3
3
|
import {
|
|
4
4
|
StyleSheet,
|
|
5
5
|
TouchableOpacity,
|
|
6
6
|
View,
|
|
7
7
|
ViewPropTypes,
|
|
8
|
-
} from
|
|
8
|
+
} from "react-native";
|
|
9
9
|
|
|
10
|
-
import { headerStyles } from
|
|
11
|
-
import { AppTheme } from
|
|
10
|
+
import { headerStyles } from "./styles";
|
|
11
|
+
import { AppTheme } from "../../utils";
|
|
12
|
+
import { COMP_GENERAL_CONSTANTS } from "../../constants/component-constants";
|
|
12
13
|
|
|
13
14
|
export const Header = (props) => {
|
|
14
15
|
const { theme } = useContext(AppTheme);
|
|
@@ -19,11 +20,15 @@ export const Header = (props) => {
|
|
|
19
20
|
props.logoComponentStyle,
|
|
20
21
|
]);
|
|
21
22
|
return (
|
|
22
|
-
<View
|
|
23
|
+
<View style={headerStyle}>
|
|
23
24
|
<View>
|
|
24
25
|
{props.leftComponent && props.leftComponent}
|
|
25
26
|
{props.logoComponent && (
|
|
26
|
-
<TouchableOpacity
|
|
27
|
+
<TouchableOpacity
|
|
28
|
+
style={logoComponentStyle}
|
|
29
|
+
onPress={props.onPress}
|
|
30
|
+
testID={COMP_GENERAL_CONSTANTS.headerLogoTouch}
|
|
31
|
+
>
|
|
27
32
|
{props.logoComponent}
|
|
28
33
|
</TouchableOpacity>
|
|
29
34
|
)}
|
|
@@ -34,7 +39,7 @@ export const Header = (props) => {
|
|
|
34
39
|
};
|
|
35
40
|
|
|
36
41
|
Header.defaultProps = {
|
|
37
|
-
onPress: () => {
|
|
42
|
+
onPress: () => {},
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
Header.propTypes = {
|
|
@@ -43,7 +48,6 @@ Header.propTypes = {
|
|
|
43
48
|
logoComponent: PropTypes.element,
|
|
44
49
|
style: ViewPropTypes.style,
|
|
45
50
|
logoComponentStyle: PropTypes.object,
|
|
46
|
-
testID: PropTypes.string,
|
|
47
51
|
onPress: PropTypes.func,
|
|
48
52
|
noBorder: PropTypes.bool,
|
|
49
53
|
};
|
|
@@ -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}
|