@plusscommunities/pluss-core-app 8.0.28 → 8.0.31
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/dist/module/actions/FollowerActions.js +34 -0
- package/dist/module/actions/FollowerActions.js.map +1 -0
- package/dist/module/actions/MediaActions.js +29 -0
- package/dist/module/actions/MediaActions.js.map +1 -0
- package/dist/module/actions/ResidentActions.js +26 -0
- package/dist/module/actions/ResidentActions.js.map +1 -0
- package/dist/module/actions/UserActions.js +223 -0
- package/dist/module/actions/UserActions.js.map +1 -0
- package/dist/module/actions/UserSettingsActions.js +14 -0
- package/dist/module/actions/UserSettingsActions.js.map +1 -0
- package/dist/module/actions/index.js +6 -0
- package/dist/module/actions/index.js.map +1 -0
- package/dist/module/actions/types.js +17 -0
- package/dist/module/actions/types.js.map +1 -0
- package/dist/module/apis/analyticsActions.js +20 -0
- package/dist/module/apis/analyticsActions.js.map +1 -0
- package/dist/module/apis/contactActions.js +27 -0
- package/dist/module/apis/contactActions.js.map +1 -0
- package/dist/module/apis/eventActions.js +161 -0
- package/dist/module/apis/eventActions.js.map +1 -0
- package/dist/module/apis/fileActions.js +93 -0
- package/dist/module/apis/fileActions.js.map +1 -0
- package/dist/module/apis/followerActions.js +38 -0
- package/dist/module/apis/followerActions.js.map +1 -0
- package/dist/module/apis/index.js +13 -0
- package/dist/module/apis/index.js.map +1 -0
- package/dist/module/apis/notificationActions.js +60 -0
- package/dist/module/apis/notificationActions.js.map +1 -0
- package/dist/module/apis/profileActions.js +14 -0
- package/dist/module/apis/profileActions.js.map +1 -0
- package/dist/module/apis/reactionActions.js +76 -0
- package/dist/module/apis/reactionActions.js.map +1 -0
- package/dist/module/apis/settingActions.js +22 -0
- package/dist/module/apis/settingActions.js.map +1 -0
- package/dist/module/apis/stringActions.js +30 -0
- package/dist/module/apis/stringActions.js.map +1 -0
- package/dist/module/apis/typeActions.js +15 -0
- package/dist/module/apis/typeActions.js.map +1 -0
- package/dist/module/apis/userActions.js +104 -0
- package/dist/module/apis/userActions.js.map +1 -0
- package/dist/module/assets/icons/fontawesome/fa-brands-400.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-light-300.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-regular-400.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-solid-900.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-thin-100.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa7-glyphmap.json +4205 -0
- package/dist/module/assets/icons/reactions/heart.png +0 -0
- package/dist/module/assets/icons/reactions/party.png +0 -0
- package/dist/module/assets/icons/reactions/sad.png +0 -0
- package/dist/module/assets/icons/reactions/smile.png +0 -0
- package/dist/module/colours.js +165 -0
- package/dist/module/colours.js.map +1 -0
- package/dist/module/components/AddButton.js +43 -0
- package/dist/module/components/AddButton.js.map +1 -0
- package/dist/module/components/AddToCalendarButton.js +225 -0
- package/dist/module/components/AddToCalendarButton.js.map +1 -0
- package/dist/module/components/Attachment.js +55 -0
- package/dist/module/components/Attachment.js.map +1 -0
- package/dist/module/components/AudienceSelectorLauncher.js +64 -0
- package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
- package/dist/module/components/AudienceSelectorPage.js +351 -0
- package/dist/module/components/AudienceSelectorPage.js.map +1 -0
- package/dist/module/components/AutoOffsetImage.js +184 -0
- package/dist/module/components/AutoOffsetImage.js.map +1 -0
- package/dist/module/components/BackButton.js +58 -0
- package/dist/module/components/BackButton.js.map +1 -0
- package/dist/module/components/CalendarPopup.js +126 -0
- package/dist/module/components/CalendarPopup.js.map +1 -0
- package/dist/module/components/CategoryTabs.js +155 -0
- package/dist/module/components/CategoryTabs.js.map +1 -0
- package/dist/module/components/CommentReply.js +334 -0
- package/dist/module/components/CommentReply.js.map +1 -0
- package/dist/module/components/CommentSection.js +823 -0
- package/dist/module/components/CommentSection.js.map +1 -0
- package/dist/module/components/ConfirmPopup.js +109 -0
- package/dist/module/components/ConfirmPopup.js.map +1 -0
- package/dist/module/components/ConfirmationPopup.js +72 -0
- package/dist/module/components/ConfirmationPopup.js.map +1 -0
- package/dist/module/components/DocumentUploader.js +253 -0
- package/dist/module/components/DocumentUploader.js.map +1 -0
- package/dist/module/components/DropDownItem.js +75 -0
- package/dist/module/components/DropDownItem.js.map +1 -0
- package/dist/module/components/DropDownMenu.js +41 -0
- package/dist/module/components/DropDownMenu.js.map +1 -0
- package/dist/module/components/EmptyStateMain.js +51 -0
- package/dist/module/components/EmptyStateMain.js.map +1 -0
- package/dist/module/components/EmptyStateWidget.js +48 -0
- package/dist/module/components/EmptyStateWidget.js.map +1 -0
- package/dist/module/components/FontScaleButton.js +37 -0
- package/dist/module/components/FontScaleButton.js.map +1 -0
- package/dist/module/components/FontScalePopup.js +76 -0
- package/dist/module/components/FontScalePopup.js.map +1 -0
- package/dist/module/components/Forbidden.js +58 -0
- package/dist/module/components/Forbidden.js.map +1 -0
- package/dist/module/components/FormCard.js +25 -0
- package/dist/module/components/FormCard.js.map +1 -0
- package/dist/module/components/FormCardSection.js +214 -0
- package/dist/module/components/FormCardSection.js.map +1 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js +73 -0
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
- package/dist/module/components/FormattedText.js +133 -0
- package/dist/module/components/FormattedText.js.map +1 -0
- package/dist/module/components/GenericInput.js +151 -0
- package/dist/module/components/GenericInput.js.map +1 -0
- package/dist/module/components/GenericInputSection.js +173 -0
- package/dist/module/components/GenericInputSection.js.map +1 -0
- package/dist/module/components/Header.js +459 -0
- package/dist/module/components/Header.js.map +1 -0
- package/dist/module/components/Icon.js +109 -0
- package/dist/module/components/Icon.js.map +1 -0
- package/dist/module/components/ImagePopup.js +400 -0
- package/dist/module/components/ImagePopup.js.map +1 -0
- package/dist/module/components/ImageUploadProgress.js +69 -0
- package/dist/module/components/ImageUploadProgress.js.map +1 -0
- package/dist/module/components/ImageUploader.js +831 -0
- package/dist/module/components/ImageUploader.js.map +1 -0
- package/dist/module/components/InlineButton.js +66 -0
- package/dist/module/components/InlineButton.js.map +1 -0
- package/dist/module/components/Input.js +156 -0
- package/dist/module/components/Input.js.map +1 -0
- package/dist/module/components/LoadingCircles.js +219 -0
- package/dist/module/components/LoadingCircles.js.map +1 -0
- package/dist/module/components/LoadingIndicator.js +86 -0
- package/dist/module/components/LoadingIndicator.js.map +1 -0
- package/dist/module/components/LoadingStateWidget.js +46 -0
- package/dist/module/components/LoadingStateWidget.js.map +1 -0
- package/dist/module/components/MediaPlayer.js +407 -0
- package/dist/module/components/MediaPlayer.js.map +1 -0
- package/dist/module/components/MiddlePopup.js +49 -0
- package/dist/module/components/MiddlePopup.js.map +1 -0
- package/dist/module/components/PDFPopup.js +296 -0
- package/dist/module/components/PDFPopup.js.map +1 -0
- package/dist/module/components/PlussChat.js +1078 -0
- package/dist/module/components/PlussChat.js.map +1 -0
- package/dist/module/components/PlussChatMessage.js +299 -0
- package/dist/module/components/PlussChatMessage.js.map +1 -0
- package/dist/module/components/PlussChatTime.js +59 -0
- package/dist/module/components/PlussChatTime.js.map +1 -0
- package/dist/module/components/Popup.js +126 -0
- package/dist/module/components/Popup.js.map +1 -0
- package/dist/module/components/PopupMenu.js +120 -0
- package/dist/module/components/PopupMenu.js.map +1 -0
- package/dist/module/components/PositionedImage.js +313 -0
- package/dist/module/components/PositionedImage.js.map +1 -0
- package/dist/module/components/ProfilePic.js +105 -0
- package/dist/module/components/ProfilePic.js.map +1 -0
- package/dist/module/components/RadioButton.js +78 -0
- package/dist/module/components/RadioButton.js.map +1 -0
- package/dist/module/components/Reaction.js +117 -0
- package/dist/module/components/Reaction.js.map +1 -0
- package/dist/module/components/Reactions.js +71 -0
- package/dist/module/components/Reactions.js.map +1 -0
- package/dist/module/components/SharingTools.js +189 -0
- package/dist/module/components/SharingTools.js.map +1 -0
- package/dist/module/components/Spinner.js +22 -0
- package/dist/module/components/Spinner.js.map +1 -0
- package/dist/module/components/StickyFooter.js +34 -0
- package/dist/module/components/StickyFooter.js.map +1 -0
- package/dist/module/components/Text.js +57 -0
- package/dist/module/components/Text.js.map +1 -0
- package/dist/module/components/TickIcon.js +24 -0
- package/dist/module/components/TickIcon.js.map +1 -0
- package/dist/module/components/Toggle.js +66 -0
- package/dist/module/components/Toggle.js.map +1 -0
- package/dist/module/components/TouchableSearchBar.js +68 -0
- package/dist/module/components/TouchableSearchBar.js.map +1 -0
- package/dist/module/components/UserListPopup.js +136 -0
- package/dist/module/components/UserListPopup.js.map +1 -0
- package/dist/module/components/UserListing.js +268 -0
- package/dist/module/components/UserListing.js.map +1 -0
- package/dist/module/components/VideoPopup.js +113 -0
- package/dist/module/components/VideoPopup.js.map +1 -0
- package/dist/module/components/WarningPopup.js +85 -0
- package/dist/module/components/WarningPopup.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +289 -0
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js +117 -0
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
- package/dist/module/components/index.js +60 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +422 -0
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +387 -0
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
- package/dist/module/config.js +27 -0
- package/dist/module/config.js.map +1 -0
- package/dist/module/constants.js +18 -0
- package/dist/module/constants.js.map +1 -0
- package/dist/module/helper.js +424 -0
- package/dist/module/helper.js.map +1 -0
- package/dist/module/index.js +13 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/js/images/detectFaces.js +31 -0
- package/dist/module/js/images/detectFaces.js.map +1 -0
- package/dist/module/js/images/findLandmarkRange.js +93 -0
- package/dist/module/js/images/findLandmarkRange.js.map +1 -0
- package/dist/module/js/images/getScaledOffset.js +81 -0
- package/dist/module/js/images/getScaledOffset.js.map +1 -0
- package/dist/module/js/site/getSiteLevelFromState.js +29 -0
- package/dist/module/js/site/getSiteLevelFromState.js.map +1 -0
- package/dist/module/js/site/isTVEnabled.js +10 -0
- package/dist/module/js/site/isTVEnabled.js.map +1 -0
- package/dist/module/session.js +58 -0
- package/dist/module/session.js.map +1 -0
- package/dist/module/styles.js +67 -0
- package/dist/module/styles.js.map +1 -0
- package/dist/module/withNavigationFocus.js +30 -0
- package/dist/module/withNavigationFocus.js.map +1 -0
- package/package.json +1 -1
- package/src/components/PDFPopup.js +130 -35
- package/src/components/react-native-expo-image-cropper/ExpoImageManipulator.js +91 -87
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","PureComponent","View","TouchableOpacity","connect","stylez","FontAwesome","getMainBrandingColourFromState","BackButton","render","size","props","diameter","radius","noClick","createElement","style","backButton","backgroundColor","colourBrandingMain","height","width","borderRadius","color","name","flipped","backButtonIcon","iconStyle","onPress","mapStateToProps","state"],"sources":["BackButton.js"],"sourcesContent":["import React, { PureComponent } from \"react\";\nimport { View, TouchableOpacity } from \"react-native\";\nimport { connect } from \"react-redux\";\nimport stylez from \"../styles\";\nimport { FontAwesome } from \"./Icon\";\nimport { getMainBrandingColourFromState } from \"../colours\";\n\n/* \nProps- \n onPress - onPress action\n diameter - size of button\n color - default will be aveoMain\n style - custom style for container\n*/\n\nclass BackButton extends PureComponent {\n\trender() {\n\t\tconst size = this.props.diameter || 32;\n\t\tconst radius = size / 2;\n\t\tif (this.props.noClick) {\n\t\t\treturn (\n\t\t\t\t<View\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\tstylez.backButton,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbackgroundColor: this.props.colourBrandingMain,\n\t\t\t\t\t\t\theight: size,\n\t\t\t\t\t\t\twidth: size,\n\t\t\t\t\t\t\tborderRadius: radius,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.props.color && { backgroundColor: this.props.color },\n\t\t\t\t\t\tthis.props.style,\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t<FontAwesome\n\t\t\t\t\t\tname={this.props.flipped ? \"chevron-right\" : \"chevron-left\"}\n\t\t\t\t\t\tstyle={[stylez.backButtonIcon, this.props.iconStyle]}\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn (\n\t\t\t<TouchableOpacity\n\t\t\t\tstyle={[\n\t\t\t\t\tstylez.backButton,\n\t\t\t\t\t{\n\t\t\t\t\t\tbackgroundColor: this.props.colourBrandingMain,\n\t\t\t\t\t\theight: size,\n\t\t\t\t\t\twidth: size,\n\t\t\t\t\t\tborderRadius: radius,\n\t\t\t\t\t},\n\t\t\t\t\tthis.props.color && { backgroundColor: this.props.color },\n\t\t\t\t\tthis.props.style,\n\t\t\t\t]}\n\t\t\t\tonPress={this.props.onPress}\n\t\t\t>\n\t\t\t\t<FontAwesome\n\t\t\t\t\tname={this.props.flipped ? \"chevron-right\" : \"chevron-left\"}\n\t\t\t\t\tstyle={[stylez.backButtonIcon, this.props.iconStyle]}\n\t\t\t\t/>\n\t\t\t</TouchableOpacity>\n\t\t);\n\t}\n}\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\tcolourBrandingMain: getMainBrandingColourFromState(state),\n\t};\n};\n\nconst backButton = connect(mapStateToProps, {})(BackButton);\nexport { backButton as BackButton };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAC5C,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AACrD,SAASC,OAAO,QAAQ,aAAa;AACrC,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,8BAA8B,QAAQ,YAAY;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,UAAU,SAASP,aAAa,CAAC;EACtCQ,M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ACXkB,IAAI,EAAE,IAAI,CAACb,KAAK,CAACc,OAAO,GAAG,eAAe,GAAG,cAAe;MAC5DT,KAAK,EAAE,CAACX,MAAM,CAACqB,cAAc,EAAE,IAAI,CAACf,KAAK,CAACgB,SAAS;IAAE,CACrD,CACgB,CAAC;EAErB;AACD;AAEA,MAAME,eAAe,GAAIC,KAAK,IAAK;EAClC,OAAO;IACNX,kBAAkB,EAAEZ,8BAA8B,CAACuB,KAAK;EACzD,CAAC;AACF,CAAC;AAED,MAAMb,UAAU,GAAGb,OAAO,CAACyB,eAAe,EAAE,CAAC,CAAC,CAAC,CAACrB,UAAU,CAAC;AAC3D,SAASS,UAAU,IAAIT,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
import moment from "moment";
|
|
5
|
+
import React, { Component } from "react";
|
|
6
|
+
import { Modal, View, TouchableOpacity, StyleSheet } from "react-native";
|
|
7
|
+
import { Calendar } from "react-native-calendars";
|
|
8
|
+
import { StatusBarHeight } from "../helper";
|
|
9
|
+
import { FontAwesome } from "./Icon";
|
|
10
|
+
import { hexToRGBAstring, COLOUR_RED, TEXT_DARK, COLOUR_GRAPEFRUIT } from "../colours";
|
|
11
|
+
class CalendarPopup extends Component {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
_defineProperty(this, "onDayPress", date => {
|
|
15
|
+
const {
|
|
16
|
+
onSelect
|
|
17
|
+
} = this.props;
|
|
18
|
+
if (!onSelect) return;
|
|
19
|
+
|
|
20
|
+
// console.log('onDayPress', date);
|
|
21
|
+
onSelect(date.timestamp);
|
|
22
|
+
});
|
|
23
|
+
this.state = {};
|
|
24
|
+
}
|
|
25
|
+
renderClose() {
|
|
26
|
+
const {
|
|
27
|
+
onClose
|
|
28
|
+
} = this.props;
|
|
29
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
30
|
+
style: styles.menuIconContainer,
|
|
31
|
+
onPress: onClose,
|
|
32
|
+
activeOpacity: 0.6
|
|
33
|
+
}, /*#__PURE__*/React.createElement(FontAwesome, {
|
|
34
|
+
name: "x",
|
|
35
|
+
style: styles.menuIcon
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
const {
|
|
40
|
+
visible,
|
|
41
|
+
animationType,
|
|
42
|
+
onClose,
|
|
43
|
+
backgroundStyle,
|
|
44
|
+
selectedDate,
|
|
45
|
+
minDate,
|
|
46
|
+
maxDate,
|
|
47
|
+
enabledDates,
|
|
48
|
+
selectedColor,
|
|
49
|
+
enabledColor,
|
|
50
|
+
disabledColor,
|
|
51
|
+
theme
|
|
52
|
+
} = this.props;
|
|
53
|
+
const initialDate = (selectedDate ? moment(selectedDate) : moment()).format("YYYY-MM-DD");
|
|
54
|
+
const min = minDate ? moment(minDate).format("YYYY-MM-DD") : undefined;
|
|
55
|
+
const max = maxDate ? moment(maxDate).format("YYYY-MM-DD") : undefined;
|
|
56
|
+
const dateMarkings = {};
|
|
57
|
+
(enabledDates || []).forEach(date => {
|
|
58
|
+
const {
|
|
59
|
+
day,
|
|
60
|
+
enabled
|
|
61
|
+
} = date;
|
|
62
|
+
const key = moment(day).format("YYYY-MM-DD");
|
|
63
|
+
dateMarkings[key] = {
|
|
64
|
+
enabled,
|
|
65
|
+
disableTouchEvent: !enabled,
|
|
66
|
+
customStyles: {
|
|
67
|
+
text: {
|
|
68
|
+
color: enabled ? enabledColor || TEXT_DARK : disabledColor || COLOUR_RED
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
// console.log('CalendarPopup - enabled', JSON.stringify(dateMarkings, null, 2));
|
|
74
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
75
|
+
transparent: true,
|
|
76
|
+
visible: visible || false,
|
|
77
|
+
animationType: animationType || "fade",
|
|
78
|
+
onRequestClose: onClose
|
|
79
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
80
|
+
style: [styles.popup, backgroundStyle || {
|
|
81
|
+
backgroundColor: hexToRGBAstring("#fff", 1)
|
|
82
|
+
}]
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Calendar, {
|
|
84
|
+
initialDate: initialDate,
|
|
85
|
+
minDate: min,
|
|
86
|
+
maxDate: max,
|
|
87
|
+
markingType: "custom",
|
|
88
|
+
markedDates: {
|
|
89
|
+
...dateMarkings,
|
|
90
|
+
[initialDate]: {
|
|
91
|
+
selected: true,
|
|
92
|
+
selectedColor: selectedColor || COLOUR_GRAPEFRUIT
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
onDayPress: this.onDayPress,
|
|
96
|
+
theme: theme
|
|
97
|
+
})), this.renderClose());
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const styles = StyleSheet.create({
|
|
101
|
+
container: {
|
|
102
|
+
backgroundColor: "#000"
|
|
103
|
+
},
|
|
104
|
+
popup: {
|
|
105
|
+
flex: 1,
|
|
106
|
+
justifyContent: "center"
|
|
107
|
+
},
|
|
108
|
+
menuIconContainer: {
|
|
109
|
+
position: "absolute",
|
|
110
|
+
top: StatusBarHeight(0),
|
|
111
|
+
right: 0,
|
|
112
|
+
width: 55,
|
|
113
|
+
height: 55,
|
|
114
|
+
zIndex: 3
|
|
115
|
+
},
|
|
116
|
+
menuIcon: {
|
|
117
|
+
fontSize: 30,
|
|
118
|
+
padding: 15,
|
|
119
|
+
width: 65,
|
|
120
|
+
textAlign: "center",
|
|
121
|
+
color: "#000",
|
|
122
|
+
zIndex: 3
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
export { CalendarPopup };
|
|
126
|
+
//# sourceMappingURL=CalendarPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["moment","React","Component","Modal","View","TouchableOpacity","StyleSheet","Calendar","StatusBarHeight","FontAwesome","hexToRGBAstring","COLOUR_RED","TEXT_DARK","COLOUR_GRAPEFRUIT","CalendarPopup","constructor","props","_defineProperty","date","onSelect","timestamp","state","renderClose","onClose","createElement","style","styles","menuIconContainer","onPress","activeOpacity","name","menuIcon","render","visible","animationType","backgroundStyle","selectedDate","minDate","maxDate","enabledDates","selectedColor","enabledColor","disabledColor","theme","initialDate","format","min","undefined","max","dateMarkings","forEach","day","enabled","key","disableTouchEvent","customStyles","text","color","transparent","onRequestClose","popup","backgroundColor","markingType","markedDates","selected","onDayPress","create","container","flex","justifyContent","position","top","right","width","height","zIndex","fontSize","padding","textAlign"],"sources":["CalendarPopup.js"],"sourcesContent":["import moment from \"moment\";\nimport React, { Component } from \"react\";\nimport { Modal, View, TouchableOpacity, StyleSheet } from \"react-native\";\nimport { Calendar } from \"react-native-calendars\";\nimport { StatusBarHeight } from \"../helper\";\nimport { FontAwesome } from \"./Icon\";\nimport {\n\thexToRGBAstring,\n\tCOLOUR_RED,\n\tTEXT_DARK,\n\tCOLOUR_GRAPEFRUIT,\n} from \"../colours\";\n\nclass CalendarPopup extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\n\t\tthis.state = {};\n\t}\n\n\tonDayPress = (date) => {\n\t\tconst { onSelect } = this.props;\n\t\tif (!onSelect) return;\n\n\t\t// console.log('onDayPress', date);\n\t\tonSelect(date.timestamp);\n\t};\n\n\trenderClose() {\n\t\tconst { onClose } = this.props;\n\t\treturn (\n\t\t\t<TouchableOpacity\n\t\t\t\tstyle={styles.menuIconContainer}\n\t\t\t\tonPress={onClose}\n\t\t\t\tactiveOpacity={0.6}\n\t\t\t>\n\t\t\t\t<FontAwesome name=\"x\" style={styles.menuIcon} />\n\t\t\t</TouchableOpacity>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tvisible,\n\t\t\tanimationType,\n\t\t\tonClose,\n\t\t\tbackgroundStyle,\n\t\t\tselectedDate,\n\t\t\tminDate,\n\t\t\tmaxDate,\n\t\t\tenabledDates,\n\t\t\tselectedColor,\n\t\t\tenabledColor,\n\t\t\tdisabledColor,\n\t\t\ttheme,\n\t\t} = this.props;\n\n\t\tconst initialDate = (selectedDate ? moment(selectedDate) : moment()).format(\n\t\t\t\"YYYY-MM-DD\",\n\t\t);\n\t\tconst min = minDate ? moment(minDate).format(\"YYYY-MM-DD\") : undefined;\n\t\tconst max = maxDate ? moment(maxDate).format(\"YYYY-MM-DD\") : undefined;\n\t\tconst dateMarkings = {};\n\t\t(enabledDates || []).forEach((date) => {\n\t\t\tconst { day, enabled } = date;\n\t\t\tconst key = moment(day).format(\"YYYY-MM-DD\");\n\t\t\tdateMarkings[key] = {\n\t\t\t\tenabled,\n\t\t\t\tdisableTouchEvent: !enabled,\n\t\t\t\tcustomStyles: {\n\t\t\t\t\ttext: {\n\t\t\t\t\t\tcolor: enabled\n\t\t\t\t\t\t\t? enabledColor || TEXT_DARK\n\t\t\t\t\t\t\t: disabledColor || COLOUR_RED,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\t\t// console.log('CalendarPopup - enabled', JSON.stringify(dateMarkings, null, 2));\n\t\treturn (\n\t\t\t<Modal\n\t\t\t\ttransparent\n\t\t\t\tvisible={visible || false}\n\t\t\t\tanimationType={animationType || \"fade\"}\n\t\t\t\tonRequestClose={onClose}\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\tstyles.popup,\n\t\t\t\t\t\tbackgroundStyle || { backgroundColor: hexToRGBAstring(\"#fff\", 1) },\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t<Calendar\n\t\t\t\t\t\tinitialDate={initialDate}\n\t\t\t\t\t\tminDate={min}\n\t\t\t\t\t\tmaxDate={max}\n\t\t\t\t\t\tmarkingType={\"custom\"}\n\t\t\t\t\t\tmarkedDates={{\n\t\t\t\t\t\t\t...dateMarkings,\n\t\t\t\t\t\t\t[initialDate]: {\n\t\t\t\t\t\t\t\tselected: true,\n\t\t\t\t\t\t\t\tselectedColor: selectedColor || COLOUR_GRAPEFRUIT,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonDayPress={this.onDayPress}\n\t\t\t\t\t\ttheme={theme}\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t\t{this.renderClose()}\n\t\t\t</Modal>\n\t\t);\n\t}\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tbackgroundColor: \"#000\",\n\t},\n\tpopup: {\n\t\tflex: 1,\n\t\tjustifyContent: \"center\",\n\t},\n\tmenuIconContainer: {\n\t\tposition: \"absolute\",\n\t\ttop: StatusBarHeight(0),\n\t\tright: 0,\n\t\twidth: 55,\n\t\theight: 55,\n\t\tzIndex: 3,\n\t},\n\tmenuIcon: {\n\t\tfontSize: 30,\n\t\tpadding: 15,\n\t\twidth: 65,\n\t\ttextAlign: \"center\",\n\t\tcolor: \"#000\",\n\t\tzIndex: 3,\n\t},\n});\n\nexport { CalendarPopup };\n"],"mappings":";;;AAAA,OAAOA,MAAM,MAAM,QAAQ;AAC3B,OAAOC,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,KAAK,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AACxE,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,WAAW,QAAQ,QAAQ;AACpC,SACCC,eAAe,EACfC,UAAU,EACVC,SAAS,EACTC,iBAAiB,QACX,YA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I,CAACrB,WAAW,CAAC,CACZ,CAAC;EAEV;AACD;AAEA,MAAMI,MAAM,GAAGpB,UAAU,CAAC4D,MAAM,CAAC;EAChCC,SAAS,EAAE;IACVN,eAAe,EAAE;EAClB,CAAC;EACDD,KAAK,EAAE;IACNQ,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EACjB,CAAC;EACD1C,iBAAiB,EAAE;IAClB2C,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE/D,eAAe,CAAC,CAAC,CAAC;IACvBgE,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVC,MAAM,EAAE;EACT,CAAC;EACD5C,QAAQ,EAAE;IACT6C,QAAQ,EAAE,EAAE;IACZC,OAAO,EAAE,EAAE;IACXJ,KAAK,EAAE,EAAE;IACTK,SAAS,EAAE,QAAQ;IACnBrB,KAAK,EAAE,MAAM;IACbkB,MAAM,EAAE;EACT;AACD,CAAC,CAAC;AAEF,SAAS7D,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import React, { Component } from "react";
|
|
2
|
+
import _ from "lodash";
|
|
3
|
+
import { TouchableOpacity, View, ScrollView } from "react-native";
|
|
4
|
+
import { Text } from "./Text";
|
|
5
|
+
import { connect } from "react-redux";
|
|
6
|
+
import { TEXT_LIGHT, COLOUR_GREEN, getMainBrandingColourFromState } from "../colours";
|
|
7
|
+
import { getSiteSettingFromState } from "../helper";
|
|
8
|
+
// import { HAS_GRADIENT_HEADER } from '../../config';
|
|
9
|
+
import Config from "../config";
|
|
10
|
+
class CategoryTabs extends Component {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
this.state = {
|
|
14
|
+
categoryKeys: [],
|
|
15
|
+
selectedCategory: this.props.initialCategory
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
UNSAFE_componentWillMount() {
|
|
19
|
+
this.setState({
|
|
20
|
+
selectedCategory: !_.isUndefined(this.props.currentTab) && !_.isEmpty(this.props.currentTab) ? this.props.currentTab : this.props.initialCategory,
|
|
21
|
+
categoryKeys: this.props.categoryKeys
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
componentDidMount() {
|
|
25
|
+
this.setState({
|
|
26
|
+
selectedCategory: !_.isUndefined(this.props.currentTab) && !_.isEmpty(this.props.currentTab) ? this.props.currentTab : this.props.initialCategory
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
30
|
+
if (!_.isUndefined(nextProps.currentTab) && !_.isEmpty(nextProps.currentTab)) {
|
|
31
|
+
this.setState({
|
|
32
|
+
selectedCategory: nextProps.currentTab
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
selectCategory(key) {
|
|
37
|
+
this.setState({
|
|
38
|
+
selectedCategory: key
|
|
39
|
+
});
|
|
40
|
+
this.props.onSelect(key);
|
|
41
|
+
}
|
|
42
|
+
renderCounter(key) {
|
|
43
|
+
if (this.props.categoryCounter && this.props.categoryCounter[key] && this.props.categoryCounter[key] === true && this.props.counterValues && this.props.counterValues[key] > 0) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
45
|
+
style: styles.counter
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
47
|
+
style: styles.counterText
|
|
48
|
+
}, this.props.counterValues[key]));
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
renderCategories(noScrollStyle) {
|
|
53
|
+
const getTextColour = key => {
|
|
54
|
+
if (this.state.selectedCategory === key) {
|
|
55
|
+
return this.props.headerType !== "white" ? "#fff" : this.props.colourBrandingMain;
|
|
56
|
+
}
|
|
57
|
+
return this.props.headerType !== "white" ? "#fff" : TEXT_LIGHT;
|
|
58
|
+
};
|
|
59
|
+
const getBottomBorderColour = key => {
|
|
60
|
+
if (this.state.selectedCategory === key) {
|
|
61
|
+
return this.props.headerType !== "white" ? "#fff" : this.props.colourBrandingMain;
|
|
62
|
+
}
|
|
63
|
+
return this.props.headerType !== "white" ? this.props.colourBrandingMain : "#fff";
|
|
64
|
+
};
|
|
65
|
+
return this.state.categoryKeys.map((key, index) => {
|
|
66
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
67
|
+
key: index
|
|
68
|
+
// style={[{ minHeight: this.props.height || 30, justifyContent: 'center' }, noScrollStyle && { flex: 1 }]}
|
|
69
|
+
,
|
|
70
|
+
style: [{
|
|
71
|
+
flex: 1,
|
|
72
|
+
minHeight: this.props.height || 30,
|
|
73
|
+
justifyContent: "center"
|
|
74
|
+
}, this.props.catWrapperStyle],
|
|
75
|
+
onPress: this.selectCategory.bind(this, key)
|
|
76
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
77
|
+
style: [{
|
|
78
|
+
borderBottomColor: getBottomBorderColour(key),
|
|
79
|
+
borderBottomWidth: noScrollStyle ? 0 : 2,
|
|
80
|
+
marginRight: noScrollStyle ? 0 : 16,
|
|
81
|
+
marginLeft: index === 0 && !noScrollStyle ? 16 : 0,
|
|
82
|
+
justifyContent: "center",
|
|
83
|
+
alignContent: "center",
|
|
84
|
+
minHeight: 30,
|
|
85
|
+
flexDirection: "row",
|
|
86
|
+
backgroundColor: this.props.headerType !== "white" ? this.props.colourBrandingMain : undefined
|
|
87
|
+
}, this.props.style]
|
|
88
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
89
|
+
style: [noScrollStyle && styles.innerContainer, {
|
|
90
|
+
flex: 1,
|
|
91
|
+
borderColor: getBottomBorderColour(key),
|
|
92
|
+
justifyContent: "center"
|
|
93
|
+
}, this.props.catStyle]
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
95
|
+
style: [{
|
|
96
|
+
fontFamily: "sf-semibold",
|
|
97
|
+
fontSize: 15,
|
|
98
|
+
color: getTextColour(key),
|
|
99
|
+
textAlign: "center",
|
|
100
|
+
paddingVertical: 8,
|
|
101
|
+
width: "auto"
|
|
102
|
+
}, this.props.textStyle, this.props.colourBrandingHeader && this.state.selectedCategory !== key && {
|
|
103
|
+
color: this.props.colourBrandingMain,
|
|
104
|
+
opacity: 0.5
|
|
105
|
+
}]
|
|
106
|
+
}, key), this.renderCounter(key))));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
render() {
|
|
110
|
+
if (this.props.noScroll) {
|
|
111
|
+
// return (<View style={{ flexDirection: 'row', paddingLeft: 16, paddingRight: 16 }}>
|
|
112
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
113
|
+
style: {
|
|
114
|
+
flexDirection: "row",
|
|
115
|
+
justifyContent: "space-evenly"
|
|
116
|
+
}
|
|
117
|
+
}, this.renderCategories(true));
|
|
118
|
+
}
|
|
119
|
+
return /*#__PURE__*/React.createElement(ScrollView, {
|
|
120
|
+
horizontal: true
|
|
121
|
+
}, this.renderCategories(false));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const styles = {
|
|
125
|
+
counter: {
|
|
126
|
+
backgroundColor: COLOUR_GREEN,
|
|
127
|
+
height: 16,
|
|
128
|
+
minWidth: 16,
|
|
129
|
+
borderRadius: 8,
|
|
130
|
+
marginLeft: 4,
|
|
131
|
+
marginTop: 4,
|
|
132
|
+
justifyContent: "center",
|
|
133
|
+
alignContent: "center"
|
|
134
|
+
},
|
|
135
|
+
counterText: {
|
|
136
|
+
color: "#fff",
|
|
137
|
+
textAlign: "center",
|
|
138
|
+
fontSize: 12,
|
|
139
|
+
fontFamily: "sf-semibold"
|
|
140
|
+
},
|
|
141
|
+
innerContainer: {
|
|
142
|
+
borderBottomWidth: 2,
|
|
143
|
+
flexDirection: "row",
|
|
144
|
+
paddingHorizontal: 8
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const mapStateToProps = state => {
|
|
148
|
+
return {
|
|
149
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
150
|
+
headerType: getSiteSettingFromState(state, "HeaderType", getSiteSettingFromState(state, "UseGradientHeader", Config.env.hasGradientHeader) ? "gradient" : "white")
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
const categoryTabs = connect(mapStateToProps, {})(CategoryTabs);
|
|
154
|
+
export { categoryTabs as CategoryTabs };
|
|
155
|
+
//# sourceMappingURL=CategoryTabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Component","_","TouchableOpacity","View","ScrollView","Text","connect","TEXT_LIGHT","COLOUR_GREEN","getMainBrandingColourFromState","getSiteSettingFromState","Config","CategoryTabs","constructor","props","state","categoryKeys","selectedCategory","initialCategory","UNSAFE_componentWillMount","setState","isUndefined","currentTab","isEmpty","componentDidMount","UNSAFE_componentWillReceiveProps","nextProps","selectCategory","key","onSelect","renderCounter","categoryCounter","counterValues","createElement","style","styles","counter","counterText","renderCategories","noScrollStyle","getTextColour","headerType","colourBrandingMain","getBottomBorderColour","map","index","flex","minHeight","height","justifyContent","catWrapperStyle","onPress","bind","borderBottomColor","borderBottomWidth","marginRight","marginLeft","alignContent","flexDirection","backgroundColor","undefined","innerContainer","borderColor","catStyle","fontFamily","fontSize","color","textAlign","paddingVertical","width","textStyle","colourBrandingHeader","opacity","render","noScroll","horizontal","minWidth","borderRadius","marginTop","paddingHorizontal","mapStateToProps","env","hasGradientHeader","categoryTabs"],"sources":["CategoryTabs.js"],"sourcesContent":["import React, { Component } from \"react\";\nimport _ from \"lodash\";\nimport { TouchableOpacity, View, ScrollView } from \"react-native\";\nimport { Text } from \"./Text\";\nimport { connect } from \"react-redux\";\nimport {\n\tTEXT_LIGHT,\n\tCOLOUR_GREEN,\n\tgetMainBrandingColourFromState,\n} from \"../colours\";\nimport { getSiteSettingFromState } from \"../helper\";\n// import { HAS_GRADIENT_HEADER } from '../../config';\nimport Config from \"../config\";\n\nclass CategoryTabs extends Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tcategoryKeys: [],\n\t\t\tselectedCategory: this.props.initialCategory,\n\t\t};\n\t}\n\n\tUNSAFE_componentWillMount() {\n\t\tthis.setState({\n\t\t\tselectedCategory:\n\t\t\t\t!_.isUndefined(this.props.currentTab) &&\n\t\t\t\t!_.isEmpty(this.props.currentTab)\n\t\t\t\t\t? this.props.currentTab\n\t\t\t\t\t: this.props.initialCategory,\n\t\t\tcategoryKeys: this.props.categoryKeys,\n\t\t});\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.setState({\n\t\t\tselectedCategory:\n\t\t\t\t!_.isUndefined(this.props.currentTab) &&\n\t\t\t\t!_.isEmpty(this.props.currentTab)\n\t\t\t\t\t? this.props.currentTab\n\t\t\t\t\t: this.props.initialCategory,\n\t\t});\n\t}\n\n\tUNSAFE_componentWillReceiveProps(nextProps) {\n\t\tif (\n\t\t\t!_.isUndefined(nextProps.currentTab) &&\n\t\t\t!_.isEmpty(nextProps.currentTab)\n\t\t) {\n\t\t\tthis.setState({ selectedCategory: nextProps.currentTab });\n\t\t}\n\t}\n\n\tselectCategory(key) {\n\t\tthis.setState({\n\t\t\tselectedCategory: key,\n\t\t});\n\t\tthis.props.onSelect(key);\n\t}\n\n\trenderCounter(key) {\n\t\tif (\n\t\t\tthis.props.categoryCounter &&\n\t\t\tthis.props.categoryCounter[key] &&\n\t\t\tthis.props.categoryCounter[key] === true &&\n\t\t\tthis.props.counterValues &&\n\t\t\tthis.props.counterValues[key] > 0\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<View style={styles.counter}>\n\t\t\t\t\t<Text style={styles.counterText}>\n\t\t\t\t\t\t{this.props.counterValues[key]}\n\t\t\t\t\t</Text>\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t}\n\n\trenderCategories(noScrollStyle) {\n\t\tconst getTextColour = (key) => {\n\t\t\tif (this.state.selectedCategory === key) {\n\t\t\t\treturn this.props.headerType !== \"white\"\n\t\t\t\t\t? \"#fff\"\n\t\t\t\t\t: this.props.colourBrandingMain;\n\t\t\t}\n\t\t\treturn this.props.headerType !== \"white\" ? \"#fff\" : TEXT_LIGHT;\n\t\t};\n\t\tconst getBottomBorderColour = (key) => {\n\t\t\tif (this.state.selectedCategory === key) {\n\t\t\t\treturn this.props.headerType !== \"white\"\n\t\t\t\t\t? \"#fff\"\n\t\t\t\t\t: this.props.colourBrandingMain;\n\t\t\t}\n\t\t\treturn this.props.headerType !== \"white\"\n\t\t\t\t? this.props.colourBrandingMain\n\t\t\t\t: \"#fff\";\n\t\t};\n\t\treturn this.state.categoryKeys.map((key, index) => {\n\t\t\treturn (\n\t\t\t\t<TouchableOpacity\n\t\t\t\t\tkey={index}\n\t\t\t\t\t// style={[{ minHeight: this.props.height || 30, justifyContent: 'center' }, noScrollStyle && { flex: 1 }]}\n\t\t\t\t\tstyle={[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\t\tminHeight: this.props.height || 30,\n\t\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.props.catWrapperStyle,\n\t\t\t\t\t]}\n\t\t\t\t\tonPress={this.selectCategory.bind(this, key)}\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tborderBottomColor: getBottomBorderColour(key),\n\t\t\t\t\t\t\t\tborderBottomWidth: noScrollStyle ? 0 : 2,\n\t\t\t\t\t\t\t\tmarginRight: noScrollStyle ? 0 : 16,\n\t\t\t\t\t\t\t\tmarginLeft: index === 0 && !noScrollStyle ? 16 : 0,\n\t\t\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\t\t\talignContent: \"center\",\n\t\t\t\t\t\t\t\tminHeight: 30,\n\t\t\t\t\t\t\t\tflexDirection: \"row\",\n\t\t\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\t\t\tthis.props.headerType !== \"white\"\n\t\t\t\t\t\t\t\t\t\t? this.props.colourBrandingMain\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tthis.props.style,\n\t\t\t\t\t\t]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={[\n\t\t\t\t\t\t\t\tnoScrollStyle && styles.innerContainer,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\t\t\t\tborderColor: getBottomBorderColour(key),\n\t\t\t\t\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tthis.props.catStyle,\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tstyle={[\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tfontFamily: \"sf-semibold\",\n\t\t\t\t\t\t\t\t\t\tfontSize: 15,\n\t\t\t\t\t\t\t\t\t\tcolor: getTextColour(key),\n\t\t\t\t\t\t\t\t\t\ttextAlign: \"center\",\n\t\t\t\t\t\t\t\t\t\tpaddingVertical: 8,\n\t\t\t\t\t\t\t\t\t\twidth: \"auto\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tthis.props.textStyle,\n\t\t\t\t\t\t\t\t\tthis.props.colourBrandingHeader &&\n\t\t\t\t\t\t\t\t\t\tthis.state.selectedCategory !== key && {\n\t\t\t\t\t\t\t\t\t\t\tcolor: this.props.colourBrandingMain,\n\t\t\t\t\t\t\t\t\t\t\topacity: 0.5,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{key}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t{this.renderCounter(key)}\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableOpacity>\n\t\t\t);\n\t\t});\n\t}\n\n\trender() {\n\t\tif (this.props.noScroll) {\n\t\t\t// return (<View style={{ flexDirection: 'row', paddingLeft: 16, paddingRight: 16 }}>\n\t\t\treturn (\n\t\t\t\t<View style={{ flexDirection: \"row\", justifyContent: \"space-evenly\" }}>\n\t\t\t\t\t{this.renderCategories(true)}\n\t\t\t\t</View>\n\t\t\t);\n\t\t}\n\t\treturn <ScrollView horizontal>{this.renderCategories(false)}</ScrollView>;\n\t}\n}\n\nconst styles = {\n\tcounter: {\n\t\tbackgroundColor: COLOUR_GREEN,\n\t\theight: 16,\n\t\tminWidth: 16,\n\t\tborderRadius: 8,\n\t\tmarginLeft: 4,\n\t\tmarginTop: 4,\n\t\tjustifyContent: \"center\",\n\t\talignContent: \"center\",\n\t},\n\tcounterText: {\n\t\tcolor: \"#fff\",\n\t\ttextAlign: \"center\",\n\t\tfontSize: 12,\n\t\tfontFamily: \"sf-semibold\",\n\t},\n\tinnerContainer: {\n\t\tborderBottomWidth: 2,\n\t\tflexDirection: \"row\",\n\t\tpaddingHorizontal: 8,\n\t},\n};\n\nconst mapStateToProps = (state) => {\n\treturn {\n\t\tcolourBrandingMain: getMainBrandingColourFromState(state),\n\t\theaderType: getSiteSettingFromState(\n\t\t\tstate,\n\t\t\t\"HeaderType\",\n\t\t\tgetSiteSettingFromState(\n\t\t\t\tstate,\n\t\t\t\t\"UseGradientHeader\",\n\t\t\t\tConfig.env.hasGradientHeader,\n\t\t\t)\n\t\t\t\t? \"gradient\"\n\t\t\t\t: \"white\",\n\t\t),\n\t};\n};\n\nconst categoryTabs = connect(mapStateToProps, {})(CategoryTabs);\nexport { categoryTabs as CategoryTabs };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,OAAOC,CAAC,MAAM,QAAQ;AACtB,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACjE,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,OAAO,QAAQ,a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AkC,aAAA,CAAC7B,UAAU;MAACuE,UAAU;IAAA,GAAE,IAAI,CAACrC,gBAAgB,CAAC,KAAK,CAAc,CAAC;EAC1E;AACD;AAEA,MAAMH,MAAM,GAAG;EACdC,OAAO,EAAE;IACRuB,eAAe,EAAEnD,YAAY;IAC7BwC,MAAM,EAAE,EAAE;IACV4B,QAAQ,EAAE,EAAE;IACZC,YAAY,EAAE,CAAC;IACfrB,UAAU,EAAE,CAAC;IACbsB,SAAS,EAAE,CAAC;IACZ7B,cAAc,EAAE,QAAQ;IACxBQ,YAAY,EAAE;EACf,CAAC;EACDpB,WAAW,EAAE;IACZ6B,KAAK,EAAE,MAAM;IACbC,SAAS,EAAE,QAAQ;IACnBF,QAAQ,EAAE,EAAE;IACZD,UAAU,EAAE;EACb,CAAC;EACDH,cAAc,EAAE;IACfP,iBAAiB,EAAE,CAAC;IACpBI,aAAa,EAAE,KAAK;IACpBqB,iBAAiB,EAAE;EACpB;AACD,CAAC;AAED,MAAMC,eAAe,GAAIjE,KAAK,IAAK;EAClC,OAAO;IACN2B,kBAAkB,EAAEjC,8BAA8B,CAACM,KAAK,CAAC;IACzD0B,UAAU,EAAE/B,uBAAuB,CAClCK,KAAK,EACL,YAAY,EACZL,uBAAuB,CACtBK,KAAK,EACL,mBAAmB,EACnBJ,MAAM,CAACsE,GAAG,CAACC,iBACZ,CAAC,GACE,UAAU,GACV,OACJ;EACD,CAAC;AACF,CAAC;AAED,MAAMC,YAAY,GAAG7E,OAAO,CAAC0E,eAAe,EAAE,CAAC,CAAC,CAAC,CAACpE,YAAY,CAAC;AAC/D,SAASuE,YAAY,IAAIvE,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
|
+
import React, { Component } from "react";
|
|
5
|
+
import { connect } from "react-redux";
|
|
6
|
+
import { Keyboard, TextInput, View, ImageBackground, TouchableOpacity, Dimensions } from "react-native";
|
|
7
|
+
import { Icon } from "@rneui/themed";
|
|
8
|
+
import { withSafeAreaInsets } from "react-native-safe-area-context";
|
|
9
|
+
import _ from "lodash";
|
|
10
|
+
import { getApiError } from "../session";
|
|
11
|
+
import { getShadowStyle } from "../helper";
|
|
12
|
+
import { TEXT_BLUEGREY, TEXT_DARKEST, BG_GREY } from "../colours";
|
|
13
|
+
import { Spinner } from "./Spinner";
|
|
14
|
+
import ImageUploader from "./ImageUploader";
|
|
15
|
+
import { reactionActions } from "../apis";
|
|
16
|
+
const SCREEN_HEIGHT = Dimensions.get("window").height;
|
|
17
|
+
class CommentReply extends Component {
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
_defineProperty(this, "onUploadStarted", () => {
|
|
21
|
+
this.setState({
|
|
22
|
+
uploadingCommentImage: true
|
|
23
|
+
});
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
if (!this.props.noScroll) {
|
|
26
|
+
var _this$props$scrollVie;
|
|
27
|
+
(_this$props$scrollVie = this.props.scrollView) === null || _this$props$scrollVie === void 0 || (_this$props$scrollVie = _this$props$scrollVie.current) === null || _this$props$scrollVie === void 0 || _this$props$scrollVie.scrollToEnd({
|
|
28
|
+
animated: true
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, 500);
|
|
32
|
+
});
|
|
33
|
+
_defineProperty(this, "onUploadSuccess", uri => {
|
|
34
|
+
this.setState({
|
|
35
|
+
uploadingCommentImage: false,
|
|
36
|
+
commentImageInput: uri.replace("/general/", "/general1400/")
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
_defineProperty(this, "onUploadFailed", () => {
|
|
40
|
+
this.setState({
|
|
41
|
+
uploadingCommentImage: false,
|
|
42
|
+
commentImageInput: null
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
this.state = {
|
|
46
|
+
commentImageInput: "",
|
|
47
|
+
commentInput: "",
|
|
48
|
+
uploadingCommentImage: false,
|
|
49
|
+
commentsLoading: true,
|
|
50
|
+
addingComment: false
|
|
51
|
+
};
|
|
52
|
+
this.replyInputRef = /*#__PURE__*/React.createRef();
|
|
53
|
+
}
|
|
54
|
+
componentDidMount() {
|
|
55
|
+
if (this.props.commentSection && this.props.commentSection.current) {
|
|
56
|
+
this.setState({
|
|
57
|
+
commentsLoading: this.props.commentSection.current.isLoading()
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
focusInput() {
|
|
62
|
+
this.replyInputRef.current.focus();
|
|
63
|
+
}
|
|
64
|
+
loadingStarted() {
|
|
65
|
+
this.setState({
|
|
66
|
+
commentsLoading: true
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
loadingCompleted() {
|
|
70
|
+
this.setState({
|
|
71
|
+
commentsLoading: false
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
shouldShowImageInput() {
|
|
75
|
+
return this.state.uploadingCommentImage || !_.isEmpty(this.state.commentImageInput);
|
|
76
|
+
}
|
|
77
|
+
addComment() {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
if (!this.props.noScroll) {
|
|
80
|
+
var _this$props$scrollVie2;
|
|
81
|
+
(_this$props$scrollVie2 = this.props.scrollView) === null || _this$props$scrollVie2 === void 0 || (_this$props$scrollVie2 = _this$props$scrollVie2.current) === null || _this$props$scrollVie2 === void 0 || _this$props$scrollVie2.scrollToEnd({
|
|
82
|
+
animated: true
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}, 500);
|
|
86
|
+
const text = this.state.commentInput;
|
|
87
|
+
const image = this.state.commentImageInput;
|
|
88
|
+
this.setState({
|
|
89
|
+
addingComment: true,
|
|
90
|
+
commentInput: "",
|
|
91
|
+
commentImageInput: ""
|
|
92
|
+
});
|
|
93
|
+
Keyboard.dismiss();
|
|
94
|
+
if (this.props.commentSection) {
|
|
95
|
+
var _this$props$commentSe;
|
|
96
|
+
(_this$props$commentSe = this.props.commentSection) === null || _this$props$commentSe === void 0 || (_this$props$commentSe = _this$props$commentSe.current) === null || _this$props$commentSe === void 0 || _this$props$commentSe.startedAddingComment();
|
|
97
|
+
}
|
|
98
|
+
reactionActions.addComment(this.props.entityId, this.props.entityType, this.props.entityName, this.props.site, text, image, this.props.threadId).then(res => {
|
|
99
|
+
if (this.props.commentSection) {
|
|
100
|
+
var _this$props$commentSe2;
|
|
101
|
+
(_this$props$commentSe2 = this.props.commentSection) === null || _this$props$commentSe2 === void 0 || (_this$props$commentSe2 = _this$props$commentSe2.current) === null || _this$props$commentSe2 === void 0 || _this$props$commentSe2.commentAdded(res.data);
|
|
102
|
+
}
|
|
103
|
+
this.setState({
|
|
104
|
+
addingComment: false
|
|
105
|
+
});
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
if (!this.props.noScroll) {
|
|
108
|
+
var _this$props$scrollVie3;
|
|
109
|
+
(_this$props$scrollVie3 = this.props.scrollView) === null || _this$props$scrollVie3 === void 0 || (_this$props$scrollVie3 = _this$props$scrollVie3.current) === null || _this$props$scrollVie3 === void 0 || _this$props$scrollVie3.scrollToEnd({
|
|
110
|
+
animated: true
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, 500);
|
|
114
|
+
}).catch(err => {
|
|
115
|
+
console.log(getApiError(err));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
removeImage() {
|
|
119
|
+
this.setState({
|
|
120
|
+
commentImageInput: null
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
showUploadMenu() {
|
|
124
|
+
if (this.state.uploadingCommentImage || !_.isEmpty(this.state.commentImageInput)) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
this.commentImageUploader.showUploadMenu();
|
|
128
|
+
}
|
|
129
|
+
renderImageAttachment() {
|
|
130
|
+
if (_.isEmpty(this.state.commentImageInput) && !this.state.uploadingCommentImage) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
if (this.state.uploadingCommentImage) {
|
|
134
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
135
|
+
style: [styles.accessoryImage, styles.accessoryImageBorder, {
|
|
136
|
+
borderWidth: 1,
|
|
137
|
+
borderColor: BG_GREY
|
|
138
|
+
}]
|
|
139
|
+
}, /*#__PURE__*/React.createElement(Spinner, null));
|
|
140
|
+
}
|
|
141
|
+
return /*#__PURE__*/React.createElement(ImageBackground, {
|
|
142
|
+
style: styles.accessoryImage,
|
|
143
|
+
imageStyle: styles.accessoryImageBorder,
|
|
144
|
+
source: {
|
|
145
|
+
uri: this.state.commentImageInput
|
|
146
|
+
}
|
|
147
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
148
|
+
style: styles.accessoryImageClose,
|
|
149
|
+
onPress: this.removeImage.bind(this),
|
|
150
|
+
hitSlop: {
|
|
151
|
+
top: 8,
|
|
152
|
+
right: 8,
|
|
153
|
+
bottom: 8,
|
|
154
|
+
left: 8
|
|
155
|
+
}
|
|
156
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
157
|
+
name: "remove",
|
|
158
|
+
type: "font-awesome",
|
|
159
|
+
iconStyle: styles.accessoryImageCloseIcon,
|
|
160
|
+
style: styles.accessoryImageCloseIconContainer
|
|
161
|
+
})));
|
|
162
|
+
}
|
|
163
|
+
renderImageUploader() {
|
|
164
|
+
return /*#__PURE__*/React.createElement(ImageUploader, {
|
|
165
|
+
ref: ref => this.commentImageUploader = ref,
|
|
166
|
+
onUploadStarted: this.onUploadStarted,
|
|
167
|
+
onUploadSuccess: this.onUploadSuccess,
|
|
168
|
+
onUploadFailed: this.onUploadFailed,
|
|
169
|
+
onLibrarySelected: this.onUploadSuccess,
|
|
170
|
+
quality: 0.8,
|
|
171
|
+
allowsEditing: false,
|
|
172
|
+
fileName: "commentImage",
|
|
173
|
+
popupTitle: "Add Image",
|
|
174
|
+
userId: this.props.user.uid,
|
|
175
|
+
hideLibrary: true
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
render() {
|
|
179
|
+
var _this$props$insets;
|
|
180
|
+
if (_.includes(this.props.user.hidden, "addComment")) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
if (this.state.commentsLoading) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
187
|
+
style: [styles.inputContainer, getShadowStyle(), {
|
|
188
|
+
paddingBottom: 8 + (((_this$props$insets = this.props.insets) === null || _this$props$insets === void 0 ? void 0 : _this$props$insets.bottom) ?? 0)
|
|
189
|
+
}, this.props.style]
|
|
190
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
191
|
+
style: [styles.input, {
|
|
192
|
+
marginRight: _.isEmpty(this.state.commentInput) && _.isEmpty(this.state.commentImageInput) ? 40 : 80
|
|
193
|
+
}]
|
|
194
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
195
|
+
maxFontSizeMultiplier: 1.2,
|
|
196
|
+
ref: this.replyInputRef,
|
|
197
|
+
placeholder: "Enter your comment here",
|
|
198
|
+
value: this.state.commentInput,
|
|
199
|
+
onFocus: () => {
|
|
200
|
+
if (!this.props.noScroll) {
|
|
201
|
+
var _this$props$scrollVie4;
|
|
202
|
+
(_this$props$scrollVie4 = this.props.scrollView) === null || _this$props$scrollVie4 === void 0 || (_this$props$scrollVie4 = _this$props$scrollVie4.current) === null || _this$props$scrollVie4 === void 0 || _this$props$scrollVie4.scrollToEnd({
|
|
203
|
+
animated: true
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
onChangeText: value => {
|
|
208
|
+
if (!this.props.noScroll) {
|
|
209
|
+
var _this$props$scrollVie5;
|
|
210
|
+
(_this$props$scrollVie5 = this.props.scrollView) === null || _this$props$scrollVie5 === void 0 || (_this$props$scrollVie5 = _this$props$scrollVie5.current) === null || _this$props$scrollVie5 === void 0 || _this$props$scrollVie5.scrollToEnd({
|
|
211
|
+
animated: false
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
this.setState({
|
|
215
|
+
commentInput: value
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
style: styles.inputText,
|
|
219
|
+
autoCapitalize: "sentences",
|
|
220
|
+
multiline: true,
|
|
221
|
+
autoCorrect: true,
|
|
222
|
+
autoGrow: true
|
|
223
|
+
})), (!_.isEmpty(this.state.commentInput) || !_.isEmpty(this.state.commentImageInput)) && !this.state.addingComment && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
224
|
+
onPress: this.addComment.bind(this),
|
|
225
|
+
style: [styles.sendContainer, {
|
|
226
|
+
right: 4,
|
|
227
|
+
padding: 4,
|
|
228
|
+
width: 40,
|
|
229
|
+
height: 40
|
|
230
|
+
}]
|
|
231
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
232
|
+
name: "paper-plane",
|
|
233
|
+
type: "font-awesome",
|
|
234
|
+
iconStyle: [styles.send, {
|
|
235
|
+
width: 40
|
|
236
|
+
}]
|
|
237
|
+
})), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
238
|
+
onPress: this.showUploadMenu.bind(this),
|
|
239
|
+
style: [styles.sendContainer, {
|
|
240
|
+
right: _.isEmpty(this.state.commentInput) && _.isEmpty(this.state.commentImageInput) ? 4 : 44,
|
|
241
|
+
padding: 4,
|
|
242
|
+
width: 40,
|
|
243
|
+
height: 40
|
|
244
|
+
}]
|
|
245
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
246
|
+
name: "picture-o",
|
|
247
|
+
type: "font-awesome",
|
|
248
|
+
iconStyle: [styles.send, {
|
|
249
|
+
width: 40
|
|
250
|
+
}]
|
|
251
|
+
})), this.renderImageAttachment(), this.renderImageUploader());
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const styles = {
|
|
255
|
+
accessoryImage: {
|
|
256
|
+
marginTop: 8,
|
|
257
|
+
width: 60,
|
|
258
|
+
height: 60
|
|
259
|
+
},
|
|
260
|
+
accessoryImageBorder: {
|
|
261
|
+
borderRadius: 2
|
|
262
|
+
},
|
|
263
|
+
accessoryImageClose: {
|
|
264
|
+
width: 14,
|
|
265
|
+
height: 14,
|
|
266
|
+
borderRadius: 7,
|
|
267
|
+
position: "absolute",
|
|
268
|
+
top: -7,
|
|
269
|
+
right: -7,
|
|
270
|
+
backgroundColor: TEXT_BLUEGREY
|
|
271
|
+
},
|
|
272
|
+
accessoryImageCloseIconContainer: {
|
|
273
|
+
width: 14,
|
|
274
|
+
height: 14,
|
|
275
|
+
alignItems: "center",
|
|
276
|
+
justifyContent: "center"
|
|
277
|
+
},
|
|
278
|
+
accessoryImageCloseIcon: {
|
|
279
|
+
fontSize: 10,
|
|
280
|
+
color: "#fff",
|
|
281
|
+
textAlign: "center"
|
|
282
|
+
},
|
|
283
|
+
inputContainer: {
|
|
284
|
+
backgroundColor: "#fff",
|
|
285
|
+
paddingVertical: 8,
|
|
286
|
+
paddingHorizontal: 8,
|
|
287
|
+
paddingBottom: 8,
|
|
288
|
+
// bottom inset added dynamically via props
|
|
289
|
+
flexGrow: 1
|
|
290
|
+
},
|
|
291
|
+
inputText: {
|
|
292
|
+
color: TEXT_DARKEST,
|
|
293
|
+
fontSize: 14,
|
|
294
|
+
fontFamily: "sf-medium"
|
|
295
|
+
},
|
|
296
|
+
input: {
|
|
297
|
+
fontSize: 14,
|
|
298
|
+
color: TEXT_DARKEST,
|
|
299
|
+
fontFamily: "sf-medium",
|
|
300
|
+
margin: 0,
|
|
301
|
+
backgroundColor: BG_GREY,
|
|
302
|
+
borderRadius: 5,
|
|
303
|
+
padding: 8,
|
|
304
|
+
maxHeight: SCREEN_HEIGHT / 3
|
|
305
|
+
},
|
|
306
|
+
sendContainer: {
|
|
307
|
+
position: "absolute",
|
|
308
|
+
top: 8,
|
|
309
|
+
right: 8,
|
|
310
|
+
height: 30,
|
|
311
|
+
width: 30,
|
|
312
|
+
alignItems: "center",
|
|
313
|
+
justifyContent: "center",
|
|
314
|
+
backgroundColor: "#fff"
|
|
315
|
+
},
|
|
316
|
+
send: {
|
|
317
|
+
color: TEXT_BLUEGREY,
|
|
318
|
+
fontSize: 24,
|
|
319
|
+
textAlign: "center"
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const mapStateToProps = state => {
|
|
323
|
+
const {
|
|
324
|
+
user
|
|
325
|
+
} = state;
|
|
326
|
+
return {
|
|
327
|
+
user
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
const commentReply = connect(mapStateToProps, {}, null, {
|
|
331
|
+
forwardRef: true
|
|
332
|
+
})(withSafeAreaInsets(CommentReply));
|
|
333
|
+
export { commentReply as CommentReply };
|
|
334
|
+
//# sourceMappingURL=CommentReply.js.map
|