@quintype/native-components 2.22.0-beta.2 → 2.22.1

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.
@@ -1,15 +1,15 @@
1
- # #!/bin/bash -e
1
+ #!/bin/bash -e
2
2
 
3
- # npm install
4
- # git diff --quiet
3
+ npm install
4
+ git diff --quiet
5
5
 
6
- # BRANCH=$(git symbolic-ref --short HEAD)
6
+ BRANCH=$(git symbolic-ref --short HEAD)
7
7
 
8
- # if [ "$BRANCH" == 'master' ]
9
- # then
10
- # npx standard-version
11
- # else
12
- # npx standard-version --prerelease "$(git symbolic-ref --short HEAD | sed s:/:-:g )" --skip.changelog=true
13
- # fi
8
+ if [ "$BRANCH" == 'master' ]
9
+ then
10
+ npx standard-version
11
+ else
12
+ npx standard-version --prerelease "$(git symbolic-ref --short HEAD | sed s:/:-:g )" --skip.changelog=true
13
+ fi
14
14
 
15
- # git push --follow-tags origin "$BRANCH"
15
+ git push --follow-tags origin "$BRANCH"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.22.0-beta.2",
3
+ "version": "2.22.1",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -13,10 +13,10 @@ import Pdf from 'react-native-pdf';
13
13
 
14
14
  import { Text } from '../index';
15
15
  import { pdfStyles } from './styles';
16
- import { ShareIcon } from '../../Icons/ShareIcon';
16
+ import { ShareButton } from '../index';
17
17
  import { AppTheme } from '../../utils';
18
18
 
