@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,128 @@
1
+ import React, { Component } from 'react';
2
+ import { View, Text, TouchableWithoutFeedback, TouchableOpacity, Modal } from 'react-native';
3
+ import { connect } from 'react-redux';
4
+ import _ from 'lodash';
5
+ import { getMainBrandingColourFromState, LINEGREY, TEXT_DARK } from '../colours';
6
+
7
+ class PopupMenu extends Component {
8
+ renderOption(item, index) {
9
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
10
+ key: index,
11
+ onPress: item.onPress
12
+ }, /*#__PURE__*/React.createElement(View, {
13
+ style: [styles.option, index === 0 && styles.firstOption]
14
+ }, _.isEmpty(item.text) && item.content ? item.content : /*#__PURE__*/React.createElement(Text, {
15
+ style: styles.optionText
16
+ }, item.text)));
17
+ }
18
+
19
+ renderOptions() {
20
+ return /*#__PURE__*/React.createElement(View, {
21
+ style: styles.optionsContainer
22
+ }, _.map(this.props.options, (item, index) => {
23
+ return this.renderOption(item, index);
24
+ }));
25
+ }
26
+
27
+ renderTitle() {
28
+ return /*#__PURE__*/React.createElement(View, {
29
+ style: styles.titleContainer
30
+ }, /*#__PURE__*/React.createElement(Text, {
31
+ style: styles.titleText
32
+ }, this.props.title));
33
+ }
34
+
35
+ renderCancel() {
36
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
37
+ onPress: this.props.onClose
38
+ }, /*#__PURE__*/React.createElement(View, {
39
+ style: [styles.option, styles.cancelOption]
40
+ }, /*#__PURE__*/React.createElement(Text, {
41
+ style: [styles.optionText, styles.cancelText, {
42
+ color: this.props.colourBrandingMain
43
+ }]
44
+ }, this.props.cancelText)));
45
+ }
46
+
47
+ render() {
48
+ return /*#__PURE__*/React.createElement(Modal, {
49
+ visible: true,
50
+ transparent: true,
51
+ animationType: "slide",
52
+ onRequestClose: this.props.onClose
53
+ }, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
54
+ style: styles.container,
55
+ onPress: this.props.onClose
56
+ }, /*#__PURE__*/React.createElement(View, {
57
+ style: styles.container
58
+ }, /*#__PURE__*/React.createElement(View, {
59
+ style: styles.menu
60
+ }, this.renderTitle(), this.renderOptions(), this.renderCancel()))));
61
+ }
62
+
63
+ }
64
+
65
+ const styles = {
66
+ container: {
67
+ position: 'absolute',
68
+ bottom: 0,
69
+ left: 0,
70
+ right: 0,
71
+ top: 0,
72
+ backgroundColor: 'rgba(0,0,0,0.5)',
73
+ zIndex: 1000
74
+ },
75
+ menu: {
76
+ position: 'absolute',
77
+ bottom: 0,
78
+ left: 0,
79
+ right: 0,
80
+ backgroundColor: '#fff',
81
+ borderTopLeftRadius: 12,
82
+ borderTopRightRadius: 12
83
+ },
84
+ optionsContainer: {
85
+ paddingHorizontal: 16
86
+ },
87
+ option: {
88
+ paddingVertical: 16,
89
+ borderColor: LINEGREY,
90
+ borderTopWidth: 1
91
+ },
92
+ cancelOption: {
93
+ paddingHorizontal: 16
94
+ },
95
+ firstOption: {
96
+ borderTopWidth: 0
97
+ },
98
+ optionText: {
99
+ fontFamily: 'sf-regular',
100
+ fontSize: 16,
101
+ textAlign: 'center',
102
+ color: TEXT_DARK
103
+ },
104
+ cancelText: {
105
+ fontFamily: 'sf-medium'
106
+ },
107
+ titleContainer: {
108
+ padding: 16,
109
+ borderColor: LINEGREY,
110
+ borderBottomWidth: 1
111
+ },
112
+ titleText: {
113
+ fontFamily: 'sf-semibold',
114
+ fontSize: 16,
115
+ textAlign: 'center',
116
+ color: TEXT_DARK
117
+ }
118
+ };
119
+
120
+ const mapStateToProps = state => {
121
+ return {
122
+ colourBrandingMain: getMainBrandingColourFromState(state)
123
+ };
124
+ };
125
+
126
+ const popupMenu = connect(mapStateToProps, {})(PopupMenu);
127
+ export { popupMenu as PopupMenu };
128
+ //# sourceMappingURL=PopupMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["PopupMenu.js"],"names":["React","Component","View","Text","TouchableWithoutFeedback","TouchableOpacity","Modal","connect","_","getMainBrandingColourFromState","LINEGREY","TEXT_DARK","PopupMenu","renderOption","item","index","onPress","styles","option","firstOption","isEmpty","text","content","optionText","renderOptions","optionsContainer","map","props","options","renderTitle","titleContainer","titleText","title","renderCancel","onClose","cancelOption","cancelText","color","colourBrandingMain","render","container","menu","position","bottom","left","right","top","backgroundColor","zIndex","borderTopLeftRadius","borderTopRightRadius","paddingHorizontal","paddingVertical","borderColor","borderTopWidth","fontFamily","fontSize","textAlign","padding","borderBottomWidth","mapStateToProps","state","popupMenu"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,wBAArB,EAA+CC,gBAA/C,EAAiEC,KAAjE,QAA8E,cAA9E;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,SAASC,8BAAT,EAAyCC,QAAzC,EAAmDC,SAAnD,QAAoE,YAApE;;AAEA,MAAMC,SAAN,SAAwBX,SAAxB,CAAkC;AAChCY,EAAAA,YAAY,CAACC,IAAD,EAAOC,KAAP,EAAc;AACxB,wBACE,oBAAC,gBAAD;AAAkB,MAAA,GAAG,EAAEA,KAAvB;AAA8B,MAAA,OAAO,EAAED,IAAI,CAACE;AAA5C,oBACE,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAE,CAACC,MAAM,CAACC,MAAR,EAAgBH,KAAK,KAAK,CAAV,IAAeE,MAAM,CAACE,WAAtC;AAAb,OACGX,CAAC,CAACY,OAAF,CAAUN,IAAI,CAACO,IAAf,KAAwBP,IAAI,CAACQ,OAA7B,GAAuCR,IAAI,CAACQ,OAA5C,gBAAsD,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAEL,MAAM,CAACM;AAApB,OAAiCT,IAAI,CAACO,IAAtC,CADzD,CADF,CADF;AAOD;;AAEDG,EAAAA,aAAa,GAAG;AACd,wBACE,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAEP,MAAM,CAACQ;AAApB,OACGjB,CAAC,CAACkB,GAAF,CAAM,KAAKC,KAAL,CAAWC,OAAjB,EAA0B,CAACd,IAAD,EAAOC,KAAP,KAAiB;AAC1C,aAAO,KAAKF,YAAL,CAAkBC,IAAlB,EAA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;AAGdiD,IAAAA,iBAAiB,EAAE;AAHL,GA1CH;AA+Cb5B,EAAAA,SAAS,EAAE;AACTwB,IAAAA,UAAU,EAAE,aADH;AAETC,IAAAA,QAAQ,EAAE,EAFD;AAGTC,IAAAA,SAAS,EAAE,QAHF;AAITpB,IAAAA,KAAK,EAAE1B;AAJE;AA/CE,CAAf;;AAuDA,MAAMiD,eAAe,GAAGC,KAAK,IAAI;AAC/B,SAAO;AACLvB,IAAAA,kBAAkB,EAAE7B,8BAA8B,CAACoD,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMC,SAAS,GAAGvD,OAAO,CAACqD,eAAD,EAAkB,EAAlB,CAAP,CAA6BhD,SAA7B,CAAlB;AACA,SAASkD,SAAS,IAAIlD,SAAtB","sourcesContent":["import React, { Component } from 'react';\nimport { View, Text, TouchableWithoutFeedback, TouchableOpacity, Modal } from 'react-native';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport { getMainBrandingColourFromState, LINEGREY, TEXT_DARK } from '../colours';\n\nclass PopupMenu extends Component {\n renderOption(item, index) {\n return (\n <TouchableOpacity key={index} onPress={item.onPress}>\n <View style={[styles.option, index === 0 && styles.firstOption]}>\n {_.isEmpty(item.text) && item.content ? item.content : <Text style={styles.optionText}>{item.text}</Text>}\n </View>\n </TouchableOpacity>\n );\n }\n\n renderOptions() {\n return (\n <View style={styles.optionsContainer}>\n {_.map(this.props.options, (item, index) => {\n return this.renderOption(item, index);\n })}\n </View>\n );\n }\n\n renderTitle() {\n return (\n <View style={styles.titleContainer}>\n <Text style={styles.titleText}>{this.props.title}</Text>\n </View>\n );\n }\n\n renderCancel() {\n return (\n <TouchableOpacity onPress={this.props.onClose}>\n <View style={[styles.option, styles.cancelOption]}>\n <Text style={[styles.optionText, styles.cancelText, { color: this.props.colourBrandingMain }]}>{this.props.cancelText}</Text>\n </View>\n </TouchableOpacity>\n );\n }\n\n render() {\n return (\n <Modal visible transparent animationType=\"slide\" onRequestClose={this.props.onClose}>\n <TouchableWithoutFeedback style={styles.container} onPress={this.props.onClose}>\n <View style={styles.container}>\n <View style={styles.menu}>\n {this.renderTitle()}\n {this.renderOptions()}\n {this.renderCancel()}\n </View>\n </View>\n </TouchableWithoutFeedback>\n </Modal>\n );\n }\n}\n\nconst styles = {\n container: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n top: 0,\n backgroundColor: 'rgba(0,0,0,0.5)',\n zIndex: 1000,\n },\n menu: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n backgroundColor: '#fff',\n borderTopLeftRadius: 12,\n borderTopRightRadius: 12,\n },\n optionsContainer: {\n paddingHorizontal: 16,\n },\n option: {\n paddingVertical: 16,\n borderColor: LINEGREY,\n borderTopWidth: 1,\n },\n cancelOption: {\n paddingHorizontal: 16,\n },\n firstOption: {\n borderTopWidth: 0,\n },\n optionText: {\n fontFamily: 'sf-regular',\n fontSize: 16,\n textAlign: 'center',\n color: TEXT_DARK,\n },\n cancelText: {\n fontFamily: 'sf-medium',\n },\n titleContainer: {\n padding: 16,\n borderColor: LINEGREY,\n borderBottomWidth: 1,\n },\n titleText: {\n fontFamily: 'sf-semibold',\n fontSize: 16,\n textAlign: 'center',\n color: TEXT_DARK,\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst popupMenu = connect(mapStateToProps, {})(PopupMenu);\nexport { popupMenu as PopupMenu };\n"]}
@@ -0,0 +1,333 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ 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; }
4
+
5
+ import React, { Component } from 'react';
6
+ import { View, Animated, PanResponder, Image, StyleSheet } from 'react-native';
7
+ import { Icon } from 'react-native-elements';
8
+ import { BOXGREY, TEXT_LIGHT } from '../colours';
9
+
10
+ class PositionedImage extends Component {
11
+ constructor(props) {
12
+ super(props);
13
+
14
+ _defineProperty(this, "calculateDimensions", () => {
15
+ Image.getSize(this.props.source.uri, (imageWidth, imageHeight) => {
16
+ // Default vertical positioning
17
+ const newWidth = this.props.width;
18
+ const newHeight = imageHeight * (this.props.width / imageWidth);
19
+
20
+ if (newHeight < this.props.height) {
21
+ // If vertical positioning isn't possible, enable horizontal positioning
22
+ this.setState({
23
+ imageWidth: imageWidth * (this.props.height / imageHeight),
24
+ imageHeight: this.props.height,
25
+ isVertical: false,
26
+ showGuide: this.props.onPositionEnd ? true : false
27
+ }, this.onDimensionAvailable);
28
+ } else {
29
+ this.setState({
30
+ imageWidth: newWidth,
31
+ imageHeight: newHeight,
32
+ isVertical: true,
33
+ showGuide: this.props.onPositionEnd ? true : false
34
+ }, this.onDimensionAvailable);
35
+ }
36
+ });
37
+ });
38
+
39
+ _defineProperty(this, "onDimensionAvailable", () => {
40
+ const {
41
+ offset
42
+ } = this.props;
43
+ const {
44
+ imageWidth,
45
+ imageHeight,
46
+ isVertical
47
+ } = this.state;
48
+
49
+ if (offset) {
50
+ // Apply percentage offset
51
+ const actual = {
52
+ x: offset.x * imageWidth,
53
+ y: offset.y * imageHeight
54
+ };
55
+ this.imagePosition.setValue(actual);
56
+ } else {
57
+ // Centered by default
58
+ this.imagePosition.setValue({
59
+ x: isVertical ? 0 : -0.5 * imageWidth + 0.5 * this.props.width,
60
+ y: isVertical ? -0.5 * imageHeight + 0.5 * this.props.height : 0
61
+ });
62
+ }
63
+
64
+ if (this.props.onPositionEnd) {
65
+ setTimeout(() => {
66
+ Animated.timing(this.state.animatedOpacity, {
67
+ toValue: 0,
68
+ duration: 900,
69
+ useNativeDriver: false
70
+ }).start(() => {
71
+ this.setState({
72
+ showGuide: false
73
+ });
74
+ });
75
+ }, 1000);
76
+ }
77
+ });
78
+
79
+ this.lastPos = {
80
+ x: 0,
81
+ y: 0
82
+ };
83
+ this.imagePosition = new Animated.ValueXY(this.lastPos);
84
+ this.imagePosition.addListener(value => {
85
+ this.lastPos = value;
86
+ });
87
+ const imagePanResponder = PanResponder.create({
88
+ onStartShouldSetPanResponder: () => {
89
+ this.startPos = this.lastPos;
90
+
91
+ if (this.props.onPositionEnd) {
92
+ if (this.props.onPositionStart) this.props.onPositionStart();
93
+ this.setState({
94
+ panning: true
95
+ });
96
+ return true;
97
+ }
98
+
99
+ return false;
100
+ },
101
+ onPanResponderMove: (event, gesture) => {
102
+ const newPos = this.state.isVertical ? {
103
+ x: 0,
104
+ y: this.startPos.y + gesture.dy
105
+ } : {
106
+ x: this.startPos.x + gesture.dx,
107
+ y: 0
108
+ };
109
+ this.imagePosition.setValue(newPos);
110
+ },
111
+ onPanResponderTerminationRequest: (event, gesture) => true,
112
+ onPanResponderRelease: (event, gesture) => {
113
+ let endPos = {
114
+ x: 0,
115
+ y: 0
116
+ };
117
+
118
+ if (this.state.isVertical) {
119
+ const endY = this.startPos.y + gesture.dy;
120
+ const limitY = this.props.height - this.state.imageHeight;
121
+
122
+ if (endY > 0) {
123
+ // console.log('top reached', endY);
124
+ endPos = {
125
+ x: 0,
126
+ y: 0
127
+ };
128
+ } else if (endY < limitY) {
129
+ // console.log('bottom reached', endY, limitY);
130
+ endPos = {
131
+ x: 0,
132
+ y: limitY
133
+ };
134
+ } else {
135
+ endPos = {
136
+ x: 0,
137
+ y: endY
138
+ };
139
+ }
140
+ } else {
141
+ const endX = this.startPos.x + gesture.dx;
142
+ const limitX = this.props.width - this.state.imageWidth;
143
+
144
+ if (endX > 0) {
145
+ // console.log('left reached', endX);
146
+ endPos = {
147
+ x: 0,
148
+ y: 0
149
+ };
150
+ } else if (endX < limitX) {
151
+ // console.log('right reached', endX, limitX);
152
+ endPos = {
153
+ x: limitX,
154
+ y: 0
155
+ };
156
+ } else {
157
+ endPos = {
158
+ x: endX,
159
+ y: 0
160
+ };
161
+ }
162
+ }
163
+
164
+ Animated.spring(this.imagePosition, {
165
+ toValue: endPos,
166
+ useNativeDriver: false
167
+ }).start();
168
+ if (this.props.onPositionEnd) this.props.onPositionEnd({
169
+ x: endPos.x / this.state.imageWidth,
170
+ y: endPos.y / this.state.imageHeight
171
+ });
172
+ this.setState({
173
+ panning: false
174
+ });
175
+ },
176
+ onPanResponderTerminate: (event, gesture) => {
177
+ this.setState({
178
+ panning: false
179
+ });
180
+ }
181
+ });
182
+ this.state = {
183
+ imageWidth: 0,
184
+ imageHeight: 0,
185
+ imagePanResponder,
186
+ isVertical: true,
187
+ showGuide: false,
188
+ animatedOpacity: new Animated.Value(1),
189
+ panning: false
190
+ };
191
+ }
192
+
193
+ componentDidMount() {
194
+ this.calculateDimensions();
195
+ }
196
+
197
+ componentDidUpdate(prevProps) {
198
+ if (prevProps.source.uri !== this.props.source.uri) {
199
+ // console.log('componentDidUpdate', prevProps.source.uri, this.props.source.uri);
200
+ this.calculateDimensions();
201
+ }
202
+ }
203
+
204
+ renderGrid() {
205
+ if (!this.state.panning) return null;
206
+ return /*#__PURE__*/React.createElement(View, {
207
+ style: styles.gridContainer
208
+ }, /*#__PURE__*/React.createElement(View, {
209
+ style: styles.gridHorizontal
210
+ }), /*#__PURE__*/React.createElement(View, {
211
+ style: styles.gridVertical
212
+ }));
213
+ }
214
+
215
+ renderGuide() {
216
+ if (!this.state.showGuide) return null;
217
+ const {
218
+ animatedOpacity,
219
+ isVertical
220
+ } = this.state;
221
+ return /*#__PURE__*/React.createElement(Animated.View, {
222
+ style: [styles.guideContainer, {
223
+ opacity: animatedOpacity
224
+ }]
225
+ }, /*#__PURE__*/React.createElement(View, {
226
+ style: [styles.guideIconContainer, {
227
+ flexDirection: 'column'
228
+ }]
229
+ }, /*#__PURE__*/React.createElement(Icon, {
230
+ name: "arrow-up",
231
+ type: "font-awesome",
232
+ iconStyle: [styles.guideIcon, !isVertical && styles.guideIconDisabled]
233
+ }), /*#__PURE__*/React.createElement(Icon, {
234
+ name: "arrow-down",
235
+ type: "font-awesome",
236
+ iconStyle: [styles.guideIcon, !isVertical && styles.guideIconDisabled]
237
+ })), /*#__PURE__*/React.createElement(View, {
238
+ style: [styles.guideIconContainer, {
239
+ flexDirection: 'row'
240
+ }]
241
+ }, /*#__PURE__*/React.createElement(Icon, {
242
+ name: "arrow-left",
243
+ type: "font-awesome",
244
+ iconStyle: [styles.guideIcon, isVertical && styles.guideIconDisabled]
245
+ }), /*#__PURE__*/React.createElement(Icon, {
246
+ name: "arrow-right",
247
+ type: "font-awesome",
248
+ iconStyle: [styles.guideIcon, isVertical && styles.guideIconDisabled]
249
+ })));
250
+ }
251
+
252
+ render() {
253
+ const {
254
+ imageWidth,
255
+ imageHeight,
256
+ imagePanResponder
257
+ } = this.state;
258
+ return /*#__PURE__*/React.createElement(View, {
259
+ style: [styles.container, {
260
+ width: this.props.width,
261
+ height: this.props.height
262
+ }, this.props.style]
263
+ }, /*#__PURE__*/React.createElement(Animated.Image, _extends({
264
+ source: this.props.source,
265
+ style: [{
266
+ width: imageWidth,
267
+ height: imageHeight
268
+ }, this.imagePosition.getLayout()]
269
+ }, imagePanResponder.panHandlers)), this.renderGrid(), this.renderGuide());
270
+ }
271
+
272
+ }
273
+
274
+ const styles = StyleSheet.create({
275
+ container: {
276
+ overflow: 'hidden',
277
+ backgroundColor: BOXGREY
278
+ },
279
+ guideContainer: {
280
+ position: 'absolute',
281
+ top: 0,
282
+ right: 0,
283
+ bottom: 0,
284
+ left: 0,
285
+ alignItems: 'center',
286
+ justifyContent: 'center',
287
+ backgroundColor: '#0006'
288
+ },
289
+ guideIconContainer: {
290
+ position: 'absolute',
291
+ top: 0,
292
+ right: 0,
293
+ bottom: 0,
294
+ left: 0,
295
+ alignItems: 'center',
296
+ justifyContent: 'center'
297
+ },
298
+ guideIcon: {
299
+ color: '#fff',
300
+ fontSize: 50,
301
+ margin: 15
302
+ },
303
+ guideIconDisabled: {
304
+ color: TEXT_LIGHT
305
+ },
306
+ gridContainer: {
307
+ position: 'absolute',
308
+ top: 0,
309
+ right: 0,
310
+ bottom: 0,
311
+ left: 0
312
+ },
313
+ gridHorizontal: {
314
+ position: 'absolute',
315
+ top: 0,
316
+ right: 0,
317
+ left: 0,
318
+ height: '50%',
319
+ borderBottomWidth: 1,
320
+ borderBottomColor: BOXGREY
321
+ },
322
+ gridVertical: {
323
+ position: 'absolute',
324
+ top: 0,
325
+ right: 0,
326
+ bottom: 0,
327
+ width: '50%',
328
+ borderLeftWidth: 1,
329
+ borderLeftColor: BOXGREY
330
+ }
331
+ });
332
+ export default PositionedImage;
333
+ //# sourceMappingURL=PositionedImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["PositionedImage.js"],"names":["React","Component","View","Animated","PanResponder","Image","StyleSheet","Icon","BOXGREY","TEXT_LIGHT","PositionedImage","constructor","props","getSize","source","uri","imageWidth","imageHeight","newWidth","width","newHeight","height","setState","isVertical","showGuide","onPositionEnd","onDimensionAvailable","offset","state","actual","x","y","imagePosition","setValue","setTimeout","timing","animatedOpacity","toValue","duration","useNativeDriver","start","lastPos","ValueXY","addListener","value","imagePanResponder","create","onStartShouldSetPanResponder","startPos","onPositionStart","panning","onPanResponderMove","event","gesture","newPos","dy","dx","onPanResponderTerminationRequest","onPanResponderRelease","endPos","endY","limitY","endX","limitX","spring","onPanResponderTerminate","Value","componentDidMount","calculateDimensions","componentDidUpdate","prevProps","renderGrid","styles","gridContainer","gridHorizontal","gridVertical","renderGuide","guideContainer","opacity","guideIconContainer","flexDirection","guideIcon","guideIconDisabled","render","container","style","getLayout","panHandlers","overflow","backgroundColor","position","top","right","bottom","left","alignItems","justifyContent","color","fontSize","margin","borderBottomWidth","borderBottomColor","borderLeftWidth","borderLeftColor"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,IAAT,EAAeC,QAAf,EAAyBC,YAAzB,EAAuCC,KAAvC,EAA8CC,UA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,EAAE,UADE;AAEZC,IAAAA,GAAG,EAAE,CAFO;AAGZC,IAAAA,KAAK,EAAE,CAHK;AAIZC,IAAAA,MAAM,EAAE,CAJI;AAKZ1E,IAAAA,KAAK,EAAE,KALK;AAMZmF,IAAAA,eAAe,EAAE,CANL;AAOZC,IAAAA,eAAe,EAAE/F;AAPL;AAhDiB,CAAlB,CAAf;AA2DA,eAAeE,eAAf","sourcesContent":["import React, { Component } from 'react';\nimport { View, Animated, PanResponder, Image, StyleSheet } from 'react-native';\nimport { Icon } from 'react-native-elements';\nimport { BOXGREY, TEXT_LIGHT } from '../colours';\n\nclass PositionedImage extends Component {\n constructor(props) {\n super(props);\n\n this.lastPos = { x: 0, y: 0 };\n this.imagePosition = new Animated.ValueXY(this.lastPos);\n this.imagePosition.addListener(value => {\n this.lastPos = value;\n });\n const imagePanResponder = PanResponder.create({\n onStartShouldSetPanResponder: () => {\n this.startPos = this.lastPos;\n if (this.props.onPositionEnd) {\n if (this.props.onPositionStart) this.props.onPositionStart();\n this.setState({ panning: true });\n return true;\n }\n return false;\n },\n onPanResponderMove: (event, gesture) => {\n const newPos = this.state.isVertical ? { x: 0, y: this.startPos.y + gesture.dy } : { x: this.startPos.x + gesture.dx, y: 0 };\n this.imagePosition.setValue(newPos);\n },\n onPanResponderTerminationRequest: (event, gesture) => true,\n onPanResponderRelease: (event, gesture) => {\n let endPos = { x: 0, y: 0 };\n if (this.state.isVertical) {\n const endY = this.startPos.y + gesture.dy;\n const limitY = this.props.height - this.state.imageHeight;\n if (endY > 0) {\n // console.log('top reached', endY);\n endPos = { x: 0, y: 0 };\n } else if (endY < limitY) {\n // console.log('bottom reached', endY, limitY);\n endPos = { x: 0, y: limitY };\n } else {\n endPos = { x: 0, y: endY };\n }\n } else {\n const endX = this.startPos.x + gesture.dx;\n const limitX = this.props.width - this.state.imageWidth;\n if (endX > 0) {\n // console.log('left reached', endX);\n endPos = { x: 0, y: 0 };\n } else if (endX < limitX) {\n // console.log('right reached', endX, limitX);\n endPos = { x: limitX, y: 0 };\n } else {\n endPos = { x: endX, y: 0 };\n }\n }\n Animated.spring(this.imagePosition, { toValue: endPos, useNativeDriver: false }).start();\n\n if (this.props.onPositionEnd)\n this.props.onPositionEnd({\n x: endPos.x / this.state.imageWidth,\n y: endPos.y / this.state.imageHeight,\n });\n\n this.setState({ panning: false });\n },\n onPanResponderTerminate: (event, gesture) => {\n this.setState({ panning: false });\n },\n });\n\n this.state = {\n imageWidth: 0,\n imageHeight: 0,\n imagePanResponder,\n isVertical: true,\n showGuide: false,\n animatedOpacity: new Animated.Value(1),\n panning: false,\n };\n }\n\n componentDidMount() {\n this.calculateDimensions();\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.source.uri !== this.props.source.uri) {\n // console.log('componentDidUpdate', prevProps.source.uri, this.props.source.uri);\n this.calculateDimensions();\n }\n }\n\n calculateDimensions = () => {\n Image.getSize(this.props.source.uri, (imageWidth, imageHeight) => {\n // Default vertical positioning\n const newWidth = this.props.width;\n const newHeight = imageHeight * (this.props.width / imageWidth);\n\n if (newHeight < this.props.height) {\n // If vertical positioning isn't possible, enable horizontal positioning\n this.setState(\n {\n imageWidth: imageWidth * (this.props.height / imageHeight),\n imageHeight: this.props.height,\n isVertical: false,\n showGuide: this.props.onPositionEnd ? true : false,\n },\n this.onDimensionAvailable,\n );\n } else {\n this.setState(\n {\n imageWidth: newWidth,\n imageHeight: newHeight,\n isVertical: true,\n showGuide: this.props.onPositionEnd ? true : false,\n },\n this.onDimensionAvailable,\n );\n }\n });\n };\n\n onDimensionAvailable = () => {\n const { offset } = this.props;\n const { imageWidth, imageHeight, isVertical } = this.state;\n\n if (offset) {\n // Apply percentage offset\n const actual = {\n x: offset.x * imageWidth,\n y: offset.y * imageHeight,\n };\n this.imagePosition.setValue(actual);\n } else {\n // Centered by default\n this.imagePosition.setValue({\n x: isVertical ? 0 : -0.5 * imageWidth + 0.5 * this.props.width,\n y: isVertical ? -0.5 * imageHeight + 0.5 * this.props.height : 0,\n });\n }\n\n if (this.props.onPositionEnd) {\n setTimeout(() => {\n Animated.timing(this.state.animatedOpacity, {\n toValue: 0,\n duration: 900,\n useNativeDriver: false,\n }).start(() => {\n this.setState({ showGuide: false });\n });\n }, 1000);\n }\n };\n\n renderGrid() {\n if (!this.state.panning) return null;\n return (\n <View style={styles.gridContainer}>\n <View style={styles.gridHorizontal} />\n <View style={styles.gridVertical} />\n </View>\n );\n }\n\n renderGuide() {\n if (!this.state.showGuide) return null;\n const { animatedOpacity, isVertical } = this.state;\n return (\n <Animated.View style={[styles.guideContainer, { opacity: animatedOpacity }]}>\n <View style={[styles.guideIconContainer, { flexDirection: 'column' }]}>\n <Icon name=\"arrow-up\" type=\"font-awesome\" iconStyle={[styles.guideIcon, !isVertical && styles.guideIconDisabled]} />\n <Icon name=\"arrow-down\" type=\"font-awesome\" iconStyle={[styles.guideIcon, !isVertical && styles.guideIconDisabled]} />\n </View>\n <View style={[styles.guideIconContainer, { flexDirection: 'row' }]}>\n <Icon name=\"arrow-left\" type=\"font-awesome\" iconStyle={[styles.guideIcon, isVertical && styles.guideIconDisabled]} />\n <Icon name=\"arrow-right\" type=\"font-awesome\" iconStyle={[styles.guideIcon, isVertical && styles.guideIconDisabled]} />\n </View>\n </Animated.View>\n );\n }\n\n render() {\n const { imageWidth, imageHeight, imagePanResponder } = this.state;\n\n return (\n <View style={[styles.container, { width: this.props.width, height: this.props.height }, this.props.style]}>\n <Animated.Image\n source={this.props.source}\n style={[{ width: imageWidth, height: imageHeight }, this.imagePosition.getLayout()]}\n {...imagePanResponder.panHandlers}\n />\n {this.renderGrid()}\n {this.renderGuide()}\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n backgroundColor: BOXGREY,\n },\n guideContainer: {\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: '#0006',\n },\n guideIconContainer: {\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n alignItems: 'center',\n justifyContent: 'center',\n },\n guideIcon: {\n color: '#fff',\n fontSize: 50,\n margin: 15,\n },\n guideIconDisabled: {\n color: TEXT_LIGHT,\n },\n gridContainer: {\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n },\n gridHorizontal: {\n position: 'absolute',\n top: 0,\n right: 0,\n left: 0,\n height: '50%',\n borderBottomWidth: 1,\n borderBottomColor: BOXGREY,\n },\n gridVertical: {\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n width: '50%',\n borderLeftWidth: 1,\n borderLeftColor: BOXGREY,\n },\n});\n\nexport default PositionedImage;\n"]}
@@ -0,0 +1,119 @@
1
+ import React, { Component } from 'react';
2
+ import { View, ImageBackground } from 'react-native';
3
+ import { connect } from 'react-redux';
4
+ import Config from '../config';
5
+ import { Spinner } from './Spinner';
6
+ import { LINEGREY, getMainBrandingColourFromState } from '../colours';
7
+
8
+ class ProfilePic extends Component {
9
+ constructor(props) {
10
+ super(props);
11
+ this.state = {
12
+ image: null,
13
+ imageBorderRadius: 18,
14
+ imageUploading: false,
15
+ backgroundFill: false
16
+ };
17
+ }
18
+
19
+ UNSAFE_componentWillMount() {
20
+ this.setState({
21
+ image: this.props.ProfilePic != null ? this.props.ProfilePic : Config.env.defaultProfileImage,
22
+ imageDiameterStyle: {
23
+ height: this.props.Diameter != null ? this.props.Diameter : 35,
24
+ width: this.props.Diameter != null ? this.props.Diameter : 35
25
+ },
26
+ imageBorderRadius: this.props.Diameter != null ? this.props.Diameter / 2 : 18,
27
+ imageUploading: this.props.ImageUploading,
28
+ backgroundFill: this.props.ProfilePic === Config.env.tinyChatDefault
29
+ });
30
+ }
31
+
32
+ UNSAFE_componentWillReceiveProps(nextProps) {
33
+ let profPic = null;
34
+
35
+ if (nextProps.ProfilePic) {
36
+ profPic = nextProps.ProfilePic;
37
+ }
38
+
39
+ this.setState({
40
+ image: profPic,
41
+ imageUploading: nextProps.ImageUploading
42
+ });
43
+ }
44
+
45
+ renderImage() {
46
+ if (this.state.imageUploading) {
47
+ return /*#__PURE__*/React.createElement(Spinner, {
48
+ style: {
49
+ backgroundColor: 'white',
50
+ borderRadius: this.state.imageBorderRadius
51
+ }
52
+ });
53
+ }
54
+
55
+ let image = Config.env.defaultProfileImage;
56
+ let isDefault = true;
57
+
58
+ if (this.state.image !== null && typeof this.state.image === 'string') {
59
+ if (this.state.image !== 'https://plusscdn.azureedge.net/uploads/687-1/63663744750845828739defaultavatar.jpg' && this.state.image !== 'https://plusscdn.azureedge.net/uploads/23046-1/636675694526742825882defaultavatar.jpg' && this.state.image !== 'https://plusscdn.azureedge.net/uploads/687-1/63663744750845828739defaultavatar.jpg' && this.state.image !== 'https://pluss60-dev-uploads.s3.ap-southeast-2.amazonaws.com/uploads/users/ap-southeast-2:e2dc6a8b-61e8-4a76-a7ea-b1a15a013b94/public/2b3df48c4394a03840e52db886/profilepic.jpg') {
60
+ image = {
61
+ uri: this.state.image
62
+ };
63
+ isDefault = false;
64
+ }
65
+ }
66
+
67
+ return /*#__PURE__*/React.createElement(ImageBackground, {
68
+ key: "default",
69
+ source: image,
70
+ style: [styles.profilePicImage, {
71
+ borderRadius: this.state.imageBorderRadius
72
+ }, (isDefault || this.state.backgroundFill) && {
73
+ backgroundColor: this.props.colourBrandingMain
74
+ }],
75
+ imageStyle: {
76
+ borderRadius: this.state.imageBorderRadius
77
+ }
78
+ }, this.props.children);
79
+ }
80
+
81
+ render() {
82
+ return /*#__PURE__*/React.createElement(View, {
83
+ style: [styles.profilePicOuter, this.state.imageDiameterStyle, this.props.bordered && styles.bordered, {
84
+ borderRadius: this.state.imageBorderRadius
85
+ }, this.props.style],
86
+ key: this.props.id
87
+ }, this.renderImage());
88
+ }
89
+
90
+ }
91
+
92
+ const styles = {
93
+ profilePicOuter: {
94
+ height: 35,
95
+ width: 35,
96
+ zIndex: 1,
97
+ backgroundColor: LINEGREY // overflow: 'hidden'
98
+
99
+ },
100
+ profilePicImage: {
101
+ flex: 1,
102
+ height: null,
103
+ width: null
104
+ },
105
+ bordered: {
106
+ borderWidth: 1,
107
+ borderColor: '#fff'
108
+ }
109
+ };
110
+
111
+ const mapStateToProps = state => {
112
+ return {
113
+ colourBrandingMain: getMainBrandingColourFromState(state)
114
+ };
115
+ };
116
+
117
+ const profilePic = connect(mapStateToProps, {})(ProfilePic);
118
+ export { profilePic as ProfilePic };
119
+ //# sourceMappingURL=ProfilePic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ProfilePic.js"],"names":["React","Component","View","ImageBackground","connect","Config","Spinner","LINEGREY","getMainBrandingColourFromState","ProfilePic","constructor","props","state","image","imageBorderRadius","imageUploading","backgroundFill","UNSAFE_componentWillMount","setState","env","defaultProfileImage","imageDiameterStyle","height","Diameter","width","ImageUploading","tinyChatDefault","UNSAFE_componentWillReceiveProps","nextProps","profPic","renderImage","backgroundColor","borderRadius","isDefault","uri","styles","profilePicImage","colourBrandingMain","children","render","profilePicOuter","bordered","style","id","zIndex","flex","borderWidth","borderColor","mapStateToProps","profilePic"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,IAAT,EAAeC,eAAf,QAAsC,cAAtC;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,QAAT,EAAmBC,8BAAnB,QAAyD,YAAzD;;AAEA,MAAMC,UAAN,SAAyBR,SAAzB,CAAmC;AACjCS,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;AACA,SAAKC,KAAL,GAAa;AACXC,MAAAA,KAAK,EAAE,IADI;AAEXC,MAAAA,iBAAiB,EAAE,EAFR;AAGXC,MAAAA,cAAc,EAAE,KAHL;AAIXC,MAAAA,cAAc,EAAE;AAJL,KAAb;AAMD;;AAEDC,EAAAA,yBAAyB,GAAG;AAC1B,SAAK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AAWE;AAA3B,OAJK,EAKL,KAAKH,KAAL,CAAW+B,KALN,CADT;AAQE,MAAA,GAAG,EAAE,KAAK/B,KAAL,CAAWgC;AARlB,OAUG,KAAKb,WAAL,EAVH,CADF;AAcD;;AA5FgC;;AA+FnC,MAAMK,MAAM,GAAG;AACbK,EAAAA,eAAe,EAAE;AACflB,IAAAA,MAAM,EAAE,EADO;AAEfE,IAAAA,KAAK,EAAE,EAFQ;AAGfoB,IAAAA,MAAM,EAAE,CAHO;AAIfb,IAAAA,eAAe,EAAExB,QAJF,CAKf;;AALe,GADJ;AAQb6B,EAAAA,eAAe,EAAE;AACfS,IAAAA,IAAI,EAAE,CADS;AAEfvB,IAAAA,MAAM,EAAE,IAFO;AAGfE,IAAAA,KAAK,EAAE;AAHQ,GARJ;AAabiB,EAAAA,QAAQ,EAAE;AACRK,IAAAA,WAAW,EAAE,CADL;AAERC,IAAAA,WAAW,EAAE;AAFL;AAbG,CAAf;;AAmBA,MAAMC,eAAe,GAAGpC,KAAK,IAAI;AAC/B,SAAO;AACLyB,IAAAA,kBAAkB,EAAE7B,8BAA8B,CAACI,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMqC,UAAU,GAAG7C,OAAO,CAAC4C,eAAD,EAAkB,EAAlB,CAAP,CAA6BvC,UAA7B,CAAnB;AACA,SAASwC,UAAU,IAAIxC,UAAvB","sourcesContent":["import React, { Component } from 'react';\nimport { View, ImageBackground } from 'react-native';\nimport { connect } from 'react-redux';\nimport Config from '../config';\nimport { Spinner } from './Spinner';\nimport { LINEGREY, getMainBrandingColourFromState } from '../colours';\n\nclass ProfilePic extends Component {\n constructor(props) {\n super(props);\n this.state = {\n image: null,\n imageBorderRadius: 18,\n imageUploading: false,\n backgroundFill: false,\n };\n }\n\n UNSAFE_componentWillMount() {\n this.setState({\n image: this.props.ProfilePic != null ? this.props.ProfilePic : Config.env.defaultProfileImage,\n imageDiameterStyle: {\n height: this.props.Diameter != null ? this.props.Diameter : 35,\n width: this.props.Diameter != null ? this.props.Diameter : 35,\n },\n imageBorderRadius: this.props.Diameter != null ? this.props.Diameter / 2 : 18,\n imageUploading: this.props.ImageUploading,\n backgroundFill: this.props.ProfilePic === Config.env.tinyChatDefault,\n });\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n let profPic = null;\n if (nextProps.ProfilePic) {\n profPic = nextProps.ProfilePic;\n }\n\n this.setState({\n image: profPic,\n imageUploading: nextProps.ImageUploading,\n });\n }\n\n renderImage() {\n if (this.state.imageUploading) {\n return (\n <Spinner\n style={{\n backgroundColor: 'white',\n borderRadius: this.state.imageBorderRadius,\n }}\n />\n );\n }\n let image = Config.env.defaultProfileImage;\n let isDefault = true;\n if (this.state.image !== null && typeof this.state.image === 'string') {\n if (\n this.state.image !== 'https://plusscdn.azureedge.net/uploads/687-1/63663744750845828739defaultavatar.jpg' &&\n this.state.image !== 'https://plusscdn.azureedge.net/uploads/23046-1/636675694526742825882defaultavatar.jpg' &&\n this.state.image !== 'https://plusscdn.azureedge.net/uploads/687-1/63663744750845828739defaultavatar.jpg' &&\n this.state.image !==\n 'https://pluss60-dev-uploads.s3.ap-southeast-2.amazonaws.com/uploads/users/ap-southeast-2:e2dc6a8b-61e8-4a76-a7ea-b1a15a013b94/public/2b3df48c4394a03840e52db886/profilepic.jpg'\n ) {\n image = { uri: this.state.image };\n isDefault = false;\n }\n }\n return (\n <ImageBackground\n key=\"default\"\n source={image}\n style={[\n styles.profilePicImage,\n { borderRadius: this.state.imageBorderRadius },\n (isDefault || this.state.backgroundFill) && { backgroundColor: this.props.colourBrandingMain },\n ]}\n imageStyle={{ borderRadius: this.state.imageBorderRadius }}\n >\n {this.props.children}\n </ImageBackground>\n );\n }\n\n render() {\n return (\n <View\n style={[\n styles.profilePicOuter,\n this.state.imageDiameterStyle,\n this.props.bordered && styles.bordered,\n { borderRadius: this.state.imageBorderRadius },\n this.props.style,\n ]}\n key={this.props.id}\n >\n {this.renderImage()}\n </View>\n );\n }\n}\n\nconst styles = {\n profilePicOuter: {\n height: 35,\n width: 35,\n zIndex: 1,\n backgroundColor: LINEGREY,\n // overflow: 'hidden'\n },\n profilePicImage: {\n flex: 1,\n height: null,\n width: null,\n },\n bordered: {\n borderWidth: 1,\n borderColor: '#fff',\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst profilePic = connect(mapStateToProps, {})(ProfilePic);\nexport { profilePic as ProfilePic };\n"]}