@quintype/native-components 2.28.1 → 2.28.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.28.1",
3
+ "version": "2.28.3",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -19,6 +19,7 @@ export const pdfStyles = (COLORS, FONT_SIZE, DARK_MODE, lineHeightMultiplier) =>
19
19
  marginLeft: 5,
20
20
  color: DARK_MODE ? COLORS.BRAND_BLACK : COLORS.BRAND_1,
21
21
  fontStyle: 'italic',
22
+ width:'90%'
22
23
  },
23
24
  pdfButton: {
24
25
  flexDirection: 'row',
@@ -39,7 +39,7 @@ export const RelatedStoriesCard = ({
39
39
  onPress: () => onStoryPress(secondaryStory),
40
40
  key: secondaryStory?.id,
41
41
  };
42
- <SecondaryStoryCard
42
+ return <SecondaryStoryCard
43
43
  {...storyCardProps}
44
44
  iconComponent={<ShareButton story={secondaryStory} inListingStoryCard />}
45
45
  imageWidth={getScreenPercentageWidth(28)}
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
2
2
  import React, {
3
3
  memo, useCallback, useContext, useState,
4
4
  } from 'react';
5
- import { StyleSheet, View } from 'react-native';
5
+ import { StyleSheet, View, ImageBackground } from 'react-native';
6
6
  import FastImage from 'react-native-fast-image';
7
7
  import Icon from 'react-native-vector-icons/FontAwesome';
8
8
  import { FallbackIcon } from '../../Icons/FallBackIcon';
@@ -23,6 +23,18 @@ const ResponsiveImageBase = (props) => {
23
23
  roundedImageCorners,
24
24
  } = theme;
25
25
 
26
+ const flattenedBackgroudStyle = StyleSheet.flatten([
27
+ {marginTop: props.styles?.marginTop ?? 0},
28
+ roundedImageCorners && {
29
+ borderRadius: 12,
30
+ overflow: "hidden",
31
+ },
32
+ props.imageWidth && {
33
+ width: props.imageWidth,
34
+ height: (props.imageWidth * 9) / 16,
35
+ },
36
+ ])
37
+
26
38
  const flattenedImageStyle = StyleSheet.flatten([
27
39
  styles.defaultImage,
28
40
  props.styles,
@@ -30,15 +42,11 @@ const ResponsiveImageBase = (props) => {
30
42
  width: props.imageWidth,
31
43
  height: (props.imageWidth * 9) / 16,
32
44
  },
33
- props?.elementType === 'gallery' && {
34
- backgroundColor: COLORS.BRAND_BLACK,
35
- },
36
- roundedImageCorners && {
37
- borderRadius: 12,
38
- overflow: "hidden",
39
- },
45
+ props.styles?.marginTop && { marginTop: 0 } ,
46
+
40
47
  ]);
41
48
 
49
+
42
50
  const placeholderStyle = {
43
51
  ...StyleSheet.absoluteFillObject,
44
52
  ...props.styles,
@@ -47,6 +55,7 @@ const ResponsiveImageBase = (props) => {
47
55
  justifyContent: "center",
48
56
  alignItems: "center",
49
57
  borderRadius: roundedImageCorners ? 12 : 0,
58
+ marginTop: 0
50
59
  };
51
60
 
52
61
  const fallBackIcon = CustomFallBackIcon ? (
@@ -55,13 +64,8 @@ const ResponsiveImageBase = (props) => {
55
64
  <FallbackIcon />
56
65
  );
57
66
 
58
- let imageUrl = '';
59
67
 
60
- if (props?.elementType === 'gallery') {
61
- imageUrl = getCustomResolutionImageURL(props, [1, 1]);
62
- } else {
63
- imageUrl = getImageURL(props);
64
- }
68
+ let imageUrl = getImageURL(props)
65
69
 
66
70
  const userFallback = () => <Icon name="user" size={20} />;
67
71
 
@@ -77,6 +81,11 @@ const ResponsiveImageBase = (props) => {
77
81
 
78
82
  const onLoadHandler = useCallback(handleImageLoad, []);
79
83
 
84
+ const lowestQualitySourceURI = {
85
+ uri: decodeURIComponent(getImageURL(props,2)),
86
+ priority: FastImage.priority.high,
87
+ }
88
+
80
89
  const sourceURI = {
81
90
  uri: decodeURIComponent(imageUrl),
82
91
  priority: FastImage.priority.high,
@@ -85,15 +94,27 @@ const ResponsiveImageBase = (props) => {
85
94
 
86
95
  const preferredResizeMode = resizeImagesToFit ? FastImage.resizeMode.contain : FastImage.resizeMode.cover;
87
96
 
88
- return (
89
- <View>
97
+ const ImageLayout = () => {
98
+ return (
90
99
  <FastImage
91
100
  style={flattenedImageStyle}
92
101
  source={sourceURI}
93
- onLoad={onLoadHandler}
94
- resizeMode={props?.elementType === 'gallery' && !(props.hero) ? FastImage.resizeMode.contain : preferredResizeMode}
102
+ resizeMode={FastImage.resizeMode.contain}
95
103
  {...props}
96
104
  />
105
+ )
106
+ }
107
+
108
+ return (
109
+ <View style={flattenedBackgroudStyle}>
110
+ <ImageBackground
111
+ source={lowestQualitySourceURI}
112
+ resizeMode='cover'
113
+ blurRadius={50}
114
+ onLoad={()=>setPlaceholder(false)}
115
+ >
116
+ <ImageLayout />
117
+ </ImageBackground>
97
118
  {placeholder && (
98
119
  <View style={placeholderStyle} testID={props.containerTestID}>
99
120
  {showFallBackIcon()}
@@ -16,7 +16,6 @@ export const storyStyles = ({ COLORS, FONT_SIZE, FONT_FAMILY, lineHeightMultipli
16
16
  gap: 10,
17
17
  },
18
18
  image: {
19
- marginBottom: 4,
20
19
  marginTop: storyCardOptions.enableSectionName ? FONT_SIZE.h4 * lineHeightMultiplier + 8 : 4,
21
20
  },
22
21
  icon: {
@@ -19,7 +19,7 @@ const ShareButtonBase = (props) => {
19
19
  const { url } = story || {};
20
20
  switch (type) {
21
21
  case 'story':
22
- return url;
22
+ return url || slug;
23
23
  case 'card':
24
24
  return `${url}${slug}`;
25
25
  case 'image':
@@ -138,7 +138,7 @@ export const StoryGallery = ({ cdn, card }) => {
138
138
 
139
139
  const style = galleryStyles.fullWidth;
140
140
  return (
141
- <TouchableOpacity>
141
+ <TouchableOpacity style={galleryStyles.subContainer}>
142
142
  <LightBoxImage
143
143
  onClickHandler={onPressHandler}
144
144
  hero={!!data.metaData['focus-point']}
@@ -129,5 +129,8 @@ export const styles = ({ FONT_SIZE }) => {
129
129
  position: 'absolute',
130
130
  color: COLORS.BRAND_WHITE,
131
131
  },
132
+ subContainer: {
133
+ margin:0.3
134
+ }
132
135
  });
133
136
  };
@@ -55,4 +55,4 @@ export const StoryTemplateIcon = ({
55
55
  default:
56
56
  return null;
57
57
  }
58
- };
58
+ };
@@ -20,4 +20,4 @@ export const storyTemplateIconStyles = (COLORS, FONT_SIZE, cardType) => StyleShe
20
20
  borderRadius: 50,
21
21
  backgroundColor: COLORS.BRAND_3,
22
22
  },
23
- });
23
+ });
@@ -40,7 +40,7 @@ export { IconText } from './IconText';
40
40
  export { CustomSwitch } from './CustomSwitch';
41
41
  export { RelatedStoriesCard } from './RelatedStoriesCard';
42
42
  export { References } from './References';
43
+ export { StoryTemplateIcon } from './StoryTemplateIcon'
43
44
  export { StoryCardDetailsRow } from './StoryCardDetailsRow';
44
45
  export { TextA } from './TextA'
45
- export { TextQ } from './TextQ'
46
- export { StoryTemplateIcon } from './StoryTemplateIcon'
46
+ export { TextQ } from './TextQ'