@quintype/native-components 2.28.1 → 2.28.2

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.2",
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,14 @@ 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
+ ])
33
+
26
34
  const flattenedImageStyle = StyleSheet.flatten([
27
35
  styles.defaultImage,
28
36
  props.styles,
@@ -30,15 +38,11 @@ const ResponsiveImageBase = (props) => {
30
38
  width: props.imageWidth,
31
39
  height: (props.imageWidth * 9) / 16,
32
40
  },
33
- props?.elementType === 'gallery' && {
34
- backgroundColor: COLORS.BRAND_BLACK,
35
- },
36
- roundedImageCorners && {
37
- borderRadius: 12,
38
- overflow: "hidden",
39
- },
41
+ props.styles?.marginTop && { marginTop: 0 } ,
42
+
40
43
  ]);
41
44
 
45
+
42
46
  const placeholderStyle = {
43
47
  ...StyleSheet.absoluteFillObject,
44
48
  ...props.styles,
@@ -47,6 +51,7 @@ const ResponsiveImageBase = (props) => {
47
51
  justifyContent: "center",
48
52
  alignItems: "center",
49
53
  borderRadius: roundedImageCorners ? 12 : 0,
54
+ marginTop: 0
50
55
  };
51
56
 
52
57
  const fallBackIcon = CustomFallBackIcon ? (
@@ -55,13 +60,8 @@ const ResponsiveImageBase = (props) => {
55
60
  <FallbackIcon />
56
61
  );
57
62
 
58
- let imageUrl = '';
59
63
 
60
- if (props?.elementType === 'gallery') {
61
- imageUrl = getCustomResolutionImageURL(props, [1, 1]);
62
- } else {
63
- imageUrl = getImageURL(props);
64
- }
64
+ let imageUrl = getImageURL(props)
65
65
 
66
66
  const userFallback = () => <Icon name="user" size={20} />;
67
67
 
@@ -77,6 +77,11 @@ const ResponsiveImageBase = (props) => {
77
77
 
78
78
  const onLoadHandler = useCallback(handleImageLoad, []);
79
79
 
80
+ const lowestQualitySourceURI = {
81
+ uri: decodeURIComponent(getImageURL(props,2)),
82
+ priority: FastImage.priority.high,
83
+ }
84
+
80
85
  const sourceURI = {
81
86
  uri: decodeURIComponent(imageUrl),
82
87
  priority: FastImage.priority.high,
@@ -85,15 +90,27 @@ const ResponsiveImageBase = (props) => {
85
90
 
86
91
  const preferredResizeMode = resizeImagesToFit ? FastImage.resizeMode.contain : FastImage.resizeMode.cover;
87
92
 
88
- return (
89
- <View>
93
+ const ImageLayout = () => {
94
+ return (
90
95
  <FastImage
91
96
  style={flattenedImageStyle}
92
97
  source={sourceURI}
93
- onLoad={onLoadHandler}
94
- resizeMode={props?.elementType === 'gallery' && !(props.hero) ? FastImage.resizeMode.contain : preferredResizeMode}
98
+ resizeMode={FastImage.resizeMode.contain}
95
99
  {...props}
96
100
  />
101
+ )
102
+ }
103
+
104
+ return (
105
+ <View style={flattenedBackgroudStyle}>
106
+ <ImageBackground
107
+ source={lowestQualitySourceURI}
108
+ resizeMode='cover'
109
+ blurRadius={50}
110
+ onLoad={()=>setPlaceholder(false)}
111
+ >
112
+ <ImageLayout />
113
+ </ImageBackground>
97
114
  {placeholder && (
98
115
  <View style={placeholderStyle} testID={props.containerTestID}>
99
116
  {showFallBackIcon()}
@@ -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
  };