@plusscommunities/pluss-core-app 1.5.5 → 1.5.7-beta.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.
@@ -0,0 +1,241 @@
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 { Platform, Linking, StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';
7
+ import { connect } from 'react-redux';
8
+ import _ from 'lodash';
9
+ import * as Calendar from 'expo-calendar';
10
+ import { TEXT_DARK, getMainBrandingColourFromState } from '../colours';
11
+ import { InlineButton } from './InlineButton';
12
+ import { Popup } from './Popup';
13
+ import { MiddlePopup } from './MiddlePopup';
14
+ const DEFAULT_TITLE = 'Add to Calendar';
15
+ const ERROR_EVENT_ADD = 'There was a problem adding a calendar event.'; // Required: eventToAdd
16
+ // Documentation: https://docs.expo.dev/versions/latest/sdk/calendar/#event
17
+
18
+ class AddToCalendarButton extends Component {
19
+ constructor(props) {
20
+ super(props);
21
+
22
+ _defineProperty(this, "showWarningPopup", () => {
23
+ if (Platform.OS !== 'ios') return;
24
+ this.setState({
25
+ showPermissionWarning: true
26
+ });
27
+ });
28
+
29
+ _defineProperty(this, "closeWarningPopup", () => {
30
+ this.setState({
31
+ showPermissionWarning: false
32
+ });
33
+ });
34
+
35
+ _defineProperty(this, "goToPermissionSettings", () => {
36
+ Linking.openURL('app-settings:');
37
+ this.setState({
38
+ showPermissionWarning: false
39
+ });
40
+ });
41
+
42
+ _defineProperty(this, "onAdd", async () => {
43
+ if (!this.props.eventToAdd) {
44
+ this.setState({
45
+ message: 'There is no event to add'
46
+ });
47
+ return;
48
+ }
49
+
50
+ const {
51
+ status
52
+ } = await Calendar.requestCalendarPermissionsAsync();
53
+
54
+ if (status !== 'granted') {
55
+ this.showWarningPopup();
56
+ } else {
57
+ let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT); // console.log('all calendars', calendars);
58
+
59
+ if (calendars && calendars.length > 0) {
60
+ calendars = calendars.filter(c => c.allowsModifications).map(c => {
61
+ return {
62
+ id: c.id,
63
+ title: c.title,
64
+ source: c.source.name,
65
+ color: c.color,
66
+ type: c.type
67
+ };
68
+ });
69
+ calendars = _.orderBy(calendars, ['source', 'title']); // console.log('sorted calendars', calendars);
70
+ }
71
+
72
+ this.setState({
73
+ calendars
74
+ });
75
+ }
76
+ });
77
+
78
+ _defineProperty(this, "onCloseCalendars", () => {
79
+ this.setState({
80
+ calendars: null
81
+ });
82
+ });
83
+
84
+ _defineProperty(this, "onSelectCalendar", async calendar => {
85
+ try {
86
+ const {
87
+ eventToAdd
88
+ } = this.props;
89
+ if (!eventToAdd) return;
90
+ const eventId = await Calendar.createEventAsync(calendar.id, eventToAdd);
91
+ this.setState({
92
+ calendars: null,
93
+ message: eventId ? `${eventToAdd.title} was added to ${calendar.title} successfully.` : ERROR_EVENT_ADD
94
+ });
95
+ } catch (error) {
96
+ console.log('onSelectCalendar', error);
97
+ this.setState({
98
+ calendars: null,
99
+ message: ERROR_EVENT_ADD
100
+ });
101
+ }
102
+ });
103
+
104
+ _defineProperty(this, "onCloseMessage", () => {
105
+ this.setState({
106
+ message: null
107
+ });
108
+ });
109
+
110
+ this.state = {
111
+ showPermissionWarning: false,
112
+ calendars: null,
113
+ message: null
114
+ };
115
+ }
116
+
117
+ renderPermission() {
118
+ return /*#__PURE__*/React.createElement(Popup, {
119
+ title: "Permissions missing",
120
+ text: "You must grant access to the Calendars. Tap Go to settings to change your permission settings.",
121
+ options: [{
122
+ text: 'Go to settings',
123
+ action: this.goToPermissionSettings,
124
+ bold: true
125
+ }, {
126
+ text: 'Ignore',
127
+ action: this.closeWarningPopup
128
+ }]
129
+ });
130
+ }
131
+
132
+ renderCalendars(calendars) {
133
+ return /*#__PURE__*/React.createElement(MiddlePopup, {
134
+ style: [styles.calendarsPopup, {
135
+ height: calendars.length * 60 + 120
136
+ }],
137
+ onClose: this.onCloseCalendars
138
+ }, /*#__PURE__*/React.createElement(Text, {
139
+ style: styles.calendarPopupTitle
140
+ }, "Select Calendar"), /*#__PURE__*/React.createElement(View, {
141
+ style: styles.calendarPopupContainer
142
+ }, /*#__PURE__*/React.createElement(ScrollView, {
143
+ style: {
144
+ flex: 1
145
+ },
146
+ showsVerticalScrollIndicator: false
147
+ }, calendars.map(cal => {
148
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
149
+ key: cal.id,
150
+ onPress: () => this.onSelectCalendar(cal)
151
+ }, /*#__PURE__*/React.createElement(View, {
152
+ style: [styles.calendarContainer, {
153
+ backgroundColor: cal.color
154
+ }]
155
+ }, /*#__PURE__*/React.createElement(Text, {
156
+ style: styles.calendarText
157
+ }, `${cal.source}${cal.source === cal.title ? '' : `\n${cal.title}`}`)));
158
+ })), /*#__PURE__*/React.createElement(TouchableOpacity, {
159
+ key: 'cancel',
160
+ onPress: this.onCloseCalendars
161
+ }, /*#__PURE__*/React.createElement(View, {
162
+ style: [styles.calendarContainer, {
163
+ marginTop: 20,
164
+ backgroundColor: this.props.colourBrandingMain
165
+ }]
166
+ }, /*#__PURE__*/React.createElement(Text, {
167
+ style: styles.calendarText
168
+ }, "Cancel")))));
169
+ }
170
+
171
+ renderMessage(message) {
172
+ return /*#__PURE__*/React.createElement(Popup, {
173
+ title: "Add to Calendar",
174
+ text: message,
175
+ options: [{
176
+ text: 'Ok',
177
+ action: this.onCloseMessage
178
+ }]
179
+ });
180
+ }
181
+
182
+ render() {
183
+ const {
184
+ showPermissionWarning,
185
+ calendars,
186
+ message
187
+ } = this.state;
188
+ if (showPermissionWarning) return this.renderPermission();
189
+ if (calendars && calendars.length > 0) return this.renderCalendars(calendars);
190
+ if (message) return this.renderMessage(message);
191
+ return /*#__PURE__*/React.createElement(InlineButton, _extends({}, this.props, {
192
+ onPress: this.onAdd
193
+ }), this.props.children || DEFAULT_TITLE);
194
+ }
195
+
196
+ }
197
+
198
+ const styles = StyleSheet.create({
199
+ calendarsPopup: {
200
+ width: 250,
201
+ maxHeight: 400,
202
+ padding: 16,
203
+ borderRadius: 12
204
+ },
205
+ calendarPopupTitle: {
206
+ fontFamily: 'sf-bold',
207
+ color: TEXT_DARK,
208
+ fontSize: 18,
209
+ marginBottom: 16
210
+ },
211
+ calendarPopupContainer: {
212
+ flex: 1,
213
+ justifyContent: 'space-between'
214
+ },
215
+ calendarContainer: {
216
+ flexDirection: 'row',
217
+ alignItems: 'center',
218
+ width: 200,
219
+ height: 40,
220
+ paddingHorizontal: 8,
221
+ borderRadius: 4,
222
+ marginBottom: 10
223
+ },
224
+ calendarText: {
225
+ color: '#fff',
226
+ textAlign: 'center',
227
+ fontFamily: 'sf-semibold',
228
+ fontSize: 13,
229
+ flex: 1
230
+ }
231
+ });
232
+
233
+ const mapStateToProps = state => {
234
+ return {
235
+ colourBrandingMain: getMainBrandingColourFromState(state)
236
+ };
237
+ };
238
+
239
+ const button = connect(mapStateToProps, {})(AddToCalendarButton);
240
+ export { button as AddToCalendarButton };
241
+ //# sourceMappingURL=AddToCalendarButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AddToCalendarButton.js"],"names":["React","Component","Platform","Linking","StyleSheet","Text","View","TouchableOpacity","ScrollView","connect","_","Calendar","TEXT_DARK","getMainBrandingColourFromState","InlineButton","Popup","MiddlePopup","DEFAULT_TITLE","ERROR_EVENT_ADD","AddToCalendarButton","constructor","props","OS","setState","showPermissionWarning","openURL","eventToAdd","message","status","requestCalendarPermissionsAsync","showWarningPopup","calendars","getCalendarsAsync","EntityTypes","EVENT","length","filter","c","allowsModifications","map","id","title","source","name","color","type","orderBy","calendar","eventId","createEventAsync","error","console","log","state","renderPermission","text","action","goToPermissionSettings","bold","closeWarningPopup","renderCalendars","styles","calendarsPopup","height","onCloseCalendars","calendarPopupTitle","calendarPopupContainer","flex","cal","onSelectCalendar","calendarContainer","backgroundColor","calendarText","marginTop","colourBrandingMain","renderMessage","onCloseMessage","render","onAdd","children","create","width","maxHeight","padding","borderRadius","fontFamily","fontSize","marginBottom","justifyContent","flexDirection","alignItems","paddingHorizontal","textAlign","mapStateToProps","button"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,UAA5B,EAAwCC,IAAxC,EAA8CC,IAA9C,EAAoDC,gBAApD,EAAsEC,UAAtE,QAAwF,cAAxF;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,OAAO,KAAKC,QAAZ,MAA0B,eAA1B;AACA,SAASC,SAAT,EAAoBC,8BAApB,QAA0D,YAA1D;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,MAAMC,aAAa,GAAG,iBAAtB;AACA,MAAMC,eAAe,GAAG,8CAAxB,C,CAEA;AACA;;AACA,MAAMC,mBAAN,SAAkClB,SAAlC,CAA4C;AAC1CmB,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;;AADiB,8CAUA,MAAM;AACvB,UAAInB,QAAQ,CAACoB,EAAT,KAAgB,KAApB,EAA2B;AAC3B,WAAKC,QAAL,CAAc;AAAEC,QAAAA,qBAAqB,EAAE;AAAzB,OAAd;AACD,KAbkB;;AAAA,+CAeC,MAAM;AACxB,WAAKD,QAAL,CAAc;AAAEC,QAAAA,qBAAqB,EAAE;AAAzB,OAAd;AACD,KAjBkB;;AAAA,oDAmBM,MAAM;AAC7BrB,MAAAA,OAAO,CAACsB,OAAR,CAAgB,eAAhB;AACA,WAAKF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GADe;AAO/BnB,EAAAA,kBAAkB,EAAE;AAClBoB,IAAAA,UAAU,EAAE,SADM;AAElBzC,IAAAA,KAAK,EAAEhC,SAFW;AAGlB0E,IAAAA,QAAQ,EAAE,EAHQ;AAIlBC,IAAAA,YAAY,EAAE;AAJI,GAPW;AAa/BrB,EAAAA,sBAAsB,EAAE;AACtBC,IAAAA,IAAI,EAAE,CADgB;AAEtBqB,IAAAA,cAAc,EAAE;AAFM,GAbO;AAiB/BlB,EAAAA,iBAAiB,EAAE;AACjBmB,IAAAA,aAAa,EAAE,KADE;AAEjBC,IAAAA,UAAU,EAAE,QAFK;AAGjBT,IAAAA,KAAK,EAAE,GAHU;AAIjBlB,IAAAA,MAAM,EAAE,EAJS;AAKjB4B,IAAAA,iBAAiB,EAAE,CALF;AAMjBP,IAAAA,YAAY,EAAE,CANG;AAOjBG,IAAAA,YAAY,EAAE;AAPG,GAjBY;AA0B/Bf,EAAAA,YAAY,EAAE;AACZ5B,IAAAA,KAAK,EAAE,MADK;AAEZgD,IAAAA,SAAS,EAAE,QAFC;AAGZP,IAAAA,UAAU,EAAE,aAHA;AAIZC,IAAAA,QAAQ,EAAE,EAJE;AAKZnB,IAAAA,IAAI,EAAE;AALM;AA1BiB,CAAlB,CAAf;;AAmCA,MAAM0B,eAAe,GAAGxC,KAAK,IAAI;AAC/B,SAAO;AACLqB,IAAAA,kBAAkB,EAAE7D,8BAA8B,CAACwC,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMyC,MAAM,GAAGrF,OAAO,CAACoF,eAAD,EAAkB,EAAlB,CAAP,CAA6B1E,mBAA7B,CAAf;AACA,SAAS2E,MAAM,IAAI3E,mBAAnB","sourcesContent":["import React, { Component } from 'react';\nimport { Platform, Linking, StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';\nimport { connect } from 'react-redux';\nimport _ from 'lodash';\nimport * as Calendar from 'expo-calendar';\nimport { TEXT_DARK, getMainBrandingColourFromState } from '../colours';\nimport { InlineButton } from './InlineButton';\nimport { Popup } from './Popup';\nimport { MiddlePopup } from './MiddlePopup';\n\nconst DEFAULT_TITLE = 'Add to Calendar';\nconst ERROR_EVENT_ADD = 'There was a problem adding a calendar event.';\n\n// Required: eventToAdd\n// Documentation: https://docs.expo.dev/versions/latest/sdk/calendar/#event\nclass AddToCalendarButton extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n showPermissionWarning: false,\n calendars: null,\n message: null,\n };\n }\n\n showWarningPopup = () => {\n if (Platform.OS !== 'ios') return;\n this.setState({ showPermissionWarning: true });\n };\n\n closeWarningPopup = () => {\n this.setState({ showPermissionWarning: false });\n };\n\n goToPermissionSettings = () => {\n Linking.openURL('app-settings:');\n this.setState({ showPermissionWarning: false });\n };\n\n onAdd = async () => {\n if (!this.props.eventToAdd) {\n this.setState({ message: 'There is no event to add' });\n return;\n }\n\n const { status } = await Calendar.requestCalendarPermissionsAsync();\n if (status !== 'granted') {\n this.showWarningPopup();\n } else {\n let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT);\n // console.log('all calendars', calendars);\n if (calendars && calendars.length > 0) {\n calendars = calendars\n .filter(c => c.allowsModifications)\n .map(c => {\n return {\n id: c.id,\n title: c.title,\n source: c.source.name,\n color: c.color,\n type: c.type,\n };\n });\n calendars = _.orderBy(calendars, ['source', 'title']);\n // console.log('sorted calendars', calendars);\n }\n this.setState({ calendars });\n }\n };\n\n onCloseCalendars = () => {\n this.setState({ calendars: null });\n };\n\n onSelectCalendar = async calendar => {\n try {\n const { eventToAdd } = this.props;\n if (!eventToAdd) return;\n\n const eventId = await Calendar.createEventAsync(calendar.id, eventToAdd);\n\n this.setState({\n calendars: null,\n message: eventId ? `${eventToAdd.title} was added to ${calendar.title} successfully.` : ERROR_EVENT_ADD,\n });\n } catch (error) {\n console.log('onSelectCalendar', error);\n this.setState({ calendars: null, message: ERROR_EVENT_ADD });\n }\n };\n\n onCloseMessage = () => {\n this.setState({ message: null });\n };\n\n renderPermission() {\n return (\n <Popup\n title=\"Permissions missing\"\n text=\"You must grant access to the Calendars. Tap Go to settings to change your permission settings.\"\n options={[\n {\n text: 'Go to settings',\n action: this.goToPermissionSettings,\n bold: true,\n },\n {\n text: 'Ignore',\n action: this.closeWarningPopup,\n },\n ]}\n />\n );\n }\n\n renderCalendars(calendars) {\n return (\n <MiddlePopup style={[styles.calendarsPopup, { height: calendars.length * 60 + 120 }]} onClose={this.onCloseCalendars}>\n <Text style={styles.calendarPopupTitle}>Select Calendar</Text>\n <View style={styles.calendarPopupContainer}>\n <ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>\n {calendars.map(cal => {\n return (\n <TouchableOpacity key={cal.id} onPress={() => this.onSelectCalendar(cal)}>\n <View style={[styles.calendarContainer, { backgroundColor: cal.color }]}>\n <Text style={styles.calendarText}>{`${cal.source}${cal.source === cal.title ? '' : `\\n${cal.title}`}`}</Text>\n </View>\n </TouchableOpacity>\n );\n })}\n </ScrollView>\n <TouchableOpacity key={'cancel'} onPress={this.onCloseCalendars}>\n <View style={[styles.calendarContainer, { marginTop: 20, backgroundColor: this.props.colourBrandingMain }]}>\n <Text style={styles.calendarText}>Cancel</Text>\n </View>\n </TouchableOpacity>\n </View>\n </MiddlePopup>\n );\n }\n\n renderMessage(message) {\n return (\n <Popup\n title=\"Add to Calendar\"\n text={message}\n options={[\n {\n text: 'Ok',\n action: this.onCloseMessage,\n },\n ]}\n />\n );\n }\n\n render() {\n const { showPermissionWarning, calendars, message } = this.state;\n\n if (showPermissionWarning) return this.renderPermission();\n if (calendars && calendars.length > 0) return this.renderCalendars(calendars);\n if (message) return this.renderMessage(message);\n\n return (\n <InlineButton {...this.props} onPress={this.onAdd}>\n {this.props.children || DEFAULT_TITLE}\n </InlineButton>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n calendarsPopup: {\n width: 250,\n maxHeight: 400,\n padding: 16,\n borderRadius: 12,\n },\n calendarPopupTitle: {\n fontFamily: 'sf-bold',\n color: TEXT_DARK,\n fontSize: 18,\n marginBottom: 16,\n },\n calendarPopupContainer: {\n flex: 1,\n justifyContent: 'space-between',\n },\n calendarContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: 200,\n height: 40,\n paddingHorizontal: 8,\n borderRadius: 4,\n marginBottom: 10,\n },\n calendarText: {\n color: '#fff',\n textAlign: 'center',\n fontFamily: 'sf-semibold',\n fontSize: 13,\n flex: 1,\n },\n});\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst button = connect(mapStateToProps, {})(AddToCalendarButton);\nexport { button as AddToCalendarButton };\n"]}
@@ -2,8 +2,7 @@ import React, { Component } from 'react';
2
2
  import { View, Text, TouchableWithoutFeedback, Modal } from 'react-native';
