@quintype/native-components 2.29.1-beta.0 → 2.29.1-beta.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.29.1-beta.0",
3
+ "version": "2.29.1-beta.3",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -16,6 +16,7 @@
16
16
  "lint-staged": "^10.5.3",
17
17
  "prop-types": "15.7.2",
18
18
  "quintype-js": "1.2.1",
19
+ "react-csv-reader": "^4.0.0",
19
20
  "react-htmltext": "^0.40.2",
20
21
  "react-native-fast-image": ">=8.3.2",
21
22
  "react-native-image-pan-zoom": "^2.1.12",
@@ -32,11 +33,11 @@
32
33
  "react": ">=17.0.2",
33
34
  "react-native": ">=0.67.5",
34
35
  "react-native-blob-util": ">=6.7.4",
36
+ "react-native-device-info": "^11.1.0",
35
37
  "react-native-fast-image": ">=8.3.2",
36
38
  "react-native-linear-gradient": "^2.8.3",
37
39
  "react-native-pdf": ">=6.7.4",
38
40
  "react-native-vector-icons": "^10.0.0",
39
- "react-native-device-info": "^11.1.0",
40
41
  "react-native-webview": ">=11.0.0"
41
42
  },
42
43
  "devDependencies": {
@@ -1,10 +1,13 @@
1
1
  import { Text } from "@quintype/native-components/src/components/Text";
2
2
  import isHTML from "is-html";
3
- import React from "react";
3
+ import React, { useContext } from 'react';
4
4
  import { I18nManager, Linking, StyleSheet } from "react-native";
5
5
  import HTML from "react-native-render-html";
6
+ import { AppTheme } from "../../utils";
7
+
6
8
 
7
9
  const CustomHtmlParser = ({ text, textStyle={}, containerStyle={} }) => {
10
+ const { useDeeplinkHandler } = useContext(AppTheme);
8
11
  const textStyles = StyleSheet.flatten([
9
12
  textStyle,
10
13
  {
@@ -18,7 +21,7 @@ const CustomHtmlParser = ({ text, textStyle={}, containerStyle={} }) => {
18
21
  key={Math.random()}
19
22
  baseFontStyle={textStyles}
20
23
  onLinkPress={(evt, href) => {
21
- Linking.openURL(href);
24
+ useDeeplinkHandler(href);
22
25
  }}
23
26
  containerStyle={containerStyle}
24
27
  />
@@ -103,7 +103,7 @@ export const JSEmbedElement = (props) => {
103
103
 
104
104
  return {
105
105
  html: getHTMLContent(props.element['embed-js']),
106
- baseUrl,
106
+ baseUrl: extractBaseUrlFromIframe(getDecodedContent(props.element['embed-js'])),
107
107
  };
108
108
  };
109
109
 
@@ -20,7 +20,7 @@ export const PDFReader = ({ card, story }) => {
20
20
  const [modalVisible, setModalVisible] = useState(false);
21
21
 
22
22
  const { theme } = useContext(AppTheme);
23
- const { COLORS, FONT_SIZE, DARK_MODE, lineHeightMultiplier } = theme;
23
+ const { COLORS, FONT_SIZE, DARK_MODE, lineHeightMultiplier, translate } = theme;
24
24
 
25
25
  const showModal = () => {
26
26
  setModalVisible(true);
@@ -58,7 +58,9 @@ export const PDFReader = ({ card, story }) => {
58
58
  trustAllCerts={Platform.OS === 'ios'}
59
59
  />
60
60
  </Modal>
61
+ <Text style={{color:COLORS.BRAND_BLACK, fontSize: 25, fontWeight: 'bold', marginTop:40, marginLeft:15}}>{translate('Attachment')}</Text>
61
62
  <View style={styles.pdfContainer}>
63
+
62
64
  <View style={styles.pdfFileText}>
63
65
  <TouchableOpacity style={styles.pdfButton} onPress={showModal}>
64
66
  <Icon name="file-document-outline" size={56} style={styles.fileIcon} />
@@ -35,6 +35,10 @@ export const pdfStyles = (COLORS, FONT_SIZE, DARK_MODE, lineHeightMultiplier) =>
35
35
  },
36
36
  pdfContainer: {
37
37
  flexDirection: 'row',
38
+ marginBottom:40,
39
+ backgroundColor: COLORS.MONO6,
40
+ margin:10,
41
+ borderRadius: 5,
38
42
  },
39
43
  pdfFileText: {
40
44
  width: '80%',
@@ -93,7 +93,7 @@ const getStoryCards = (
93
93
 
94
94
  {source.length > (storyType === STORY_TYPES.VIDEO_STORY ? 2 : 1)
95
95
  && isMiddleIndexOfArray(index, source)
96
- && getAd(true, "body")}
96
+ && getAd(true)}
97
97
  {/* ^ Requesting mid-content-ad if there are > 1 card
98
98
  (> 2 cards in case of video story since the 1st card gets rendered in header). */}
99
99
 
@@ -106,7 +106,7 @@ const getStoryCards = (
106
106
  {cards.length === 1
107
107
  && source.length > (storyType === STORY_TYPES.VIDEO_STORY ? 2 : 1)
108
108
  && isMiddleIndexOfArray(index, source)
109
- && getAd(true, "body")}
109
+ && getAd(true)}
110
110
  {/* ^ In the case of a story having just 1 card,
111
111
  requesting mid-content-Ad if there are > 1 story-elements in that card
112
112
  (> 2 story-elements in case of video story since the 1st story-element gets rendered in header). */}
@@ -407,7 +407,7 @@ export const Story = ({
407
407
  </View>))}
408
408
 
409
409
 
410
- {getAd(false, "header")}
410
+ {getAd()}
411
411
 
412
412
  {getStoryCards(
413
413
  cards,
@@ -103,12 +103,12 @@ export const StoryContent = ({
103
103
  return <AllComponents.TitleElement card={storyElement} />;
104
104
  }
105
105
  case STORY_ELEMENT_TYPES.JS_EMBED: {
106
- switch (storyElement.subtype) {
107
- case STORY_ELEMENT_SUBTYPES.DAILY_MOTION: {
108
- return <DailyMotionPlayer element={storyElement} />;
109
- }
110
- default: break;
111
- }
106
+ // switch (storyElement.subtype) {
107
+ // case STORY_ELEMENT_SUBTYPES.DAILY_MOTION: {
108
+ // return <DailyMotionPlayer element={storyElement} />;
109
+ // }
110
+ // default: break;
111
+ // }
112
112
  return <AllComponents.JSEmbedElement element={storyElement} currentLayout={currentLayout} />;
113
113
  }
114
114
  default:
@@ -140,7 +140,7 @@ export const StoryGallery = ({ cdn, card }) => {
140
140
 
141
141
  const style = galleryStyles.fullWidth;
142
142
  return (
143
- <TouchableOpacity style={galleryStyles.subContainer}>
143
+ <TouchableOpacity style={[galleryStyles.subContainer,{margin:4}]}>
144
144
  <LightBoxImage
145
145
  onClickHandler={onPressHandler}
146
146
  hero={!!data.metaData['focus-point']}
@@ -11,20 +11,22 @@ export const styles = ({ FONT_SIZE }, screenDimensions) => {
11
11
  container: {
12
12
  width: '100%',
13
13
  paddingHorizontal: 10,
14
+
14
15
  },
15
16
  imgContainer: {
16
17
  width: '100%',
17
18
  flexDirection: 'row',
18
19
  flexWrap: 'wrap',
20
+
19
21
  },
20
22
  halfWidth: {
21
23
  width: (deviceWidth - 30) / 2,
22
24
  height: 124,
23
25
  },
24
26
  fullWidth: {
25
- width: (deviceWidth - 40) / 3,
26
- height: (deviceWidth - 40) / 3,
27
- margin: 2.5,
27
+ width: (deviceWidth - 45) / 3,
28
+ height: (deviceWidth - 45) / 3,
29
+ margin: 0,
28
30
  },
29
31
  descText: {
30
32
  fontSize: FONT_SIZE.h2,
@@ -8,7 +8,7 @@ import HTML from 'react-native-render-html';
8
8
  import { customHTMLStyles } from '../../constants/renderHTML';
9
9
 
10
10
  export const TextA = ({ answer }) => {
11
- const { theme } = useContext(AppTheme);
11
+ const { theme, useDeeplinkHandler } = useContext(AppTheme);
12
12
  const { COLORS, FONT_SIZE, lineHeightMultiplier, FONT_FAMILY} = theme;
13
13
  const styles = textAnswerStyles(COLORS, FONT_SIZE, lineHeightMultiplier);
14
14
  const customTagsStyles = customHTMLStyles();
@@ -29,7 +29,7 @@ export const TextA = ({ answer }) => {
29
29
  key={Math.random()}
30
30
  baseFontStyle={style}
31
31
  onLinkPress={(evt, href) => {
32
- Linking.openURL(href);
32
+ useDeeplinkHandler(href);
33
33
  }}
34
34
  tagsStyles={{
35
35
  del: customTagsStyles.del,
@@ -40,7 +40,7 @@ export const TextBigFact = ({ text, attribution, id }) => {
40
40
  key={Math.random()}
41
41
  baseFontStyle={style}
42
42
  onLinkPress={(evt, href) => {
43
- useDeeplinkHandler(href, props?.navigation);
43
+ useDeeplinkHandler(href);
44
44
  }}
45
45
  tagsStyles={{
46
46
  del: customTagsStyles.del,
@@ -36,7 +36,7 @@ export const TextBlockQuote = ({ text, attribution }) => {
36
36
  key={Math.random()}
37
37
  baseFontStyle={style}
38
38
  onLinkPress={(evt, href) => {
39
- useDeeplinkHandler(href, props?.navigation);
39
+ useDeeplinkHandler(href);
40
40
  }}
41
41
  tagsStyles={{
42
42
  del: customTagsStyles.del,
@@ -35,7 +35,7 @@ export const TextBlurb = ({ text }) => {
35
35
  key={Math.random()}
36
36
  baseFontStyle={style}
37
37
  onLinkPress={(evt, href) => {
38
- useDeeplinkHandler(href, props?.navigation);
38
+ useDeeplinkHandler(href);
39
39
  }}
40
40
  tagsStyles={{
41
41
  del: customTagsStyles.del,
@@ -7,7 +7,7 @@ import { AppTheme } from '@quintype/native-components/src/utils/context';
7
7
  import HTML from 'react-native-render-html';
8
8
  import { customHTMLStyles } from '../../constants/renderHTML';
9
9
  export const TextQ = ({ question }) => {
10
- const { theme } = useContext(AppTheme);
10
+ const { theme, useDeeplinkHandler } = useContext(AppTheme);
11
11
  const { COLORS, FONT_SIZE, lineHeightMultiplier, FONT_FAMILY } = theme;
12
12
  const styles = textQuestionStyles(COLORS, FONT_SIZE, lineHeightMultiplier);
13
13
  const customTagsStyles = customHTMLStyles();
@@ -28,7 +28,7 @@ export const TextQ = ({ question }) => {
28
28
  key={Math.random()}
29
29
  baseFontStyle={style}
30
30
  onLinkPress={(evt, href) => {
31
- Linking.openURL(href);
31
+ useDeeplinkHandler(href);
32
32
  }}
33
33
  tagsStyles={{
34
34
  del: customTagsStyles.del,
@@ -11,7 +11,7 @@ import { AppTheme } from '../../utils/context';
11
11
  import { alterQuoteData } from '../../utils';
12
12
 
13
13
  export const TextQuote = ({ text, attribution }) => {
14
- const { theme } = useContext(AppTheme);
14
+ const { theme, useDeeplinkHandler } = useContext(AppTheme);
15
15
  const {
16
16
  FONT_FAMILY, COLORS, FONT_SIZE, CAN_COPY_TEXT, lineHeightMultiplier,
17
17
  } = theme;
@@ -39,7 +39,7 @@ export const TextQuote = ({ text, attribution }) => {
39
39
  key={Math.random()}
40
40
  baseFontStyle={style}
41
41
  onLinkPress={(evt, href) => {
42
- Linking.openURL(href);
42
+ useDeeplinkHandler(href);
43
43
  }}
44
44
  tagsStyles={{
45
45
  del: customTagsStyles.del,
@@ -9,7 +9,7 @@ import { textSummaryStyles } from './styles';
9
9
  import { AppTheme } from '../../utils/context';
10
10
 
11
11
  export const TextSummary = (props) => {
12
- const { theme } = useContext(AppTheme);
12
+ const { theme, useDeeplinkHandler } = useContext(AppTheme);
13
13
  const {
14
14
  FONT_FAMILY, FONT_SIZE, COLORS, CAN_COPY_TEXT, lineHeightMultiplier,
15
15
  } = theme;
@@ -34,7 +34,7 @@ export const TextSummary = (props) => {
34
34
  key={Math.random()}
35
35
  baseFontStyle={style}
36
36
  onLinkPress={(evt, href) => {
37
- Linking.openURL(href);
37
+ useDeeplinkHandler(href);
38
38
  }}
39
39
  tagsStyles={{
40
40
  del: customTagsStyles.del,