19
- export const PDFReader = ({ card, share }) => {
19
+ export const PDFReader = ({ card, story }) => {
20
20
  const [modalVisible, setModalVisible] = useState(false);
21
21
 
22
22
  const { theme } = useContext(AppTheme);
@@ -66,15 +66,7 @@ export const PDFReader = ({ card, share }) => {
66
66
  </Text>
67
67
  </TouchableOpacity>
68
68
  </View>
69
- <View style={styles.pdfShare}>
70
- <TouchableOpacity
71
- onPress={() => {
72
- share(card.url, 'attachment');
73
- }}
74
- >
75
- <ShareIcon />
76
- </TouchableOpacity>
77
- </View>
69
+ <ShareButton story={story} type={'attachment'} slug={card.url} containerStyle={styles.pdfShare} />
78
70
  </View>
79
71
  </SafeAreaView>
80
72
  );
@@ -82,5 +74,5 @@ export const PDFReader = ({ card, share }) => {
82
74
 
83
75
  PDFReader.propTypes = {
84
76
  card: PropTypes.any.isRequired,
85
- share: PropTypes.func,
77
+ story: PropTypes.any,
86
78
  };
@@ -26,7 +26,7 @@ const PrimaryStoryCardNewBase = (props) => {
26
26
  FONT_FAMILY,
27
27
  premiumIcon,
28
28
  lineHeightMultiplier,
29
- storyCardOptions,
29
+ storyCardOptions = {},
30
30
  } = theme || {};
31
31
 
32
32
  const styles = storyStyles(theme);
@@ -1,4 +1,4 @@
1
- export const storyStyles = ({COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions}) => ({
1
+ export const storyStyles = ({COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions = {}}) => ({
2
2
  container: {
3
3
  backgroundColor: COLORS.BRAND_WHITE,
4
4
  paddingVertical: 10,
@@ -30,7 +30,7 @@ const SecondaryStoryCardNewBase = (props) => {
30
30
  COLORS,
31
31
  premiumIcon,
32
32
  FONT_SIZE,
33
- storyCardOptions,
33
+ storyCardOptions = {},
34
34
  } = theme;
35
35
 
36
36
  const styles = storyStyles(theme);
@@ -1,6 +1,6 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
 
3
- export const storyStyles = ({ COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions }) => StyleSheet.create({
3
+ export const storyStyles = ({ COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier, storyCardOptions = {} }) => StyleSheet.create({
4
4
  container: {
5
5
  flexDirection: 'row',
6
6
  justifyContent: 'space-between',
@@ -12,8 +12,8 @@ import { COMP_GENERAL_CONSTANTS } from '../../constants/component-constants';
12
12
  const ShareButtonBase = (props) => {
13
13
  const { theme } = useContext(AppTheme);
14
14
  const styles = shareButtonStyles(theme);
15
- const { storyCardOptions } = theme;
16
- const { story, type = 'story', slug } = props;
15
+ const { storyCardOptions = {} } = theme;
16
+ const { story, type = 'story', slug, containerStyle } = props;
17
17
 
18
18
  const getShareURL = () => {
19
19
  const { url } = story || {};
@@ -65,6 +65,7 @@ const ShareButtonBase = (props) => {
65
65
  <TouchableOpacity
66
66
  onPress={share}
67
67
  testID={COMP_GENERAL_CONSTANTS.shareButtonTouch}
68
+ style={containerStyle}
68
69
  >
69
70
  {renderIcon()}
70
71
  </TouchableOpacity>
@@ -8,15 +8,15 @@ import { TagsRow } from '../TagsRow/TagsRow';
8
8
  import { FBCommentsRow } from '../FBCommentsRow';
9
9
  import { STORY_TYPES } from '../../utils/story-types';
10
10
  import { getTimeInFormat, AppTheme } from '../../utils';
11
- import { ShareIcon } from '../../Icons/ShareIcon';
11
+ import { ShareButton } from '../index';
12
12
  import { ClockIcon } from '../../Icons/ClockIcon';
13
13
  import { storyStyles } from './styles';
14
- import { isStoryFree, mutateDataBeforeAccess, getFirstVideoElement } from '../../utils/story';
14
+ import { isStoryFree, getFirstVideoElement } from '../../utils/story';
15
15
  import { isMiddleIndexOfArray } from '../../utils/arrayUtils';
16
16
  import LinearGradient from "react-native-linear-gradient";
17
17
  import { hexToRgb } from '@quintype/native-components/src/utils/colorUtils';
18
18
 
19
- const getLiveBlogTimeStamp = (card, DATE_FORMAT, share, styles, locale) => {
19
+ const getLiveBlogTimeStamp = (card, DATE_FORMAT, story, styles, locale) => {
20
20
  const slug = `?cardId=${card.id}`;
21
21
  return (
22
22
  <View style={styles.container}>
@@ -26,11 +26,7 @@ const getLiveBlogTimeStamp = (card, DATE_FORMAT, share, styles, locale) => {
26
26
  {getTimeInFormat(card['card-updated-at'], DATE_FORMAT, locale)}
27
27
  </Text>
28
28
  </View>
29
- <View style={styles.shareIcon}>
30
- <TouchableOpacity onPress={() => share(slug, 'card')}>
31
- <ShareIcon />
32
- </TouchableOpacity>
33
- </View>
29
+ <ShareButton story={story} type={'card'} slug={slug} containerStyle={styles.shareIcon} />
34
30
  </View>
35
31
  );
36
32
  };
@@ -68,11 +64,10 @@ const getStoryCards = (
68
64
  navigation,
69
65
  isLiveBlog,
70
66
  DATE_FORMAT,
71
- share,
67
+ story,
72
68
  storyType,
73
69
  isListicleStory,
74
70
  bulletType,
75
- storyHasAccess,
76
71
  styles,
77
72
  currentLayout,
78
73
  getAd,
@@ -80,7 +75,7 @@ const getStoryCards = (
80
75
  ) => cards.map((card, index, source) => (
81
76
  <View key={card?.id}>
82
77
  {isLiveBlog
83
- && getLiveBlogTimeStamp(card, DATE_FORMAT, share, styles, locale)}
78
+ && getLiveBlogTimeStamp(card, DATE_FORMAT, story, styles, locale)}
84
79
 
85
80
  {isListicleStory && index !== 0 && (
86
81
  <View style={styles.listicleContainer}>
@@ -116,7 +111,7 @@ const getStoryCards = (
116
111
  linkedStories={linkedStories}
117
112
  screenList={screenList}
118
113
  navigation={navigation}
119
- share={share}
114
+ story={story}
120
115
  storyType={storyType}
121
116
  currentLayout={currentLayout}
122
117
  />
@@ -137,7 +132,6 @@ export const Story = ({
137
132
  onFbCommentPress,
138
133
  screenList,
139
134
  navigation,
140
- share,
141
135
  accessComponent,
142
136
  checkStoryAccess,
143
137
  enableFbComments,
@@ -231,11 +225,10 @@ export const Story = ({
231
225
  navigation,
232
226
  isLiveBlog,
233
227
  DATE_FORMAT,
234
- share,
228
+ story,
235
229
  storyType,
236
230
  isListicleStory,
237
231
  bulletType,
238
- storyHasAccess,
239
232
  styles,
240
233
  currentLayout,
241
234
  getAd,
@@ -267,7 +260,6 @@ Story.propTypes = {
267
260
  onAuthorPress: PropTypes.func,
268
261
  onTagsPress: PropTypes.func,
269
262
  onSectionPress: PropTypes.func,
270
- share: PropTypes.func,
271
263
  storyHasAccess: PropTypes.string,
272
264
  checkStoryAccess: PropTypes.func,
273
265
  getAd: PropTypes.func,
@@ -13,7 +13,7 @@ const StoryCardDetailsRowBase = ({ authorName, publishedAt, readTime }) => {
13
13
  locale,
14
14
  reverseTimeAdverbPosition,
15
15
  DATE_TIME_FORMAT,
16
- storyCardOptions,
16
+ storyCardOptions = {},
17
17
  } = theme;
18
18
  const translate = get(theme, ["translate"], (word) => word);
19
19
 
@@ -7,7 +7,6 @@ import {
7
7
  STORY_ELEMENT_TYPES,
8
8
  STORY_ELEMENT_METADATA_TYPES,
9
9
  } from '../../constants';
10
- import { stripHTML } from '../../utils';
11
10
  import { DailyMotionPlayer } from '../DailyMotionPlayer';
12
11
 
13
12
  export const StoryContent = ({
@@ -16,7 +15,7 @@ export const StoryContent = ({
16
15
  linkedStories,
17
16
  screenList,
18
17
  navigation,
19
- share,
18
+ story,
20
19
  storyType,
21
20
  currentLayout,
22
21
  }) => {
@@ -73,7 +72,7 @@ export const StoryContent = ({
73
72
  <AllComponents.StoryImage
74
73
  cdn={cdn}
75
74
  card={storyElement}
76
- share={share}
75
+ story={story}
77
76
  storyType={storyType}
78
77
  currentLayout={currentLayout}
79
78
  />
@@ -81,7 +80,7 @@ export const StoryContent = ({
81
80
  case STORY_ELEMENT_TYPES.YOUTUBE_VIDEO:
82
81
  return <AllComponents.YouTubePlayer card={storyElement} />;
83
82
  case STORY_ELEMENT_TYPES.FILE:
84
- return <AllComponents.PDFReader card={storyElement} share={share} />;
83
+ return <AllComponents.PDFReader card={storyElement} story={story} />;
85
84
  case STORY_ELEMENT_TYPES.DATA:
86
85
  return <AllComponents.Table card={storyElement} />;
87
86
  case STORY_ELEMENT_TYPES.COMPOSITE:
@@ -120,7 +119,7 @@ export const StoryContent = ({
120
119
  StoryContent.propTypes = {
121
120
  storyElement: PropTypes.any.isRequired,
122
121
  cdn: PropTypes.string.isRequired,
123
- share: PropTypes.func.isRequired,
122
+ story: PropTypes.any.isRequired,
124
123
  storyType: PropTypes.string,
125
124
  linkedStories: PropTypes.any,
126
125
  screenList: PropTypes.object,
@@ -1,14 +1,14 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import { View, TouchableOpacity } from 'react-native';
4
- import { ShareIcon } from '../../Icons/ShareIcon';
3
+ import { View } from 'react-native';
4
+ import { ShareButton } from '../index';
5
5
  import { AppTheme, getScreenPercentageWidth, stripHTML } from '../../utils';
6
6
  import { Text } from '../index';
7
7
  import { LightBoxImage } from '../LightBoxImage';
8
8
  import { storyImageStyles } from './styles';
9
9
 
10
10
  export const StoryImage = ({
11
- card, cdn, share, storyType, currentLayout,
11
+ card, cdn, story, storyType, currentLayout,
12
12
  }) => {
13
13
  const slug = `?cardId=${card.id}`;
14
14
  const sharePhotoCard = storyType === 'photo';
@@ -35,9 +35,7 @@ export const StoryImage = ({
35
35
  </Text>
36
36
  </View>
37
37
  {sharePhotoCard && (
38
- <TouchableOpacity onPress={() => share(slug, 'image')}>
39
- <ShareIcon />
40
- </TouchableOpacity>
38
+ <ShareButton story={story} type={'image'} slug={slug} />
41
39
  )}
42
40
  </View>
43
41
  </>
@@ -47,7 +45,7 @@ export const StoryImage = ({
47
45
  StoryImage.propTypes = {
48
46
  card: PropTypes.any.isRequired,
49
47
  cdn: PropTypes.string.isRequired,
50
- share: PropTypes.func.isRequired,
48
+ story: PropTypes.any.isRequired,
51
49
  currentLayout: PropTypes.object,
52
50
  storyType: PropTypes.string,
53
51
  };
@@ -1,12 +1,15 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
 
3
- export const storyTitleStyles = ({ COLORS, FONT_SIZE, lineHeightMultiplier }) => StyleSheet.create({
3
+ export const storyTitleStyles = ({
4
+ COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultiplier,
5
+ }) => StyleSheet.create({
4
6
  container: {
5
7
  padding: 10,
6
8
  paddingBottom: 0,
7
9
  },
8
10
  titleStyle: {
9
11
  fontSize: FONT_SIZE.title,
12
+ fontFamily: FONT_FAMILY.primaryBold,
10
13
  lineHeight: FONT_SIZE.title * lineHeightMultiplier,
11
14
  color: COLORS.BRAND_BLACK,
12
15
  },
@@ -1,19 +0,0 @@
1
- import { AppTheme } from '../../utils';
2
- import React, { useContext } from 'react';
3
- import Svg, { Path } from 'react-native-svg';
4
-
5
- export const ShareIcon = (props) => {
6
- const { theme } = useContext(AppTheme);
7
- const { COLORS } = theme;
8
- return (
9
- <Svg width={24} height={24} {...props}>
10
- <Path
11
- fill={COLORS.BRAND_BLACK}
12
- fillRule="evenodd"
13
- d="M15.843 3.189c-1.478 0-2.689 1.239-2.689 2.75 0 .293.046.58.13.846L8.844 9.31a2.636 2.636 0 00-1.687-.621c-1.477 0-2.688 1.238-2.688 2.75 0 1.51 1.21 2.75 2.688 2.75a2.63 2.63 0 001.687-.615l4.446 2.525a2.759 2.759 0 00-.136.84c0 1.51 1.211 2.75 2.689 2.75 1.477 0 2.688-1.24 2.688-2.75 0-1.512-1.21-2.75-2.688-2.75a2.66 2.66 0 00-1.907.82l-4.323-2.46a2.757 2.757 0 000-2.221l4.317-2.459c.488.506 1.168.82 1.913.82 1.477 0 2.688-1.239 2.688-2.75s-1.21-2.75-2.688-2.75z"
14
- />
15
- </Svg>
16
- )
17
- }
18
-
19
-