@plusscommunities/pluss-core-app 1.4.9 → 1.5.0

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.
Files changed (183) hide show
  1. package/dist/module/actions/FollowerActions.js +34 -0
  2. package/dist/module/actions/FollowerActions.js.map +1 -0
  3. package/dist/module/actions/MediaActions.js +20 -0
  4. package/dist/module/actions/MediaActions.js.map +1 -0
  5. package/dist/module/actions/ResidentActions.js +26 -0
  6. package/dist/module/actions/ResidentActions.js.map +1 -0
  7. package/dist/module/actions/UserActions.js +214 -0
  8. package/dist/module/actions/UserActions.js.map +1 -0
  9. package/dist/module/actions/index.js +5 -0
  10. package/dist/module/actions/index.js.map +1 -0
  11. package/dist/module/actions/types.js +14 -0
  12. package/dist/module/actions/types.js.map +1 -0
  13. package/dist/module/apis/analyticsActions.js +20 -0
  14. package/dist/module/apis/analyticsActions.js.map +1 -0
  15. package/dist/module/apis/contactActions.js +27 -0
  16. package/dist/module/apis/contactActions.js.map +1 -0
  17. package/dist/module/apis/eventActions.js +163 -0
  18. package/dist/module/apis/eventActions.js.map +1 -0
  19. package/dist/module/apis/fileActions.js +96 -0
  20. package/dist/module/apis/fileActions.js.map +1 -0
  21. package/dist/module/apis/followerActions.js +38 -0
  22. package/dist/module/apis/followerActions.js.map +1 -0
  23. package/dist/module/apis/index.js +11 -0
  24. package/dist/module/apis/index.js.map +1 -0
  25. package/dist/module/apis/notificationActions.js +60 -0
  26. package/dist/module/apis/notificationActions.js.map +1 -0
  27. package/dist/module/apis/profileActions.js +14 -0
  28. package/dist/module/apis/profileActions.js.map +1 -0
  29. package/dist/module/apis/reactionActions.js +78 -0
  30. package/dist/module/apis/reactionActions.js.map +1 -0
  31. package/dist/module/apis/typeActions.js +15 -0
  32. package/dist/module/apis/typeActions.js.map +1 -0
  33. package/dist/module/apis/userActions.js +104 -0
  34. package/dist/module/apis/userActions.js.map +1 -0
  35. package/{assets → dist/module/assets}/icons/reactions/heart.png +0 -0
  36. package/{assets → dist/module/assets}/icons/reactions/party.png +0 -0
  37. package/{assets → dist/module/assets}/icons/reactions/sad.png +0 -0
  38. package/{assets → dist/module/assets}/icons/reactions/smile.png +0 -0
  39. package/dist/module/colours.js +149 -0
  40. package/dist/module/colours.js.map +1 -0
  41. package/dist/module/components/AddButton.js +45 -0
  42. package/dist/module/components/AddButton.js.map +1 -0
  43. package/dist/module/components/Attachment.js +59 -0
  44. package/dist/module/components/Attachment.js.map +1 -0
  45. package/dist/module/components/AudienceSelectorLauncher.js +70 -0
  46. package/dist/module/components/AudienceSelectorLauncher.js.map +1 -0
  47. package/dist/module/components/AudienceSelectorPage.js +376 -0
  48. package/dist/module/components/AudienceSelectorPage.js.map +1 -0
  49. package/dist/module/components/BackButton.js +62 -0
  50. package/dist/module/components/BackButton.js.map +1 -0
  51. package/dist/module/components/CategoryTabs.js +171 -0
  52. package/dist/module/components/CategoryTabs.js.map +1 -0
  53. package/dist/module/components/CommentReply.js +363 -0
  54. package/dist/module/components/CommentReply.js.map +1 -0
  55. package/dist/module/components/CommentSection.js +785 -0
  56. package/dist/module/components/CommentSection.js.map +1 -0
  57. package/dist/module/components/ConfirmPopup.js +85 -0
  58. package/dist/module/components/ConfirmPopup.js.map +1 -0
  59. package/dist/module/components/ConfirmationPopup.js +77 -0
  60. package/dist/module/components/ConfirmationPopup.js.map +1 -0
  61. package/dist/module/components/DropDownItem.js +82 -0
  62. package/dist/module/components/DropDownItem.js.map +1 -0
  63. package/dist/module/components/DropDownMenu.js +46 -0
  64. package/dist/module/components/DropDownMenu.js.map +1 -0
  65. package/dist/module/components/EmptyStateMain.js +50 -0
  66. package/dist/module/components/EmptyStateMain.js.map +1 -0
  67. package/dist/module/components/EmptyStateWidget.js +52 -0
  68. package/dist/module/components/EmptyStateWidget.js.map +1 -0
  69. package/dist/module/components/FontScaleButton.js +37 -0
  70. package/dist/module/components/FontScaleButton.js.map +1 -0
  71. package/dist/module/components/FontScalePopup.js +77 -0
  72. package/dist/module/components/FontScalePopup.js.map +1 -0
  73. package/dist/module/components/FormCard.js +28 -0
  74. package/dist/module/components/FormCard.js.map +1 -0
  75. package/dist/module/components/FormCardSection.js +240 -0
  76. package/dist/module/components/FormCardSection.js.map +1 -0
  77. package/dist/module/components/FormCardSectionOptionLauncher.js +77 -0
  78. package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -0
  79. package/dist/module/components/FormattedText.js +145 -0
  80. package/dist/module/components/FormattedText.js.map +1 -0
  81. package/dist/module/components/GenericInput.js +161 -0
  82. package/dist/module/components/GenericInput.js.map +1 -0
  83. package/dist/module/components/GenericInputSection.js +174 -0
  84. package/dist/module/components/GenericInputSection.js.map +1 -0
  85. package/dist/module/components/Header.js +491 -0
  86. package/dist/module/components/Header.js.map +1 -0
  87. package/dist/module/components/ImagePopup.js +257 -0
  88. package/dist/module/components/ImagePopup.js.map +1 -0
  89. package/dist/module/components/ImageUploadProgress.js +72 -0
  90. package/dist/module/components/ImageUploadProgress.js.map +1 -0
  91. package/dist/module/components/ImageUploader.js +850 -0
  92. package/dist/module/components/ImageUploader.js.map +1 -0
  93. package/dist/module/components/InlineButton.js +72 -0
  94. package/dist/module/components/InlineButton.js.map +1 -0
  95. package/dist/module/components/Input.js +164 -0
  96. package/dist/module/components/Input.js.map +1 -0
  97. package/dist/module/components/LoadingCircles.js +224 -0
  98. package/dist/module/components/LoadingCircles.js.map +1 -0
  99. package/dist/module/components/LoadingIndicator.js +95 -0
  100. package/dist/module/components/LoadingIndicator.js.map +1 -0
  101. package/dist/module/components/LoadingStateWidget.js +51 -0
  102. package/dist/module/components/LoadingStateWidget.js.map +1 -0
  103. package/dist/module/components/MediaPlayer.js +440 -0
  104. package/dist/module/components/MediaPlayer.js.map +1 -0
  105. package/dist/module/components/MiddlePopup.js +46 -0
  106. package/dist/module/components/MiddlePopup.js.map +1 -0
  107. package/dist/module/components/PDFPopup.js +188 -0
  108. package/dist/module/components/PDFPopup.js.map +1 -0
  109. package/dist/module/components/PlussChat.js +997 -0
  110. package/dist/module/components/PlussChat.js.map +1 -0
  111. package/dist/module/components/PlussChatMessage.js +204 -0
  112. package/dist/module/components/PlussChatMessage.js.map +1 -0
  113. package/dist/module/components/PlussChatTime.js +66 -0
  114. package/dist/module/components/PlussChatTime.js.map +1 -0
  115. package/dist/module/components/Popup.js +138 -0
  116. package/dist/module/components/Popup.js.map +1 -0
  117. package/dist/module/components/PopupMenu.js +128 -0
  118. package/dist/module/components/PopupMenu.js.map +1 -0
  119. package/dist/module/components/PositionedImage.js +333 -0
  120. package/dist/module/components/PositionedImage.js.map +1 -0
  121. package/dist/module/components/ProfilePic.js +119 -0
  122. package/dist/module/components/ProfilePic.js.map +1 -0
  123. package/dist/module/components/RadioButton.js +84 -0
  124. package/dist/module/components/RadioButton.js.map +1 -0
  125. package/dist/module/components/Reaction.js +129 -0
  126. package/dist/module/components/Reaction.js.map +1 -0
  127. package/dist/module/components/Reactions.js +84 -0
  128. package/dist/module/components/Reactions.js.map +1 -0
  129. package/dist/module/components/SharingTools.js +162 -0
  130. package/dist/module/components/SharingTools.js.map +1 -0
  131. package/dist/module/components/Spinner.js +25 -0
  132. package/dist/module/components/Spinner.js.map +1 -0
  133. package/dist/module/components/StickyFooter.js +37 -0
  134. package/dist/module/components/StickyFooter.js.map +1 -0
  135. package/dist/module/components/TextStyle.js +34 -0
  136. package/dist/module/components/TextStyle.js.map +1 -0
  137. package/dist/module/components/Toggle.js +70 -0
  138. package/dist/module/components/Toggle.js.map +1 -0
  139. package/dist/module/components/TouchableSearchBar.js +73 -0
  140. package/dist/module/components/TouchableSearchBar.js.map +1 -0
  141. package/dist/module/components/UserListPopup.js +146 -0
  142. package/dist/module/components/UserListPopup.js.map +1 -0
  143. package/dist/module/components/UserListing.js +291 -0
  144. package/dist/module/components/UserListing.js.map +1 -0
  145. package/dist/module/components/VideoPopup.js +123 -0
  146. package/dist/module/components/VideoPopup.js.map +1 -0
  147. package/dist/module/components/WarningPopup.js +87 -0
  148. package/dist/module/components/WarningPopup.js.map +1 -0
  149. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +325 -0
  150. package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -0
  151. package/dist/module/components/expo-image-picker-multiple/ImageTile.js +123 -0
  152. package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -0
  153. package/dist/module/components/index.js +53 -0
  154. package/dist/module/components/index.js.map +1 -0
  155. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +416 -0
  156. package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -0
  157. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +405 -0
  158. package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -0
  159. package/dist/module/config.js +27 -0
  160. package/dist/module/config.js.map +1 -0
  161. package/dist/module/constants.js +16 -0
  162. package/dist/module/constants.js.map +1 -0
  163. package/dist/module/fonts/index.js +2 -0
  164. package/dist/module/fonts/index.js.map +1 -0
  165. package/dist/module/fonts/pluss60-icons.js +5 -0
  166. package/dist/module/fonts/pluss60-icons.js.map +1 -0
  167. package/dist/module/fonts/pluss60-icons.json +1097 -0
  168. package/dist/module/helper.js +436 -0
  169. package/dist/module/helper.js.map +1 -0
  170. package/dist/module/index.js +13 -0
  171. package/dist/module/index.js.map +1 -0
  172. package/dist/module/session.js +54 -0
  173. package/dist/module/session.js.map +1 -0
  174. package/dist/module/styles.js +67 -0
  175. package/dist/module/styles.js.map +1 -0
  176. package/package.json +22 -5
  177. package/src/assets/icons/reactions/heart.png +0 -0
  178. package/src/assets/icons/reactions/party.png +0 -0
  179. package/src/assets/icons/reactions/sad.png +0 -0
  180. package/src/assets/icons/reactions/smile.png +0 -0
  181. package/src/components/CommentReply.js +0 -2
  182. package/src/constants.js +4 -4
  183. package/src/helper.js +4 -4
