@quintype/native-components 2.20.7 → 2.20.9

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,15 @@
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.9](https://github.com/quintype/native-components/compare/v2.20.8...v2.20.9) (2023-07-10)
6
+
7
+ ### [2.20.8](https://github.com/quintype/native-components/compare/v2.20.7...v2.20.8) (2023-06-30)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **misc:** Fixes slideshow arrow align, adds resizeImagesToFit config 🔨 ([#205](https://github.com/quintype/native-components/issues/205)) ([094bf6f](https://github.com/quintype/native-components/commit/094bf6f31e28d9f61df878de398af5bb1e101760))
13
+
5
14
  ### [2.20.7](https://github.com/quintype/native-components/compare/v2.20.6...v2.20.7) (2023-06-16)
6
15
 
7
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.20.7",
3
+ "version": "2.20.9",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -131,6 +131,7 @@ export const JSEmbedElement = (props) => {
131
131
  }}
132
132
  source={constructSource()}
133
133
  mixedContentMode="always"
134
+ mediaPlaybackRequiresUserAction={true}
134
135
  />
135
136
  </View>
136
137
  );
@@ -15,7 +15,9 @@ import {
15
15
  const ResponsiveImageBase = (props) => {
16
16
  const [placeholder, setPlaceholder] = useState(true);
17
17
  const { theme } = useContext(AppTheme);
18
- const { COLORS, CustomFallBackIcon, CustomFallBackBackground } = theme;
18
+ const {
19
+ COLORS, CustomFallBackIcon, CustomFallBackBackground, resizeImagesToFit,
20
+ } = theme;
19
21
 
20
22
  const flattenedImageStyle = StyleSheet.flatten([
21
23
  styles.defaultImage,
@@ -70,13 +72,15 @@ const ResponsiveImageBase = (props) => {
70
72
  cache: FastImage.cacheControl.web,
71
73
  };
72
74
 
75
+ const preferredResizeMode = resizeImagesToFit ? FastImage.resizeMode.contain : FastImage.resizeMode.cover;
76
+
73
77
  return (
74
78
  <View>
75
79
  <FastImage
76
80
  style={flattenedImageStyle}
77
81
  source={sourceURI}
78
82
  onLoad={onLoadHandler}
79
- resizeMode={props?.elementType === 'gallery' && !(props.hero) ? FastImage.resizeMode.contain : FastImage.resizeMode.cover}
83
+ resizeMode={props?.elementType === 'gallery' && !(props.hero) ? FastImage.resizeMode.contain : preferredResizeMode}
80
84
  {...props}
81
85
  />
82
86
  {placeholder && (
@@ -7,6 +7,7 @@ import {
7
7
  SafeAreaView,
8
8
  FlatList,
9
9
  TouchableOpacity,
10
+ ScrollView,
10
11
  } from 'react-native';
11
12
  import Icon from 'react-native-vector-icons/FontAwesome';
12
13
  import FastImage from 'react-native-fast-image';
@@ -104,7 +105,7 @@ export const StoryGallery = ({ cdn, card }) => {
104
105
  const imageUri = `${data?.cdn}/${data?.slug}`;
105
106
 
106
107
  return (
107
- <View style={galleryStyles.carouselContainer}>
108
+ <ScrollView style={galleryStyles.carouselContainer}>
108
109
  <FastImage
109
110
  source={{ uri: imageUri }}
110
111
  resizeMode={FastImage.resizeMode.contain}
@@ -128,7 +129,7 @@ export const StoryGallery = ({ cdn, card }) => {
128
129
  Linking.openURL(href);
129
130
  }}
130
131
  />
131
- </View>
132
+ </ScrollView>
132
133
  );
133
134
  };
134
135
 
@@ -3,7 +3,7 @@ import { useContext } from 'react';
3
3
  import { AppTheme } from '../../utils';
4
4
 
5
5
  export const styles = ({ FONT_SIZE }) => {
6
- const { width: deviceWidth } = Dimensions.get('window');
6
+ const { width: deviceWidth, height: deviceHeight } = Dimensions.get('window');
7
7
  const { theme } = useContext(AppTheme);
8
8
  const { COLORS, DARK_MODE, FONT_FAMILY } = theme;
9
9
 
@@ -16,16 +16,15 @@ export const styles = ({ FONT_SIZE }) => {
16
16
  width: '100%',
17
17
  flexDirection: 'row',
18
18
  flexWrap: 'wrap',
19
- justifyContent: 'space-between',
20
19
  },
21
20
  halfWidth: {
22
21
  width: (deviceWidth - 30) / 2,
23
22
  height: 124,
24
23
  },
25
24
  fullWidth: {
26
- width: (deviceWidth - 30) / 3,
27
- height: (deviceWidth - 30) / 3,
28
- marginVertical: 2.5,
25
+ width: (deviceWidth - 40) / 3,
26
+ height: (deviceWidth - 40) / 3,
27
+ margin: 2.5,
29
28
  },
30
29
  descText: {
31
30
  fontSize: FONT_SIZE.h2,
@@ -110,7 +109,7 @@ export const styles = ({ FONT_SIZE }) => {
110
109
  },
111
110
  carouselImage: {
112
111
  width: '100%',
113
- height: '80%',
112
+ height: 2*deviceHeight/3,
114
113
  },
115
114
  carouselContainer: {
116
115
  width: deviceWidth - 10,
@@ -4,7 +4,6 @@ import { TouchableOpacity, View } from 'react-native';
4
4
  import { FlatList } from 'react-native-gesture-handler';
5
5
  import Icon from 'react-native-vector-icons/AntDesign';
6
6
  import { AppTheme } from '../../utils';
7
- import { Text } from '../index';
8
7
  import { SlideshowStoryCard } from '../SlideshowStoryCard';
9
8
  import { storySlideshowStyles } from './styles';
10
9
 
@@ -41,7 +40,7 @@ export const StorySlideshow = ({ card, cdn }) => {
41
40
  return (
42
41
  <View style={arrowStyles}>
43
42
  <TouchableOpacity onPress={onPressHandler}>
44
- <Icon name={direction} size={22} color={COLORS?.MONO7} />
43
+ <Icon name={direction} size={24} color={COLORS?.MONO7} />
45
44
  </TouchableOpacity>
46
45
  </View>
47
46
  );
@@ -65,11 +64,7 @@ export const StorySlideshow = ({ card, cdn }) => {
65
64
  };
66
65
 
67
66
  return (
68
- <View>
69
- <Text primary style={styles.titleText}>
70
- {card.title}
71
- </Text>
72
-
67
+ <View style={styles.cardsContainer}>
73
68
  <FlatList
74
69
  ref={flatlistRef}
75
70
  data={card['story-elements']}
@@ -79,7 +74,6 @@ export const StorySlideshow = ({ card, cdn }) => {
79
74
  extraData={currentIndex}
80
75
  onScroll={handleScroll}
81
76
  />
82
-
83
77
  {!firstSlide && showArrow('left')}
84
78
 
85
79
  {!lastSlide && showArrow('right')}
@@ -1,19 +1,19 @@
1
- import { StyleSheet } from 'react-native';
1
+ import { StyleSheet, Dimensions } from 'react-native';
2
2
 
3
- export const storySlideshowStyles = ({ FONT_SIZE, COLORS }) => StyleSheet.create({
4
- titleText: {
5
- fontWeight: 'normal',
6
- marginBottom: 10,
7
- fontSize: FONT_SIZE.h1,
8
- opacity: 0.8,
3
+ const { width } = Dimensions.get('window');
4
+
5
+ export const storySlideshowStyles = ({ COLORS }) => StyleSheet.create({
6
+ cardsContainer: {
7
+ marginTop: 10,
8
+ position: 'relative',
9
9
  },
10
10
  leftArrow: {
11
11
  position: 'absolute',
12
- top: '46%',
13
- right: '95%',
14
- left: 20,
12
+ marginTop: -20,
13
+ top: width * 0.28125, // width * 9/16 / 2
14
+ left: 0,
15
15
  zIndex: 999,
16
- width: 30,
16
+ width: 40,
17
17
  height: 40,
18
18
  backgroundColor: COLORS.TRANSPARENT_BLACK,
19
19
  display: 'flex',
@@ -22,11 +22,11 @@ export const storySlideshowStyles = ({ FONT_SIZE, COLORS }) => StyleSheet.create
22
22
  },
23
23
  rightArrow: {
24
24
  position: 'absolute',
25
- top: '46%',
26
- left: '93%',
27
- right: 20,
25
+ marginTop: -20,
26
+ top: width * 0.28125, // width * 9/16 / 2
27
+ right: 0,
28
28
  zIndex: 999,
29
- width: 30,
29
+ width: 40,
30
30
  height: 40,
31
31
  backgroundColor: COLORS.TRANSPARENT_BLACK,
32
32
  display: 'flex',
@@ -9,7 +9,7 @@ import styles from './styles';
9
9
  const WebViewComponent = (props) => (
10
10
  <View style={styles.container}>
11
11
  <Header rightComponent={props.closeButton} />
12
- <WebView {...props} />
12
+ <WebView {...props} mediaPlaybackRequiresUserAction={true} />
13
13
  </View>
14
14
  );
15
15