3
3
  import _ from 'lodash';
4
4
  import { connect } from 'react-redux';
5
- import { LINEGREY, TEXT_DARK, TEXT_LIGHT } from '../colours';
6
- import { getMainBrandingColourFromState } from '../helper';
5
+ import { LINEGREY, TEXT_DARK, TEXT_LIGHT, getMainBrandingColourFromState } from '../colours';
7
6
  import { InlineButton } from './InlineButton';
8
7
 
9
8
  class Popup extends Component {
@@ -1 +1 @@
1
- {"version":3,"sources":["Popup.js"],"names":["React","Component","View","Text","TouchableWithoutFeedback","Modal","_","connect","LINEGREY","TEXT_DARK","TEXT_LIGHT","getMainBrandingColourFromState","InlineButton","Popup","renderOptions","props","options","styles","bottom","map","option","index","action","optionText","color","colourBrandingMain","bold","optionTextBold","text","renderTitle","title","renderContent","content","render","onClose","container","menu","containerStyle","top","children","position","left","right","backgroundColor","zIndex","paddingHorizontal","paddingVertical","justifyContent","alignItems","width","borderRadius","padding","fontFamily","fontSize","lineHeight","textAlign","marginBottom","borderTopColor","borderTopWidth","flexDirection","marginRight","mapStateToProps","state","popup"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,wBAArB,EAA+CC,KAA/C,QAA4D,cAA5D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,kBAAkB,EAAEd,8BAA8B,CAACmD,KAAD;AAD7C,GAAP;AAGD,CAJD;;AAMA,MAAMC,KAAK,GAAGxD,OAAO,CAACsD,eAAD,EAAkB,EAAlB,CAAP,CAA6BhD,KAA7B,CAAd;AACA,SAASkD,KAAK,IAAIlD,KAAlB","sourcesContent":["import React, { Component } from 'react';\nimport { View, Text, TouchableWithoutFeedback, Modal } from 'react-native';\nimport _ from 'lodash';\nimport { connect } from 'react-redux';\nimport { LINEGREY, TEXT_DARK, TEXT_LIGHT } from '../colours';\nimport { getMainBrandingColourFromState } from '../helper';\nimport { InlineButton } from './InlineButton';\n\nclass Popup extends Component {\n renderOptions() {\n if (!this.props.options) {\n return null;\n }\n return (\n <View style={styles.bottom}>\n {_.map(this.props.options, (option, index) => {\n return (\n <InlineButton\n key={index}\n onPress={option.action}\n color=\"#fff\"\n textStyle={[styles.optionText, { color: this.props.colourBrandingMain }, option.bold && styles.optionTextBold]}\n >\n {option.text}\n </InlineButton>\n );\n })}\n </View>\n );\n }\n\n renderTitle() {\n if (!this.props.title) {\n return null;\n }\n return <Text style={[styles.title, { color: this.props.colourBrandingMain }]}>{this.props.title}</Text>;\n }\n\n renderContent() {\n if (this.props.content) {\n return this.props.content;\n }\n if (!this.props.text) {\n return null;\n }\n return <Text style={styles.text}>{this.props.text}</Text>;\n }\n\n render() {\n return (\n <Modal visible transparent animationType=\"fade\" onRequestClose={this.props.onClose}>\n <TouchableWithoutFeedback style={styles.container} onPress={this.props.onClose}>\n <View style={styles.container}>\n <View style={[styles.menu, this.props.containerStyle]}>\n <View style={styles.top}>\n {this.renderTitle()}\n {this.renderContent()}\n {this.props.children}\n </View>\n {this.renderOptions()}\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 paddingHorizontal: 16,\n paddingVertical: 32,\n justifyContent: 'center',\n alignItems: 'center',\n width: '100%',\n },\n menu: {\n backgroundColor: '#fff',\n borderRadius: 12,\n },\n top: {\n padding: 24,\n },\n title: {\n fontFamily: 'sf-bold',\n fontSize: 24,\n lineHeight: 24,\n color: TEXT_DARK,\n textAlign: 'center',\n marginBottom: 16,\n },\n text: {\n fontFamily: 'sf-regular',\n fontSize: 16,\n lineHeight: 22,\n color: TEXT_LIGHT,\n textAlign: 'center',\n },\n bottom: {\n borderTopColor: LINEGREY,\n borderTopWidth: 1,\n flexDirection: 'row-reverse',\n padding: 8,\n },\n option: {\n marginRight: 16,\n },\n optionText: {\n fontFamily: 'sf-regular',\n fontSize: 16,\n },\n optionTextBold: {\n fontFamily: 'sf-semibold',\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst popup = connect(mapStateToProps, {})(Popup);\nexport { popup as Popup };\n"]}
1
+ {"version":3,"sources":["Popup.js"],"names":["React","Component","View","Text","TouchableWithoutFeedback","Modal","_","connect","LINEGREY","TEXT_DARK","TEXT_LIGHT","getMainBrandingColourFromState","InlineButton","Popup","renderOptions","props","options","styles","bottom","map","option","index","action","optionText","color","colourBrandingMain","bold","optionTextBold","text","renderTitle","title","renderContent","content","render","onClose","container","menu","containerStyle","top","children","position","left","right","backgroundColor","zIndex","paddingHorizontal","paddingVertical","justifyContent","alignItems","width","borderRadius","padding","fontFamily","fontSize","lineHeight","textAlign","marginBottom","borderTopColor","borderTopWidth","flexDirection","marginRight","mapStateToProps","state","popup"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,wBAArB,EAA+CC,KAA/C,QAA4D,cAA5D;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,SAASC,OAAT,QAAwB,aAAxB;AACA,SAASC,QAAT,EAAmBC,SAAnB,EAA8BC,UAA9B,EAA0CC,8BAA1C,QA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7B,CAAd;AACA,SAASkD,KAAK,IAAIlD,KAAlB","sourcesContent":["import React, { Component } from 'react';\nimport { View, Text, TouchableWithoutFeedback, Modal } from 'react-native';\nimport _ from 'lodash';\nimport { connect } from 'react-redux';\nimport { LINEGREY, TEXT_DARK, TEXT_LIGHT, getMainBrandingColourFromState } from '../colours';\nimport { InlineButton } from './InlineButton';\n\nclass Popup extends Component {\n renderOptions() {\n if (!this.props.options) {\n return null;\n }\n return (\n <View style={styles.bottom}>\n {_.map(this.props.options, (option, index) => {\n return (\n <InlineButton\n key={index}\n onPress={option.action}\n color=\"#fff\"\n textStyle={[styles.optionText, { color: this.props.colourBrandingMain }, option.bold && styles.optionTextBold]}\n >\n {option.text}\n </InlineButton>\n );\n })}\n </View>\n );\n }\n\n renderTitle() {\n if (!this.props.title) {\n return null;\n }\n return <Text style={[styles.title, { color: this.props.colourBrandingMain }]}>{this.props.title}</Text>;\n }\n\n renderContent() {\n if (this.props.content) {\n return this.props.content;\n }\n if (!this.props.text) {\n return null;\n }\n return <Text style={styles.text}>{this.props.text}</Text>;\n }\n\n render() {\n return (\n <Modal visible transparent animationType=\"fade\" onRequestClose={this.props.onClose}>\n <TouchableWithoutFeedback style={styles.container} onPress={this.props.onClose}>\n <View style={styles.container}>\n <View style={[styles.menu, this.props.containerStyle]}>\n <View style={styles.top}>\n {this.renderTitle()}\n {this.renderContent()}\n {this.props.children}\n </View>\n {this.renderOptions()}\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 paddingHorizontal: 16,\n paddingVertical: 32,\n justifyContent: 'center',\n alignItems: 'center',\n width: '100%',\n },\n menu: {\n backgroundColor: '#fff',\n borderRadius: 12,\n },\n top: {\n padding: 24,\n },\n title: {\n fontFamily: 'sf-bold',\n fontSize: 24,\n lineHeight: 24,\n color: TEXT_DARK,\n textAlign: 'center',\n marginBottom: 16,\n },\n text: {\n fontFamily: 'sf-regular',\n fontSize: 16,\n lineHeight: 22,\n color: TEXT_LIGHT,\n textAlign: 'center',\n },\n bottom: {\n borderTopColor: LINEGREY,\n borderTopWidth: 1,\n flexDirection: 'row-reverse',\n padding: 8,\n },\n option: {\n marginRight: 16,\n },\n optionText: {\n fontFamily: 'sf-regular',\n fontSize: 16,\n },\n optionTextBold: {\n fontFamily: 'sf-semibold',\n },\n};\n\nconst mapStateToProps = state => {\n return {\n colourBrandingMain: getMainBrandingColourFromState(state),\n };\n};\n\nconst popup = connect(mapStateToProps, {})(Popup);\nexport { popup as Popup };\n"]}
@@ -1,4 +1,5 @@
1
1
  export * from './InlineButton';
2
+ export * from './AddToCalendarButton';
2
3
  export * from './FormCard';
3
4
  export * from './FormCardSection';
4
5
  export * from './FormCardSectionOptionLauncher';
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"names":["default","EmptyStateWidget","EmptyStateMain","LoadingStateWidget","Header","LoadingIndicator","ImageUploader","ImageUploadProgress","UserListing","PlussChat","PositionedImage","FormattedText","MediaPlayer","AudienceSelectorPage"],"mappings":"AAAA,cAAc,gBAAd;AACA,cAAc,YAAd;AACA,cAAc,mBAAd;AACA,cAAc,iCAAd;AACA,cAAc,cAAd;AACA,cAAc,WAAd;AACA,cAAc,kBAAd;AACA,cAAc,SAAd;AACA,cAAc,cAAd;AACA,cAAc,cAAd;AACA,cAAc,gBAAd;AACA,cAAc,eAAd;AACA,cAAc,gBAAd;AACA,cAAc,qBAAd;AACA,cAAc,kBAAd;AACA,cAAc,gBAAd;AACA,cAAc,aAAd;AACA,cAAc,aAAd;AACA,cAAc,cAAd;AACA,cAAc,uBAAd;AACA,cAAc,gBAAd;AACA,cAAc,eAAd;AACA,cAAc,YAAd;AACA,cAAc,aAAd;AACA,cAAc,UAAd;AACA,cAAc,SAAd;AACA,cAAc,gBAAd;AACA,cAAc,gBAAd;AACA,cAAc,gBAAd;AACA,cAAc,gBAAd;AACA,cAAc,cAAd;AACA,cAAc,YAAd;AACA,cAAc,sBAAd;AACA,cAAc,gBAAd;AACA,cAAc,kBAAd;AACA,cAAc,mBAAd;AACA,cAAc,iBAAd;AACA,cAAc,aAAd;AACA,cAAc,4BAAd;AACA,SAASA,OAAO,IAAIC,gBAApB,QAA4C,oBAA5C;AACA,SAASD,OAAO,IAAIE,cAApB,QAA0C,kBAA1C;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,sBAA9C;AACA,SAASH,OAAO,IAAII,MAApB,QAAkC,UAAlC;AACA,SAASJ,OAAO,IAAIK,gBAApB,QAA4C,oBAA5C;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,iBAAzC;AACA,SAASN,OAAO,IAAIO,mBAApB,QAA+C,uBAA/C;AACA,SAASP,OAAO,IAAIQ,WAApB,QAAuC,eAAvC;AACA,SAASR,OAAO,IAAIS,SAApB,QAAqC,aAArC;AACA,SAAST,OAAO,IAAIU,eAApB,QAA2C,mBAA3C;AACA,SAASV,OAAO,IAAIW,aAApB,QAAyC,iBAAzC;AACA,SAASX,OAAO,IAAIY,WAApB,QAAuC,eAAvC;AACA,SAASZ,OAAO,IAAIa,oBAApB,QAAgD,wBAAhD","sourcesContent":["export * from './InlineButton';\nexport * from './FormCard';\nexport * from './FormCardSection';\nexport * from './FormCardSectionOptionLauncher';\nexport * from './ProfilePic';\nexport * from './Spinner';\nexport * from './LoadingCircles';\nexport * from './Popup';\nexport * from './ImagePopup';\nexport * from './VideoPopup';\nexport * from './SharingTools';\nexport * from './MiddlePopup';\nexport * from './ConfirmPopup';\nexport * from './ConfirmationPopup';\nexport * from './CommentSection';\nexport * from './CommentReply';\nexport * from './PopupMenu';\nexport * from './AddButton';\nexport * from './Attachment';\nexport * from './GenericInputSection';\nexport * from './GenericInput';\nexport * from './RadioButton';\nexport * from './PDFPopup';\nexport * from './TextStyle';\nexport * from './Toggle';\nexport * from './Input';\nexport * from './StickyFooter';\nexport * from './CategoryTabs';\nexport * from './DropDownMenu';\nexport * from './DropDownItem';\nexport * from './BackButton';\nexport * from './Reaction';\nexport * from './TouchableSearchBar';\nexport * from './WarningPopup';\nexport * from './FontScalePopup';\nexport * from './FontScaleButton';\nexport * from './UserListPopup';\nexport * from './Reactions';\nexport * from './AudienceSelectorLauncher';\nexport { default as EmptyStateWidget } from './EmptyStateWidget';\nexport { default as EmptyStateMain } from './EmptyStateMain';\nexport { default as LoadingStateWidget } from './LoadingStateWidget';\nexport { default as Header } from './Header';\nexport { default as LoadingIndicator } from './LoadingIndicator';\nexport { default as ImageUploader } from './ImageUploader';\nexport { default as ImageUploadProgress } from './ImageUploadProgress';\nexport { default as UserListing } from './UserListing';\nexport { default as PlussChat } from './PlussChat';\nexport { default as PositionedImage } from './PositionedImage';\nexport { default as FormattedText } from './FormattedText';\nexport { default as MediaPlayer } from './MediaPlayer';\nexport { default as AudienceSelectorPage } from './AudienceSelectorPage';\n"]}
1
+ {"version":3,"sources":["index.js"],"names":["default","EmptyStateWidget","EmptyStateMain","LoadingStateWidget","Header","LoadingIndicator","ImageUploader","ImageUploadProgress","UserListing","PlussChat","PositionedImage","FormattedText","MediaPlayer","AudienceSelectorPage"],"mappings":"AAAA,cAAc,gBAAd;AACA,cAAc,uBAAd;AACA,cAAc,YAAd;AACA,cAAc,mBAAd;AACA,cAAc,iCAAd;AACA,cAAc,cAAd;AACA,cAAc,WAAd;AACA,cAAc,kBAAd;AACA,cAAc,SAAd;AACA,cAAc,cAAd;AACA,cAAc,cAAd;AACA,cAAc,gBAAd;AACA,cAAc,eAAd;AACA,cAAc,gBAAd;AACA,cAAc,qBAAd;AACA,cAAc,kBAAd;AACA,cAAc,gBAAd;AACA,cAAc,aAAd;AACA,cAAc,aAAd;AACA,cAAc,cAAd;AACA,cAAc,uBAAd;AACA,cAAc,gBAAd;AACA,cAAc,eAAd;AACA,cAAc,YAAd;AACA,cAAc,aAAd;AACA,cAAc,UAAd;AACA,cAAc,SAAd;AACA,cAAc,gBAAd;AACA,cAAc,gBAAd;AACA,cAAc,gBAAd;AACA,cAAc,gBAAd;AACA,cAAc,cAAd;AACA,cAAc,YAAd;AACA,cAAc,sBAAd;AACA,cAAc,gBAAd;AACA,cAAc,kBAAd;AACA,cAAc,mBAAd;AACA,cAAc,iBAAd;AACA,cAAc,aAAd;AACA,cAAc,4BAAd;AACA,SAASA,OAAO,IAAIC,gBAApB,QAA4C,oBAA5C;AACA,SAASD,OAAO,IAAIE,cAApB,QAA0C,kBAA1C;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,sBAA9C;AACA,SAASH,OAAO,IAAII,MAApB,QAAkC,UAAlC;AACA,SAASJ,OAAO,IAAIK,gBAApB,QAA4C,oBAA5C;AACA,SAASL,OAAO,IAAIM,aAApB,QAAyC,iBAAzC;AACA,SAASN,OAAO,IAAIO,mBAApB,QAA+C,uBAA/C;AACA,SAASP,OAAO,IAAIQ,WAApB,QAAuC,eAAvC;AACA,SAASR,OAAO,IAAIS,SAApB,QAAqC,aAArC;AACA,SAAST,OAAO,IAAIU,eAApB,QAA2C,mBAA3C;AACA,SAASV,OAAO,IAAIW,aAApB,QAAyC,iBAAzC;AACA,SAASX,OAAO,IAAIY,WAApB,QAAuC,eAAvC;AACA,SAASZ,OAAO,IAAIa,oBAApB,QAAgD,wBAAhD","sourcesContent":["export * from './InlineButton';\nexport * from './AddToCalendarButton';\nexport * from './FormCard';\nexport * from './FormCardSection';\nexport * from './FormCardSectionOptionLauncher';\nexport * from './ProfilePic';\nexport * from './Spinner';\nexport * from './LoadingCircles';\nexport * from './Popup';\nexport * from './ImagePopup';\nexport * from './VideoPopup';\nexport * from './SharingTools';\nexport * from './MiddlePopup';\nexport * from './ConfirmPopup';\nexport * from './ConfirmationPopup';\nexport * from './CommentSection';\nexport * from './CommentReply';\nexport * from './PopupMenu';\nexport * from './AddButton';\nexport * from './Attachment';\nexport * from './GenericInputSection';\nexport * from './GenericInput';\nexport * from './RadioButton';\nexport * from './PDFPopup';\nexport * from './TextStyle';\nexport * from './Toggle';\nexport * from './Input';\nexport * from './StickyFooter';\nexport * from './CategoryTabs';\nexport * from './DropDownMenu';\nexport * from './DropDownItem';\nexport * from './BackButton';\nexport * from './Reaction';\nexport * from './TouchableSearchBar';\nexport * from './WarningPopup';\nexport * from './FontScalePopup';\nexport * from './FontScaleButton';\nexport * from './UserListPopup';\nexport * from './Reactions';\nexport * from './AudienceSelectorLauncher';\nexport { default as EmptyStateWidget } from './EmptyStateWidget';\nexport { default as EmptyStateMain } from './EmptyStateMain';\nexport { default as LoadingStateWidget } from './LoadingStateWidget';\nexport { default as Header } from './Header';\nexport { default as LoadingIndicator } from './LoadingIndicator';\nexport { default as ImageUploader } from './ImageUploader';\nexport { default as ImageUploadProgress } from './ImageUploadProgress';\nexport { default as UserListing } from './UserListing';\nexport { default as PlussChat } from './PlussChat';\nexport { default as PositionedImage } from './PositionedImage';\nexport { default as FormattedText } from './FormattedText';\nexport { default as MediaPlayer } from './MediaPlayer';\nexport { default as AudienceSelectorPage } from './AudienceSelectorPage';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-core-app",
3
- "version": "1.5.5",
3
+ "version": "1.5.7-beta.0",
4
4
  "description": "Core extension package for Pluss Communities platform",
5
5
  "main": "dist/module/index.js",
6
6
  "module": "dist/module/index.js",
@@ -10,7 +10,7 @@
10
10
  "src/"
11
11
  ],
12
12
  "scripts": {
13
- "build": "bob build",
13
+ "build": "npm i && bob build",
14
14
  "betapatch": "npm version prepatch --preid=beta",
15
15
  "patch": "npm version patch",
16
16
  "betaupload": "npm run build && npm publish --access public --tag beta",
@@ -28,11 +28,12 @@
28
28
  "aws-amplify": "^4.3.11",
29
29
  "aws-amplify-react-native": "^6.0.2",
30
30
  "expo-av": "~10.2.0",
31
+ "expo-calendar": "~10.1.0",
31
32
  "expo-constants": "~13.0.0",
32
- "expo-file-system": "~13.1.0",
33
+ "expo-file-system": "~13.1.4",
33
34
  "expo-image-manipulator": "~10.2.0",
34
35
  "expo-image-picker": "~12.0.1",
35
- "expo-linear-gradient": "~11.0.0",
36
+ "expo-linear-gradient": "~11.0.3",
36
37
  "expo-media-library": "~14.0.0",
37
38
  "expo-screen-orientation": "~4.1.1",
38
39
  "expo-sharing": "~10.1.0",
@@ -0,0 +1,215 @@
1
+ import React, { Component } from 'react';
2
+ import { Platform, Linking, StyleSheet, Text, View, TouchableOpacity, ScrollView } from 'react-native';
3
+ import { connect } from 'react-redux';
4
+ import _ from 'lodash';
5
+ import * as Calendar from 'expo-calendar';
6
+ import { TEXT_DARK, getMainBrandingColourFromState } from '../colours';
7
+ import { InlineButton } from './InlineButton';
8
+ import { Popup } from './Popup';
9
+ import { MiddlePopup } from './MiddlePopup';
10
+
11
+ const DEFAULT_TITLE = 'Add to Calendar';
12
+ const ERROR_EVENT_ADD = 'There was a problem adding a calendar event.';
13
+
14
+ // Required: eventToAdd
15
+ // Documentation: https://docs.expo.dev/versions/latest/sdk/calendar/#event
16
+ class AddToCalendarButton extends Component {
17
+ constructor(props) {
18
+ super(props);
19
+
20
+ this.state = {
21
+ showPermissionWarning: false,
22
+ calendars: null,
23
+ message: null,
24
+ };
25
+ }
26
+
27
+ showWarningPopup = () => {
28
+ if (Platform.OS !== 'ios') return;
29
+ this.setState({ showPermissionWarning: true });
30
+ };
31
+
32
+ closeWarningPopup = () => {
33
+ this.setState({ showPermissionWarning: false });
34
+ };
35
+
36
+ goToPermissionSettings = () => {
37
+ Linking.openURL('app-settings:');
38
+ this.setState({ showPermissionWarning: false });
39
+ };
40
+
41
+ onAdd = async () => {
42
+ if (!this.props.eventToAdd) {
43
+ this.setState({ message: 'There is no event to add' });
44
+ return;
45
+ }
46
+
47
+ const { status } = await Calendar.requestCalendarPermissionsAsync();
48
+ if (status !== 'granted') {
49
+ this.showWarningPopup();
50
+ } else {
51
+ let calendars = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT);
52
+ // console.log('all calendars', calendars);
53
+ if (calendars && calendars.length > 0) {
54
+ calendars = calendars
55
+ .filter(c => c.allowsModifications)
56
+ .map(c => {
57
+ return {
58
+ id: c.id,
59
+ title: c.title,
60
+ source: c.source.name,
61
+ color: c.color,
62
+ type: c.type,
63
+ };
64
+ });
65
+ calendars = _.orderBy(calendars, ['source', 'title']);
66
+ // console.log('sorted calendars', calendars);
67
+ }
68
+ this.setState({ calendars });
69
+ }
70
+ };
71
+
72
+ onCloseCalendars = () => {
73
+ this.setState({ calendars: null });
74
+ };
75
+
76
+ onSelectCalendar = async calendar => {
77
+ try {
78
+ const { eventToAdd } = this.props;
79
+ if (!eventToAdd) return;
80
+
81
+ const eventId = await Calendar.createEventAsync(calendar.id, eventToAdd);
82
+
83
+ this.setState({
84
+ calendars: null,
85
+ message: eventId ? `${eventToAdd.title} was added to ${calendar.title} successfully.` : ERROR_EVENT_ADD,
86
+ });
87
+ } catch (error) {
88
+ console.log('onSelectCalendar', error);
89
+ this.setState({ calendars: null, message: ERROR_EVENT_ADD });
90
+ }
91
+ };
92
+
93
+ onCloseMessage = () => {
94
+ this.setState({ message: null });
95
+ };
96
+
97
+ renderPermission() {
98
+ return (
99
+ <Popup
100
+ title="Permissions missing"
101
+ text="You must grant access to the Calendars. Tap Go to settings to change your permission settings."
102
+ options={[
103
+ {
104
+ text: 'Go to settings',
105
+ action: this.goToPermissionSettings,
106
+ bold: true,
107
+ },
108
+ {
109
+ text: 'Ignore',
110
+ action: this.closeWarningPopup,
111
+ },
112
+ ]}
113
+ />
114
+ );
115
+ }
116
+
117
+ renderCalendars(calendars) {
118
+ return (
119
+ <MiddlePopup style={[styles.calendarsPopup, { height: calendars.length * 60 + 120 }]} onClose={this.onCloseCalendars}>
120
+ <Text style={styles.calendarPopupTitle}>Select Calendar</Text>
121
+ <View style={styles.calendarPopupContainer}>
122
+ <ScrollView style={{ flex: 1 }} showsVerticalScrollIndicator={false}>
123
+ {calendars.map(cal => {
124
+ return (
125
+ <TouchableOpacity key={cal.id} onPress={() => this.onSelectCalendar(cal)}>
126
+ <View style={[styles.calendarContainer, { backgroundColor: cal.color }]}>
127
+ <Text style={styles.calendarText}>{`${cal.source}${cal.source === cal.title ? '' : `\n${cal.title}`}`}</Text>
128
+ </View>
129
+ </TouchableOpacity>
130
+ );
131
+ })}
132
+ </ScrollView>
133
+ <TouchableOpacity key={'cancel'} onPress={this.onCloseCalendars}>
134
+ <View style={[styles.calendarContainer, { marginTop: 20, backgroundColor: this.props.colourBrandingMain }]}>
135
+ <Text style={styles.calendarText}>Cancel</Text>
136
+ </View>
137
+ </TouchableOpacity>
138
+ </View>
139
+ </MiddlePopup>
140
+ );
141
+ }
142
+
143
+ renderMessage(message) {
144
+ return (
145
+ <Popup
146
+ title="Add to Calendar"
147
+ text={message}
148
+ options={[
149
+ {
150
+ text: 'Ok',
151
+ action: this.onCloseMessage,
152
+ },
153
+ ]}
154
+ />
155
+ );
156
+ }
157
+
158
+ render() {
159
+ const { showPermissionWarning, calendars, message } = this.state;
160
+
161
+ if (showPermissionWarning) return this.renderPermission();
162
+ if (calendars && calendars.length > 0) return this.renderCalendars(calendars);
163
+ if (message) return this.renderMessage(message);
164
+
165
+ return (
166
+ <InlineButton {...this.props} onPress={this.onAdd}>
167
+ {this.props.children || DEFAULT_TITLE}
168
+ </InlineButton>
169
+ );
170
+ }
171
+ }
172
+
173
+ const styles = StyleSheet.create({
174
+ calendarsPopup: {
175
+ width: 250,
176
+ maxHeight: 400,
177
+ padding: 16,
178
+ borderRadius: 12,
179
+ },
180
+ calendarPopupTitle: {
181
+ fontFamily: 'sf-bold',
182
+ color: TEXT_DARK,
183
+ fontSize: 18,
184
+ marginBottom: 16,
185
+ },
186
+ calendarPopupContainer: {
187
+ flex: 1,
188
+ justifyContent: 'space-between',
189
+ },
190
+ calendarContainer: {
191
+ flexDirection: 'row',
192
+ alignItems: 'center',
193
+ width: 200,
194
+ height: 40,
195
+ paddingHorizontal: 8,
196
+ borderRadius: 4,
197
+ marginBottom: 10,
198
+ },
199
+ calendarText: {
200
+ color: '#fff',
201
+ textAlign: 'center',
202
+ fontFamily: 'sf-semibold',
203
+ fontSize: 13,
204
+ flex: 1,
205
+ },
206
+ });
207
+
208
+ const mapStateToProps = state => {
209
+ return {
210
+ colourBrandingMain: getMainBrandingColourFromState(state),
211
+ };
212
+ };
213
+
214
+ const button = connect(mapStateToProps, {})(AddToCalendarButton);
215
+ export { button as AddToCalendarButton };
@@ -2,8 +2,7 @@ import React, { Component } from 'react';
2
2
  import { View, Text, TouchableWithoutFeedback, Modal } from 'react-native';
3
3
  import _ from 'lodash';
4
4
  import { connect } from 'react-redux';
5
- import { LINEGREY, TEXT_DARK, TEXT_LIGHT } from '../colours';
6
- import { getMainBrandingColourFromState } from '../helper';
5
+ import { LINEGREY, TEXT_DARK, TEXT_LIGHT, getMainBrandingColourFromState } from '../colours';
7
6
  import { InlineButton } from './InlineButton';
8
7
 
9
8
  class Popup extends Component {
@@ -1,4 +1,5 @@
1
1
  export * from './InlineButton';
2
+ export * from './AddToCalendarButton';
2
3
  export * from './FormCard';
3
4
  export * from './FormCardSection';
4
5
  export * from './FormCardSectionOptionLauncher';