@@ -0,0 +1,62 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { View, TouchableOpacity } from 'react-native';
3
+ import { connect } from 'react-redux';
4
+ import stylez from '../styles';
5
+ import { Pl60Icon } from '../fonts';
6
+ import { getMainBrandingColourFromState } from '../colours';
7
+ /*
8
+ Props-
9
+ onPress - onPress action
10
+ diameter - size of button
11
+ color - default will be aveoMain
12
+ style - custom style for container
13
+ */
14
+
15
+ class BackButton extends PureComponent {
16
+ render() {
17
+ const size = this.props.diameter || 32;
18
+ const radius = size / 2;
19
+
20
+ if (this.props.noClick) {
21
+ return /*#__PURE__*/React.createElement(View, {
22
+ style: [stylez.backButton, {
23
+ backgroundColor: this.props.colourBrandingMain,
24
+ height: size,
25
+ width: size,
26
+ borderRadius: radius
27
+ }, this.props.color && {
28
+ backgroundColor: this.props.color
29
+ }, this.props.style]
30
+ }, /*#__PURE__*/React.createElement(Pl60Icon, {
31
+ name: this.props.flipped ? 'chevron_right' : 'chevron_left',
32
+ style: [stylez.backButtonIcon, this.props.iconStyle]
33
+ }));
34
+ }
35
+
36
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
37
+ style: [stylez.backButton, {
38
+ backgroundColor: this.props.colourBrandingMain,
39
+ height: size,
40
+ width: size,
41
+ borderRadius: radius
42
+ }, this.props.color && {
43
+ backgroundColor: this.props.color
44
+ }, this.props.style],
45
+ onPress: this.props.onPress
46
+ }, /*#__PURE__*/React.createElement(Pl60Icon, {
47
+ name: this.props.flipped ? 'chevron_right' : 'chevron_left',
48
+ style: [stylez.backButtonIcon, this.props.iconStyle]
49
+ }));
50
+ }
51
+
52
+ }
53
+
54
+ const mapStateToProps = state => {
55
+ return {
56
+ colourBrandingMain: getMainBrandingColourFromState(state)
57
+ };
58
+ };
59
+
60
+ const backButton = connect(mapStateToProps, {})(BackButton);
61
+ export { backButton as BackButton };
62
+ //# sourceMappingURL=BackButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["BackButton.js"],"names":["React","PureComponent","View","TouchableOpacity","connect","stylez","Pl60Icon","getMainBrandingColourFromState","BackButton","render","size","props","diameter","radius","noClick","backButton","backgroundColor","colourBrandingMain","height","width","borderRadius","color","style","flipped","backButtonIcon","iconStyle","onPress","mapStateToProps","state"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,IAAT,EAAeC,gBAAf,QAAuC,cAAvC;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,SAASC,QAAT,QAAyB,UAAzB;AACA,SAASC,8BAAT,QAA+C,YAA/C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,UAAN,SAAyBP,aAAzB,CAAuC;AACrCQ,EAAAA,MAAM,GAAG;AACP,UAAMC,IAAI,GAAG,KAAKC,KAAL,CAAWC,QAAX,IAAuB,EAApC;AACA,UAAMC,MAAM,GAAGH,IAAI,GAAG,CAAtB;;AACA,QAAI,KAAKC,KAAL,CAAWG,OAAf,EAAwB;AACtB,0BACE,oBAAC,IAAD;AACE,QAAA,KAAK,EAAE,CACLT,MAAM,CAACU,UADF,EAEL;AAAEC,UAAAA,eAAe,EAAE,KAAKL,KAAL,CAAWM,kBAA9B;AAAkDC,UAAAA,MAAM,EAAER,IAA1D;AAAgES,UAAAA,KAAK,EAAET,IAAvE;AAA6EU,UAAAA,YAAY,EAAEP;AAA3F,SAFK,EAGL,KAAKF,KAAL,CAAWU,KAAX,IAAoB;AAAEL,UAAAA,eAAe,EAAE,KAAKL,KAAL,CAAWU;AAA9B,SAHf,EAIL,KAAKV,KAAL,CAAWW,KAJN;AADT,sBAQE,oBAAC,QAAD;AAAU,QAAA,IAAI,EAAE,KAAKX,KAAL,CAAWY,OAAX,GAAqB,eAArB,GAAuC,cAAvD;AAAuE,QAAA,KAAK,EAAE,CAAClB,MAAM,CAACmB,cAAR,EAAwB,KAAKb,KAAL,CAAWc,SAAnC;AAA9E,QARF,CADF;AAYD;;AACD,wBACE,oBAAC,gBAAD;AACE,MAAA,KAAK,EAAE,CACLpB,MAAM,CAACU,UADF,EAEL;AAAEC,QAAAA,eAAe,EAAE,KAAKL,KAAL,CAAWM,kBAA9B;AAAkDC,QAAAA,MAAM,EAAER,IAA1D;AAAgES,QAAAA,KAAK,EAAET,IAAvE;AAA6EU,QAAAA,YAAY,EAAEP;AAA3F,OAFK,EAGL,KAAKF,KAAL,CAAWU,KAAX,IAAoB;AAAEL,QAAAA,eAAe,EAAE,KAAKL,KAAL,CAAWU;AAA9B,OAHf,EAIL,KAAKV,KAAL,CAAWW,KAJN,CADT;AAOE,MAAA,OAAO,EAAE,KAAKX,KAAL,CAAWe;AAPtB,oBASE,oBAAC,QAAD;AAAU,MAAA,IAAI,EAAE,KAAKf,KAAL,CAAWY,OAAX,GAAqB,eAArB,GAAuC,cAAvD;AAAuE,MAAA,KAAK,EAAE,CAAClB,MAAM,CAACmB,cAAR,EAAwB,KAAKb,KAAL,CAAWc,SAAnC;AAA9E,MATF,CADF;AAaD;;AA/BoC;;AAkCvC,MAAME,eAAe,GAAGC,KAAK,IAAI;AAC/B,SAAO;AACLX,IAAAA,kBAAkB,EAAEV,8BAA8B,CAACqB,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMb,UAAU,GAAGX,OAAO,CAACuB,eAAD,EAAkB,EAAlB,CAAP,CAA6BnB,UAA7B,CAAnB;AACA,SAASO,UAAU,IAAIP,UAAvB","sourcesContent":["import React, { PureComponent } from 'react';\nimport { View, TouchableOpacity } from 'react-native';\nimport { connect } from 'react-redux';\nimport stylez from '../styles';\nimport { Pl60Icon } from '../fonts';\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 render() {\n const size = this.props.diameter || 32;\n const radius = size / 2;\n if (this.props.noClick) {\n return (\n <View\n style={[\n stylez.backButton,\n { backgroundColor: this.props.colourBrandingMain, height: size, width: size, borderRadius: radius },\n this.props.color && { backgroundColor: this.props.color },\n this.props.style,\n ]}\n >\n <Pl60Icon name={this.props.flipped ? 'chevron_right' : 'chevron_left'} style={[stylez.backButtonIcon, this.props.iconStyle]} />\n </View>\n );\n }\n return (\n <TouchableOpacity\n style={[\n stylez.backButton,\n { backgroundColor: this.props.colourBrandingMain, height: size, width: size, borderRadius: radius },\n this.props.color && { backgroundColor: this.props.color },\n this.props.style,\n ]}\n onPress={this.props.onPress}\n >\n <Pl60Icon name={this.props.flipped ? 'chevron_right' : 'chevron_left'} style={[stylez.backButtonIcon, this.props.iconStyle]} />\n </TouchableOpacity>\n );\n }\n}\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst backButton = connect(mapStateToProps, {})(BackButton);\nexport { backButton as BackButton };\n"]}
@@ -0,0 +1,171 @@
1
+ import React, { Component } from 'react';
2
+ import _ from 'lodash';
3
+ import { Text, TouchableOpacity, View, ScrollView } from 'react-native';
4
+ import { connect } from 'react-redux';
5
+ import { TEXT_LIGHT, COLOUR_GREEN, getMainBrandingColourFromState } from '../colours';
6
+ import { getSiteSettingFromState } from '../helper'; // import { HAS_GRADIENT_HEADER } from '../../config';
7
+
8
+ import Config from '../config';
9
+
10
+ class CategoryTabs extends Component {
11
+ constructor(props) {
12
+ super(props);
13
+ this.state = {
14
+ categoryKeys: [],
15
+ selectedCategory: this.props.initialCategory
16
+ };
17
+ }
18
+
19
+ UNSAFE_componentWillMount() {
20
+ this.setState({
21
+ selectedCategory: !_.isUndefined(this.props.currentTab) && !_.isEmpty(this.props.currentTab) ? this.props.currentTab : this.props.initialCategory,
22
+ categoryKeys: this.props.categoryKeys
23
+ });
24
+ }
25
+
26
+ componentDidMount() {
27
+ this.setState({
28
+ selectedCategory: !_.isUndefined(this.props.currentTab) && !_.isEmpty(this.props.currentTab) ? this.props.currentTab : this.props.initialCategory
29
+ });
30
+ }
31
+
32
+ UNSAFE_componentWillReceiveProps(nextProps) {
33
+ if (!_.isUndefined(nextProps.currentTab) && !_.isEmpty(nextProps.currentTab)) {
34
+ this.setState({
35
+ selectedCategory: nextProps.currentTab
36
+ });
37
+ }
38
+ }
39
+
40
+ selectCategory(key) {
41
+ this.setState({
42
+ selectedCategory: key
43
+ });
44
+ this.props.onSelect(key);
45
+ }
46
+
47
+ renderCounter(key) {
48
+ if (this.props.categoryCounter && this.props.categoryCounter[key] && this.props.categoryCounter[key] === true && this.props.counterValues && this.props.counterValues[key] > 0) {
49
+ return /*#__PURE__*/React.createElement(View, {
50
+ style: styles.counter
51
+ }, /*#__PURE__*/React.createElement(Text, {
52
+ style: styles.counterText
53
+ }, this.props.counterValues[key]));
54
+ }
55
+
56
+ return null;
57
+ }
58
+
59
+ renderCategories(noScrollStyle) {
60
+ const getTextColour = key => {
61
+ if (this.state.selectedCategory === key) {
62
+ return this.props.headerType !== 'white' ? '#fff' : this.props.colourBrandingMain;
63
+ }
64
+
65
+ return this.props.headerType !== 'white' ? '#fff' : TEXT_LIGHT;
66
+ };
67
+
68
+ const getBottomBorderColour = key => {
69
+ if (this.state.selectedCategory === key) {
70
+ return this.props.headerType !== 'white' ? '#fff' : this.props.colourBrandingMain;
71
+ }
72
+
73
+ return this.props.headerType !== 'white' ? this.props.colourBrandingMain : '#fff';
74
+ };
75
+
76
+ return this.state.categoryKeys.map((key, index) => {
77
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
78
+ key: index // style={[{ minHeight: this.props.height || 30, justifyContent: 'center' }, noScrollStyle && { flex: 1 }]}
79
+ ,
80
+ style: [{
81
+ flex: 1,
82
+ minHeight: this.props.height || 30,
83
+ justifyContent: 'center'
84
+ }, this.props.catWrapperStyle],
85
+ onPress: this.selectCategory.bind(this, key)
86
+ }, /*#__PURE__*/React.createElement(View, {
87
+ style: [{
88
+ borderBottomColor: getBottomBorderColour(key),
89
+ borderBottomWidth: noScrollStyle ? 0 : 2,
90
+ marginRight: noScrollStyle ? 0 : 16,
91
+ marginLeft: index === 0 && !noScrollStyle ? 16 : 0,
92
+ justifyContent: 'center',
93
+ alignContent: 'center',
94
+ minHeight: 30,
95
+ flexDirection: 'row',
96
+ backgroundColor: this.props.headerType !== 'white' ? this.props.colourBrandingMain : undefined
97
+ }, this.props.style]
98
+ }, /*#__PURE__*/React.createElement(View, {
99
+ style: [noScrollStyle && styles.innerContainer, {
100
+ flex: 1,
101
+ borderColor: getBottomBorderColour(key),
102
+ justifyContent: 'center'
103
+ }, this.props.catStyle]
104
+ }, /*#__PURE__*/React.createElement(Text, {
105
+ style: [{
106
+ fontFamily: 'sf-semibold',
107
+ fontSize: 15,
108
+ color: getTextColour(key),
109
+ textAlign: 'center',
110
+ paddingVertical: 8,
111
+ width: 'auto'
112
+ }, this.props.textStyle, this.props.colourBrandingHeader && this.state.selectedCategory !== key && {
113
+ color: this.props.colourBrandingMain,
114
+ opacity: 0.5
115
+ }]
116
+ }, key), this.renderCounter(key))));
117
+ });
118
+ }
119
+
120
+ render() {
121
+ if (this.props.noScroll) {
122
+ // return (<View style={{ flexDirection: 'row', paddingLeft: 16, paddingRight: 16 }}>
123
+ return /*#__PURE__*/React.createElement(View, {
124
+ style: {
125
+ flexDirection: 'row',
126
+ justifyContent: 'space-evenly'
127
+ }
128
+ }, this.renderCategories(true));
129
+ }
130
+
131
+ return /*#__PURE__*/React.createElement(ScrollView, {
132
+ horizontal: true
133
+ }, this.renderCategories(false));
134
+ }
135
+
136
+ }
137
+
138
+ const styles = {
139
+ counter: {
140
+ backgroundColor: COLOUR_GREEN,
141
+ height: 16,
142
+ minWidth: 16,
143
+ borderRadius: 8,
144
+ marginLeft: 4,
145
+ marginTop: 4,
146
+ justifyContent: 'center',
147
+ alignContent: 'center'
148
+ },
149
+ counterText: {
150
+ color: '#fff',
151
+ textAlign: 'center',
152
+ fontSize: 12,
153
+ fontFamily: 'sf-semibold'
154
+ },
155
+ innerContainer: {
156
+ borderBottomWidth: 2,
157
+ flexDirection: 'row',
158
+ paddingHorizontal: 8
159
+ }
160
+ };
161
+
162
+ const mapStateToProps = state => {
163
+ return {
164
+ colourBrandingMain: getMainBrandingColourFromState(state),
165
+ headerType: getSiteSettingFromState(state, 'HeaderType', getSiteSettingFromState(state, 'UseGradientHeader', Config.env.hasGradientHeader) ? 'gradient' : 'white')
166
+ };
167
+ };
168
+
169
+ const categoryTabs = connect(mapStateToProps, {})(CategoryTabs);
170
+ export { categoryTabs as CategoryTabs };
171
+ //# sourceMappingURL=CategoryTabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["CategoryTabs.js"],"names":["React","Component","_","Text","TouchableOpacity","View","ScrollView","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","styles","counter","counterText","renderCategories","noScrollStyle","getTextColour","headerType","colourBrandingMain","getBottomBorderColour","map","index","flex","minHeight","height","justifyContent","catWrapperStyle","bind","borderBottomColor","borderBottomWidth","marginRight","marginLeft","alignContent","flexDirection","backgroundColor","undefined","style","innerContainer","borderColor","catStyle","fontFamily","fontSize","color","textAlign","paddingVertical","width","textStyle","colourBrandingHeader","opacity","render","noScroll","minWidth","borderRadius","marginTop","paddingHorizontal","mapStateToProps","env","hasGradientHeader","categoryTabs"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,SAASC,IAAT,EAAeC,gBAAf,EAAiCC,IAAjC,EAAuCC,UAAvC,QAAyD,cAAzD;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,SAASC,UAAT,EAAqBC,YAArB,EAAmCC,8BAAnC,QAAyE,YAAzE;AACA,SAASC,uBAAT,QAAwC,WAAxC,C,CACA;;AACA,OAAOC,MAAP,MAAmB,WAAnB;;AAEA,MAAMC,YAAN,SAA2BZ,SAA3B,CAAqC;AACn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,MAAM,EAAE,EAFD;AAGP2B,IAAAA,QAAQ,EAAE,EAHH;AAIPC,IAAAA,YAAY,EAAE,CAJP;AAKPrB,IAAAA,UAAU,EAAE,CALL;AAMPsB,IAAAA,SAAS,EAAE,CANJ;AAOP5B,IAAAA,cAAc,EAAE,QAPT;AAQPO,IAAAA,YAAY,EAAE;AARP,GADI;AAWbnB,EAAAA,WAAW,EAAE;AACX6B,IAAAA,KAAK,EAAE,MADI;AAEXC,IAAAA,SAAS,EAAE,QAFA;AAGXF,IAAAA,QAAQ,EAAE,EAHC;AAIXD,IAAAA,UAAU,EAAE;AAJD,GAXA;AAiBbH,EAAAA,cAAc,EAAE;AACdR,IAAAA,iBAAiB,EAAE,CADL;AAEdI,IAAAA,aAAa,EAAE,KAFD;AAGdqB,IAAAA,iBAAiB,EAAE;AAHL;AAjBH,CAAf;;AAwBA,MAAMC,eAAe,GAAG9D,KAAK,IAAI;AAC/B,SAAO;AACLyB,IAAAA,kBAAkB,EAAE/B,8BAA8B,CAACM,KAAD,CAD7C;AAELwB,IAAAA,UAAU,EAAE7B,uBAAuB,CACjCK,KADiC,EAEjC,YAFiC,EAGjCL,uBAAuB,CAACK,KAAD,EAAQ,mBAAR,EAA6BJ,MAAM,CAACmE,GAAP,CAAWC,iBAAxC,CAAvB,GAAoF,UAApF,GAAiG,OAHhE;AAF9B,GAAP;AAQD,CATD;;AAWA,MAAMC,YAAY,GAAG1E,OAAO,CAACuE,eAAD,EAAkB,EAAlB,CAAP,CAA6BjE,YAA7B,CAArB;AACA,SAASoE,YAAY,IAAIpE,YAAzB","sourcesContent":["import React, { Component } from 'react';\nimport _ from 'lodash';\nimport { Text, TouchableOpacity, View, ScrollView } from 'react-native';\nimport { connect } from 'react-redux';\nimport { TEXT_LIGHT, COLOUR_GREEN, getMainBrandingColourFromState } from '../colours';\nimport { getSiteSettingFromState } from '../helper';\n// import { HAS_GRADIENT_HEADER } from '../../config';\nimport Config from '../config';\n\nclass CategoryTabs extends Component {\n constructor(props) {\n super(props);\n this.state = {\n categoryKeys: [],\n selectedCategory: this.props.initialCategory,\n };\n }\n\n UNSAFE_componentWillMount() {\n this.setState({\n selectedCategory:\n !_.isUndefined(this.props.currentTab) && !_.isEmpty(this.props.currentTab) ? this.props.currentTab : this.props.initialCategory,\n categoryKeys: this.props.categoryKeys,\n });\n }\n\n componentDidMount() {\n this.setState({\n selectedCategory:\n !_.isUndefined(this.props.currentTab) && !_.isEmpty(this.props.currentTab) ? this.props.currentTab : this.props.initialCategory,\n });\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!_.isUndefined(nextProps.currentTab) && !_.isEmpty(nextProps.currentTab)) {\n this.setState({ selectedCategory: nextProps.currentTab });\n }\n }\n\n selectCategory(key) {\n this.setState({\n selectedCategory: key,\n });\n this.props.onSelect(key);\n }\n\n renderCounter(key) {\n if (\n this.props.categoryCounter &&\n this.props.categoryCounter[key] &&\n this.props.categoryCounter[key] === true &&\n this.props.counterValues &&\n this.props.counterValues[key] > 0\n ) {\n return (\n <View style={styles.counter}>\n <Text style={styles.counterText}>{this.props.counterValues[key]}</Text>\n </View>\n );\n }\n return null;\n }\n\n renderCategories(noScrollStyle) {\n const getTextColour = key => {\n if (this.state.selectedCategory === key) {\n return this.props.headerType !== 'white' ? '#fff' : this.props.colourBrandingMain;\n }\n return this.props.headerType !== 'white' ? '#fff' : TEXT_LIGHT;\n };\n const getBottomBorderColour = key => {\n if (this.state.selectedCategory === key) {\n return this.props.headerType !== 'white' ? '#fff' : this.props.colourBrandingMain;\n }\n return this.props.headerType !== 'white' ? this.props.colourBrandingMain : '#fff';\n };\n return this.state.categoryKeys.map((key, index) => {\n return (\n <TouchableOpacity\n key={index}\n // style={[{ minHeight: this.props.height || 30, justifyContent: 'center' }, noScrollStyle && { flex: 1 }]}\n style={[{ flex: 1, minHeight: this.props.height || 30, justifyContent: 'center' }, this.props.catWrapperStyle]}\n onPress={this.selectCategory.bind(this, key)}\n >\n <View\n style={[\n {\n borderBottomColor: getBottomBorderColour(key),\n borderBottomWidth: noScrollStyle ? 0 : 2,\n marginRight: noScrollStyle ? 0 : 16,\n marginLeft: index === 0 && !noScrollStyle ? 16 : 0,\n justifyContent: 'center',\n alignContent: 'center',\n minHeight: 30,\n flexDirection: 'row',\n backgroundColor: this.props.headerType !== 'white' ? this.props.colourBrandingMain : undefined,\n },\n this.props.style,\n ]}\n >\n <View\n style={[\n noScrollStyle && styles.innerContainer,\n {\n flex: 1,\n borderColor: getBottomBorderColour(key),\n justifyContent: 'center',\n },\n this.props.catStyle,\n ]}\n >\n <Text\n style={[\n {\n fontFamily: 'sf-semibold',\n fontSize: 15,\n color: getTextColour(key),\n textAlign: 'center',\n paddingVertical: 8,\n width: 'auto',\n },\n this.props.textStyle,\n this.props.colourBrandingHeader &&\n this.state.selectedCategory !== key && { color: this.props.colourBrandingMain, opacity: 0.5 },\n ]}\n >\n {key}\n </Text>\n {this.renderCounter(key)}\n </View>\n </View>\n </TouchableOpacity>\n );\n });\n }\n\n render() {\n if (this.props.noScroll) {\n // return (<View style={{ flexDirection: 'row', paddingLeft: 16, paddingRight: 16 }}>\n return <View style={{ flexDirection: 'row', justifyContent: 'space-evenly' }}>{this.renderCategories(true)}</View>;\n }\n return <ScrollView horizontal>{this.renderCategories(false)}</ScrollView>;\n }\n}\n\nconst styles = {\n counter: {\n backgroundColor: COLOUR_GREEN,\n height: 16,\n minWidth: 16,\n borderRadius: 8,\n marginLeft: 4,\n marginTop: 4,\n justifyContent: 'center',\n alignContent: 'center',\n },\n counterText: {\n color: '#fff',\n textAlign: 'center',\n fontSize: 12,\n fontFamily: 'sf-semibold',\n },\n innerContainer: {\n borderBottomWidth: 2,\n flexDirection: 'row',\n paddingHorizontal: 8,\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n headerType: getSiteSettingFromState(\n state,\n 'HeaderType',\n getSiteSettingFromState(state, 'UseGradientHeader', Config.env.hasGradientHeader) ? 'gradient' : 'white',\n ),\n };\n};\n\nconst categoryTabs = connect(mapStateToProps, {})(CategoryTabs);\nexport { categoryTabs as CategoryTabs };\n"]}
@@ -0,0 +1,363 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import React, { Component } from 'react';
4
+ import { connect } from 'react-redux';
5
+ import { Keyboard, TextInput, View, ImageBackground, TouchableOpacity, Dimensions } from 'react-native';
6
+ import { Icon } from 'react-native-elements';
7
+ import { getBottomSpace } from 'react-native-iphone-x-helper';
8
+ import _ from 'lodash';
9
+ import { getApiError } from '../session';
10
+ import { getShadowStyle } from '../helper';
11
+ import { TEXT_BLUEGREY, TEXT_DARKEST, BG_GREY } from '../colours';
12
+ import { Spinner } from './Spinner';
13
+ import ImageUploader from './ImageUploader';
14
+ import { reactionActions } from '../apis';
15
+ const SCREEN_HEIGHT = Dimensions.get('window').height;
16
+
17
+ class CommentReply extends Component {
18
+ constructor(props) {
19
+ super(props);
20
+
21
+ _defineProperty(this, "onUploadStarted", () => {
22
+ this.setState({
23
+ uploadingCommentImage: true
24
+ });
25
+ setTimeout(() => {
26
+ if (!this.props.noScroll) {
27
+ var _this$props$scrollVie, _this$props$scrollVie2;
28
+
29
+ (_this$props$scrollVie = this.props.scrollView) === null || _this$props$scrollVie === void 0 ? void 0 : (_this$props$scrollVie2 = _this$props$scrollVie.current) === null || _this$props$scrollVie2 === void 0 ? void 0 : _this$props$scrollVie2.scrollToEnd({
30
+ animated: true
31
+ });
32
+ }
33
+ }, 500);
34
+ });
35
+
36
+ _defineProperty(this, "onUploadSuccess", uri => {
37
+ this.setState({
38
+ uploadingCommentImage: false,
39
+ commentImageInput: uri.replace('/general/', '/general1400/')
40
+ });
41
+ });
42
+
43
+ _defineProperty(this, "onUploadFailed", () => {
44
+ this.setState({
45
+ uploadingCommentImage: false,
46
+ commentImageInput: null
47
+ });
48
+ });
49
+
50
+ this.state = {
51
+ commentImageInput: '',
52
+ commentInput: '',
53
+ uploadingCommentImage: false,
54
+ commentsLoading: true,
55
+ addingComment: false
56
+ };
57
+ }
58
+
59
+ componentDidMount() {
60
+ if (this.props.commentSection && this.props.commentSection.current) {
61
+ this.setState({
62
+ commentsLoading: this.props.commentSection.current.isLoading()
63
+ });
64
+ }
65
+ }
66
+
67
+ focusInput() {
68
+ this.refs.replyInput.focus();
69
+ }
70
+
71
+ loadingStarted() {
72
+ this.setState({
73
+ commentsLoading: true
74
+ });
75
+ }
76
+
77
+ loadingCompleted() {
78
+ this.setState({
79
+ commentsLoading: false
80
+ });
81
+ }
82
+
83
+ shouldShowImageInput() {
84
+ return this.state.uploadingCommentImage || !_.isEmpty(this.state.commentImageInput);
85
+ }
86
+
87
+ addComment() {
88
+ setTimeout(() => {
89
+ if (!this.props.noScroll) {
90
+ var _this$props$scrollVie3, _this$props$scrollVie4;
91
+
92
+ (_this$props$scrollVie3 = this.props.scrollView) === null || _this$props$scrollVie3 === void 0 ? void 0 : (_this$props$scrollVie4 = _this$props$scrollVie3.current) === null || _this$props$scrollVie4 === void 0 ? void 0 : _this$props$scrollVie4.scrollToEnd({
93
+ animated: true
94
+ });
95
+ }
96
+ }, 500);
97
+ const text = this.state.commentInput;
98
+ const image = this.state.commentImageInput;
99
+ this.setState({
100
+ addingComment: true,
101
+ commentInput: '',
102
+ commentImageInput: ''
103
+ });
104
+ Keyboard.dismiss();
105
+
106
+ if (this.props.commentSection) {
107
+ var _this$props$commentSe, _this$props$commentSe2;
108
+
109
+ (_this$props$commentSe = this.props.commentSection) === null || _this$props$commentSe === void 0 ? void 0 : (_this$props$commentSe2 = _this$props$commentSe.current) === null || _this$props$commentSe2 === void 0 ? void 0 : _this$props$commentSe2.startedAddingComment();
110
+ }
111
+
112
+ reactionActions.addComment(this.props.entityId, this.props.entityType, this.props.entityName, this.props.site, text, image, this.props.threadId).then(res => {
113
+ if (this.props.commentSection) {
114
+ var _this$props$commentSe3, _this$props$commentSe4;
115
+
116
+ (_this$props$commentSe3 = this.props.commentSection) === null || _this$props$commentSe3 === void 0 ? void 0 : (_this$props$commentSe4 = _this$props$commentSe3.current) === null || _this$props$commentSe4 === void 0 ? void 0 : _this$props$commentSe4.commentAdded(res.data);
117
+ }
118
+
119
+ this.setState({
120
+ addingComment: false
121
+ });
122
+ setTimeout(() => {
123
+ if (!this.props.noScroll) {
124
+ var _this$props$scrollVie5, _this$props$scrollVie6;
125
+
126
+ (_this$props$scrollVie5 = this.props.scrollView) === null || _this$props$scrollVie5 === void 0 ? void 0 : (_this$props$scrollVie6 = _this$props$scrollVie5.current) === null || _this$props$scrollVie6 === void 0 ? void 0 : _this$props$scrollVie6.scrollToEnd({
127
+ animated: true
128
+ });
129
+ }
130
+ }, 500);
131
+ }).catch(err => {
132
+ console.log(getApiError(err));
133
+ });
134
+ }
135
+
136
+ removeImage() {
137
+ this.setState({
138
+ commentImageInput: null
139
+ });
140
+ }
141
+
142
+ showUploadMenu() {
143
+ if (this.state.uploadingCommentImage || !_.isEmpty(this.state.commentImageInput)) {
144
+ return;
145
+ }
146
+
147
+ this.commentImageUploader.showUploadMenu();
148
+ }
149
+
150
+ renderImageAttachment() {
151
+ if (_.isEmpty(this.state.commentImageInput) && !this.state.uploadingCommentImage) {
152
+ return null;
153
+ }
154
+
155
+ if (this.state.uploadingCommentImage) {
156
+ return /*#__PURE__*/React.createElement(View, {
157
+ style: [styles.accessoryImage, styles.accessoryImageBorder, {
158
+ borderWidth: 1,
159
+ borderColor: BG_GREY
160
+ }]
161
+ }, /*#__PURE__*/React.createElement(Spinner, null));
162
+ }
163
+
164
+ return /*#__PURE__*/React.createElement(ImageBackground, {
165
+ style: styles.accessoryImage,
166
+ imageStyle: styles.accessoryImageBorder,
167
+ source: {
168
+ uri: this.state.commentImageInput
169
+ }
170
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
171
+ style: styles.accessoryImageClose,
172
+ onPress: this.removeImage.bind(this),
173
+ hitSlop: {
174
+ top: 8,
175
+ right: 8,
176
+ bottom: 8,
177
+ left: 8
178
+ }
179
+ }, /*#__PURE__*/React.createElement(Icon, {
180
+ name: "remove",
181
+ type: "font-awesome",
182
+ iconStyle: styles.accessoryImageCloseIcon,
183
+ style: styles.accessoryImageCloseIconContainer
184
+ })));
185
+ }
186
+
187
+ renderImageUploader() {
188
+ return /*#__PURE__*/React.createElement(ImageUploader, {
189
+ ref: ref => this.commentImageUploader = ref,
190
+ onUploadStarted: this.onUploadStarted,
191
+ onUploadSuccess: this.onUploadSuccess,
192
+ onUploadFailed: this.onUploadFailed,
193
+ onLibrarySelected: this.onUploadSuccess,
194
+ quality: 0.8,
195
+ allowsEditing: false,
196
+ fileName: "commentImage",
197
+ popupTitle: "Add Image",
198
+ userId: this.props.user.uid,
199
+ hideLibrary: true
200
+ });
201
+ }
202
+
203
+ render() {
204
+ if (_.includes(this.props.user.hidden, 'addComment')) {
205
+ return null;
206
+ }
207
+
208
+ if (this.state.commentsLoading) {
209
+ return null;
210
+ }
211
+
212
+ return /*#__PURE__*/React.createElement(View, {
213
+ style: [styles.inputContainer, getShadowStyle(), this.props.style]
214
+ }, /*#__PURE__*/React.createElement(View, {
215
+ style: [styles.input, {
216
+ marginRight: _.isEmpty(this.state.commentInput) && _.isEmpty(this.state.commentImageInput) ? 40 : 80
217
+ }]
218
+ }, /*#__PURE__*/React.createElement(TextInput, {
219
+ ref: "replyInput",
220
+ placeholder: "Enter your comment here",
221
+ value: this.state.commentInput,
222
+ onFocus: () => {
223
+ if (!this.props.noScroll) {
224
+ var _this$props$scrollVie7, _this$props$scrollVie8;
225
+
226
+ (_this$props$scrollVie7 = this.props.scrollView) === null || _this$props$scrollVie7 === void 0 ? void 0 : (_this$props$scrollVie8 = _this$props$scrollVie7.current) === null || _this$props$scrollVie8 === void 0 ? void 0 : _this$props$scrollVie8.scrollToEnd({
227
+ animated: true
228
+ });
229
+ }
230
+ },
231
+ onChangeText: value => {
232
+ if (!this.props.noScroll) {
233
+ var _this$props$scrollVie9, _this$props$scrollVie10;
234
+
235
+ (_this$props$scrollVie9 = this.props.scrollView) === null || _this$props$scrollVie9 === void 0 ? void 0 : (_this$props$scrollVie10 = _this$props$scrollVie9.current) === null || _this$props$scrollVie10 === void 0 ? void 0 : _this$props$scrollVie10.scrollToEnd({
236
+ animated: false
237
+ });
238
+ }
239
+
240
+ this.setState({
241
+ commentInput: value
242
+ });
243
+ },
244
+ style: styles.inputText,
245
+ autoCapitalize: "sentences",
246
+ multiline: true,
247
+ autoCorrect: true,
248
+ autoGrow: true
249
+ })), (!_.isEmpty(this.state.commentInput) || !_.isEmpty(this.state.commentImageInput)) && !this.state.addingComment && /*#__PURE__*/React.createElement(TouchableOpacity, {
250
+ onPress: this.addComment.bind(this),
251
+ style: [styles.sendContainer, {
252
+ right: 4,
253
+ padding: 4,
254
+ width: 40,
255
+ height: 40
256
+ }]
257
+ }, /*#__PURE__*/React.createElement(Icon, {
258
+ name: "paper-plane",
259
+ type: "font-awesome",
260
+ iconStyle: [styles.send, {
261
+ width: 40
262
+ }]
263
+ })), /*#__PURE__*/React.createElement(TouchableOpacity, {
264
+ onPress: this.showUploadMenu.bind(this),
265
+ style: [styles.sendContainer, {
266
+ right: _.isEmpty(this.state.commentInput) && _.isEmpty(this.state.commentImageInput) ? 4 : 44,
267
+ padding: 4,
268
+ width: 40,
269
+ height: 40
270
+ }]
271
+ }, /*#__PURE__*/React.createElement(Icon, {
272
+ name: "picture-o",
273
+ type: "font-awesome",
274
+ iconStyle: [styles.send, {
275
+ width: 40
276
+ }]
277
+ })), this.renderImageAttachment(), this.renderImageUploader());
278
+ }
279
+
280
+ }
281
+
282
+ const styles = {
283
+ accessoryImage: {
284
+ marginTop: 8,
285
+ width: 60,
286
+ height: 60
287
+ },
288
+ accessoryImageBorder: {
289
+ borderRadius: 2
290
+ },
291
+ accessoryImageClose: {
292
+ width: 14,
293
+ height: 14,
294
+ borderRadius: 7,
295
+ position: 'absolute',
296
+ top: -7,
297
+ right: -7,
298
+ backgroundColor: TEXT_BLUEGREY
299
+ },
300
+ accessoryImageCloseIconContainer: {
301
+ width: 14,
302
+ height: 14,
303
+ alignItems: 'center',
304
+ justifyContent: 'center'
305
+ },
306
+ accessoryImageCloseIcon: {
307
+ fontSize: 10,
308
+ color: '#fff',
309
+ textAlign: 'center'
310
+ },
311
+ inputContainer: {
312
+ backgroundColor: '#fff',
313
+ paddingVertical: 8,
314
+ paddingHorizontal: 8,
315
+ paddingBottom: 8 + getBottomSpace(),
316
+ flexGrow: 1
317
+ },
318
+ inputText: {
319
+ color: TEXT_DARKEST,
320
+ fontSize: 14,
321
+ fontFamily: 'sf-medium'
322
+ },
323
+ input: {
324
+ fontSize: 14,
325
+ color: TEXT_DARKEST,
326
+ fontFamily: 'sf-medium',
327
+ margin: 0,
328
+ backgroundColor: BG_GREY,
329
+ borderRadius: 5,
330
+ padding: 8,
331
+ maxHeight: SCREEN_HEIGHT / 3
332
+ },
333
+ sendContainer: {
334
+ position: 'absolute',
335
+ top: 8,
336
+ right: 8,
337
+ height: 30,
338
+ width: 30,
339
+ alignItems: 'center',
340
+ justifyContent: 'center',
341
+ backgroundColor: '#fff'
342
+ },
343
+ send: {
344
+ color: TEXT_BLUEGREY,
345
+ fontSize: 24,
346
+ textAlign: 'center'
347
+ }
348
+ };
349
+
350
+ const mapStateToProps = state => {
351
+ const {
352
+ user
353
+ } = state;
354
+ return {
355
+ user
356
+ };
357
+ };
358
+
359
+ const commentReply = connect(mapStateToProps, {}, null, {
360
+ forwardRef: true
361
+ })(CommentReply);
362
+ export { commentReply as CommentReply };
363
+ //# sourceMappingURL=CommentReply.js.map