@plusscommunities/pluss-core-app 8.0.0 → 8.0.1-auth.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.
- package/dist/module/actions/FollowerActions.js +4 -4
- package/dist/module/actions/FollowerActions.js.map +1 -1
- package/dist/module/actions/MediaActions.js +1 -1
- package/dist/module/actions/MediaActions.js.map +1 -1
- package/dist/module/actions/ResidentActions.js +1 -1
- package/dist/module/actions/ResidentActions.js.map +1 -1
- package/dist/module/actions/UserActions.js +1 -1
- package/dist/module/actions/UserActions.js.map +1 -1
- package/dist/module/actions/UserSettingsActions.js +1 -1
- package/dist/module/actions/UserSettingsActions.js.map +1 -1
- package/dist/module/actions/index.js +5 -5
- package/dist/module/actions/index.js.map +1 -1
- package/dist/module/actions/types.js +16 -16
- package/dist/module/actions/types.js.map +1 -1
- package/dist/module/apis/analyticsActions.js +5 -5
- package/dist/module/apis/analyticsActions.js.map +1 -1
- package/dist/module/apis/contactActions.js +6 -6
- package/dist/module/apis/contactActions.js.map +1 -1
- package/dist/module/apis/eventActions.js +28 -28
- package/dist/module/apis/eventActions.js.map +1 -1
- package/dist/module/apis/fileActions.js +15 -15
- package/dist/module/apis/fileActions.js.map +1 -1
- package/dist/module/apis/followerActions.js +8 -8
- package/dist/module/apis/followerActions.js.map +1 -1
- package/dist/module/apis/index.js +12 -12
- package/dist/module/apis/index.js.map +1 -1
- package/dist/module/apis/notificationActions.js +17 -17
- package/dist/module/apis/notificationActions.js.map +1 -1
- package/dist/module/apis/profileActions.js +4 -4
- package/dist/module/apis/profileActions.js.map +1 -1
- package/dist/module/apis/reactionActions.js +15 -15
- package/dist/module/apis/reactionActions.js.map +1 -1
- package/dist/module/apis/settingActions.js +6 -6
- package/dist/module/apis/settingActions.js.map +1 -1
- package/dist/module/apis/stringActions.js +8 -8
- package/dist/module/apis/stringActions.js.map +1 -1
- package/dist/module/apis/typeActions.js +4 -4
- package/dist/module/apis/typeActions.js.map +1 -1
- package/dist/module/apis/userActions.js +8 -8
- package/dist/module/apis/userActions.js.map +1 -1
- package/dist/module/assets/icons/fontawesome/fa-brands-400.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-light-300.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-regular-400.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-solid-900.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa-thin-100.ttf +0 -0
- package/dist/module/assets/icons/fontawesome/fa7-glyphmap.json +4205 -0
- package/dist/module/colours.js +26 -29
- package/dist/module/colours.js.map +1 -1
- package/dist/module/components/AddButton.js +8 -8
- package/dist/module/components/AddButton.js.map +1 -1
- package/dist/module/components/AddToCalendarButton.js +30 -29
- package/dist/module/components/AddToCalendarButton.js.map +1 -1
- package/dist/module/components/Attachment.js +10 -9
- package/dist/module/components/Attachment.js.map +1 -1
- package/dist/module/components/AudienceSelectorLauncher.js +11 -11
- package/dist/module/components/AudienceSelectorLauncher.js.map +1 -1
- package/dist/module/components/AudienceSelectorPage.js +45 -44
- package/dist/module/components/AudienceSelectorPage.js.map +1 -1
- package/dist/module/components/AutoOffsetImage.js +13 -13
- package/dist/module/components/AutoOffsetImage.js.map +1 -1
- package/dist/module/components/BackButton.js +10 -10
- package/dist/module/components/BackButton.js.map +1 -1
- package/dist/module/components/CalendarPopup.js +21 -21
- package/dist/module/components/CalendarPopup.js.map +1 -1
- package/dist/module/components/CategoryTabs.js +30 -29
- package/dist/module/components/CategoryTabs.js.map +1 -1
- package/dist/module/components/CommentReply.js +43 -37
- package/dist/module/components/CommentReply.js.map +1 -1
- package/dist/module/components/CommentSection.js +74 -74
- package/dist/module/components/CommentSection.js.map +1 -1
- package/dist/module/components/ConfirmPopup.js +21 -20
- package/dist/module/components/ConfirmPopup.js.map +1 -1
- package/dist/module/components/ConfirmationPopup.js +11 -11
- package/dist/module/components/ConfirmationPopup.js.map +1 -1
- package/dist/module/components/DocumentUploader.js +50 -50
- package/dist/module/components/DocumentUploader.js.map +1 -1
- package/dist/module/components/DropDownItem.js +14 -13
- package/dist/module/components/DropDownItem.js.map +1 -1
- package/dist/module/components/DropDownMenu.js +5 -5
- package/dist/module/components/DropDownMenu.js.map +1 -1
- package/dist/module/components/EmptyStateMain.js +10 -9
- package/dist/module/components/EmptyStateMain.js.map +1 -1
- package/dist/module/components/EmptyStateWidget.js +7 -6
- package/dist/module/components/EmptyStateWidget.js.map +1 -1
- package/dist/module/components/FontScaleButton.js +5 -4
- package/dist/module/components/FontScaleButton.js.map +1 -1
- package/dist/module/components/FontScalePopup.js +11 -10
- package/dist/module/components/FontScalePopup.js.map +1 -1
- package/dist/module/components/Forbidden.js +13 -13
- package/dist/module/components/Forbidden.js.map +1 -1
- package/dist/module/components/FormCard.js +4 -4
- package/dist/module/components/FormCard.js.map +1 -1
- package/dist/module/components/FormCardSection.js +20 -18
- package/dist/module/components/FormCardSection.js.map +1 -1
- package/dist/module/components/FormCardSectionOptionLauncher.js +13 -12
- package/dist/module/components/FormCardSectionOptionLauncher.js.map +1 -1
- package/dist/module/components/FormattedText.js +18 -16
- package/dist/module/components/FormattedText.js.map +1 -1
- package/dist/module/components/GenericInput.js +24 -21
- package/dist/module/components/GenericInput.js.map +1 -1
- package/dist/module/components/GenericInputSection.js +27 -26
- package/dist/module/components/GenericInputSection.js.map +1 -1
- package/dist/module/components/Header.js +70 -69
- package/dist/module/components/Header.js.map +1 -1
- package/dist/module/components/Icon.js +109 -0
- package/dist/module/components/Icon.js.map +1 -0
- package/dist/module/components/ImagePopup.js +211 -73
- package/dist/module/components/ImagePopup.js.map +1 -1
- package/dist/module/components/ImageUploadProgress.js +10 -9
- package/dist/module/components/ImageUploadProgress.js.map +1 -1
- package/dist/module/components/ImageUploader.js +116 -96
- package/dist/module/components/ImageUploader.js.map +1 -1
- package/dist/module/components/InlineButton.js +9 -8
- package/dist/module/components/InlineButton.js.map +1 -1
- package/dist/module/components/Input.js +28 -26
- package/dist/module/components/Input.js.map +1 -1
- package/dist/module/components/LoadingCircles.js +20 -20
- package/dist/module/components/LoadingCircles.js.map +1 -1
- package/dist/module/components/LoadingIndicator.js +11 -11
- package/dist/module/components/LoadingIndicator.js.map +1 -1
- package/dist/module/components/LoadingStateWidget.js +5 -5
- package/dist/module/components/LoadingStateWidget.js.map +1 -1
- package/dist/module/components/MediaPlayer.js +31 -31
- package/dist/module/components/MediaPlayer.js.map +1 -1
- package/dist/module/components/MiddlePopup.js +17 -11
- package/dist/module/components/MiddlePopup.js.map +1 -1
- package/dist/module/components/PDFPopup.js +52 -39
- package/dist/module/components/PDFPopup.js.map +1 -1
- package/dist/module/components/PlussChat.js +168 -149
- package/dist/module/components/PlussChat.js.map +1 -1
- package/dist/module/components/PlussChatMessage.js +42 -42
- package/dist/module/components/PlussChatMessage.js.map +1 -1
- package/dist/module/components/PlussChatTime.js +18 -17
- package/dist/module/components/PlussChatTime.js.map +1 -1
- package/dist/module/components/Popup.js +20 -19
- package/dist/module/components/Popup.js.map +1 -1
- package/dist/module/components/PopupMenu.js +15 -14
- package/dist/module/components/PopupMenu.js.map +1 -1
- package/dist/module/components/PositionedImage.js +20 -20
- package/dist/module/components/PositionedImage.js.map +1 -1
- package/dist/module/components/ProfilePic.js +10 -10
- package/dist/module/components/ProfilePic.js.map +1 -1
- package/dist/module/components/RadioButton.js +10 -9
- package/dist/module/components/RadioButton.js.map +1 -1
- package/dist/module/components/Reaction.js +18 -17
- package/dist/module/components/Reaction.js.map +1 -1
- package/dist/module/components/Reactions.js +7 -7
- package/dist/module/components/Reactions.js.map +1 -1
- package/dist/module/components/SharingTools.js +78 -43
- package/dist/module/components/SharingTools.js.map +1 -1
- package/dist/module/components/Spinner.js +5 -5
- package/dist/module/components/Spinner.js.map +1 -1
- package/dist/module/components/StickyFooter.js +6 -6
- package/dist/module/components/StickyFooter.js.map +1 -1
- package/dist/module/components/Text.js +57 -0
- package/dist/module/components/Text.js.map +1 -0
- package/dist/module/components/TickIcon.js +6 -6
- package/dist/module/components/TickIcon.js.map +1 -1
- package/dist/module/components/Toggle.js +10 -9
- package/dist/module/components/Toggle.js.map +1 -1
- package/dist/module/components/TouchableSearchBar.js +18 -17
- package/dist/module/components/TouchableSearchBar.js.map +1 -1
- package/dist/module/components/UserListPopup.js +20 -19
- package/dist/module/components/UserListPopup.js.map +1 -1
- package/dist/module/components/UserListing.js +41 -40
- package/dist/module/components/UserListing.js.map +1 -1
- package/dist/module/components/VideoPopup.js +20 -20
- package/dist/module/components/VideoPopup.js.map +1 -1
- package/dist/module/components/WarningPopup.js +21 -20
- package/dist/module/components/WarningPopup.js.map +1 -1
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js +13 -13
- package/dist/module/components/expo-image-picker-multiple/ImageBrowser.js.map +1 -1
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js +24 -23
- package/dist/module/components/expo-image-picker-multiple/ImageTile.js.map +1 -1
- package/dist/module/components/index.js +59 -58
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js +94 -64
- package/dist/module/components/react-native-expo-image-cropper/ExpoImageManipulator.js.map +1 -1
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js +64 -64
- package/dist/module/components/react-native-expo-image-cropper/ImageCropOverlay.js.map +1 -1
- package/dist/module/config.js +15 -10
- package/dist/module/config.js.map +1 -1
- package/dist/module/constants.js +3 -4
- package/dist/module/constants.js.map +1 -1
- package/dist/module/helper.js +83 -82
- package/dist/module/helper.js.map +1 -1
- package/dist/module/index.js +12 -12
- package/dist/module/index.js.map +1 -1
- package/dist/module/js/images/detectFaces.js +11 -10
- package/dist/module/js/images/detectFaces.js.map +1 -1
- package/dist/module/js/images/findLandmarkRange.js +8 -8
- package/dist/module/js/images/findLandmarkRange.js.map +1 -1
- package/dist/module/js/images/getScaledOffset.js.map +1 -1
- package/dist/module/js/site/getSiteLevelFromState.js +2 -2
- package/dist/module/js/site/getSiteLevelFromState.js.map +1 -1
- package/dist/module/js/site/isTVEnabled.js +2 -2
- package/dist/module/js/site/isTVEnabled.js.map +1 -1
- package/dist/module/session.js +6 -6
- package/dist/module/session.js.map +1 -1
- package/dist/module/styles.js +17 -17
- package/dist/module/styles.js.map +1 -1
- package/dist/module/withNavigationFocus.js +30 -0
- package/dist/module/withNavigationFocus.js.map +1 -0
- package/package.json +71 -68
- package/src/actions/FollowerActions.js +36 -32
- package/src/actions/MediaActions.js +25 -20
- package/src/actions/ResidentActions.js +26 -21
- package/src/actions/UserActions.js +22 -22
- package/src/actions/UserSettingsActions.js +11 -11
- package/src/actions/index.js +5 -5
- package/src/actions/types.js +16 -16
- package/src/apis/analyticsActions.js +17 -17
- package/src/apis/contactActions.js +20 -20
- package/src/apis/eventActions.js +153 -144
- package/src/apis/fileActions.js +96 -86
- package/src/apis/followerActions.js +29 -29
- package/src/apis/index.js +12 -12
- package/src/apis/notificationActions.js +44 -44
- package/src/apis/profileActions.js +8 -8
- package/src/apis/reactionActions.js +81 -73
- package/src/apis/settingActions.js +15 -15
- package/src/apis/stringActions.js +29 -25
- package/src/apis/typeActions.js +10 -10
- package/src/apis/userActions.js +93 -93
- package/src/assets/icons/fontawesome/fa-brands-400.ttf +0 -0
- package/src/assets/icons/fontawesome/fa-light-300.ttf +0 -0
- package/src/assets/icons/fontawesome/fa-regular-400.ttf +0 -0
- package/src/assets/icons/fontawesome/fa-solid-900.ttf +0 -0
- package/src/assets/icons/fontawesome/fa-thin-100.ttf +0 -0
- package/src/assets/icons/fontawesome/fa7-glyphmap.json +4205 -0
- package/src/colours.js +116 -96
- package/src/components/AddButton.js +32 -27
- package/src/components/AddToCalendarButton.js +236 -202
- package/src/components/Attachment.js +59 -36
- package/src/components/AudienceSelectorLauncher.js +52 -48
- package/src/components/AudienceSelectorPage.js +353 -311
- package/src/components/AutoOffsetImage.js +237 -196
- package/src/components/BackButton.js +57 -41
- package/src/components/CalendarPopup.js +127 -97
- package/src/components/CategoryTabs.js +208 -163
- package/src/components/CommentReply.js +370 -309
- package/src/components/CommentSection.js +974 -781
- package/src/components/ConfirmPopup.js +141 -110
- package/src/components/ConfirmationPopup.js +80 -69
- package/src/components/DocumentUploader.js +245 -215
- package/src/components/DropDownItem.js +70 -60
- package/src/components/DropDownMenu.js +31 -27
- package/src/components/EmptyStateMain.js +51 -44
- package/src/components/EmptyStateWidget.js +47 -38
- package/src/components/FontScaleButton.js +29 -25
- package/src/components/FontScalePopup.js +67 -56
- package/src/components/Forbidden.js +48 -46
- package/src/components/FormCard.js +21 -17
- package/src/components/FormCardSection.js +284 -233
- package/src/components/FormCardSectionOptionLauncher.js +72 -46
- package/src/components/FormattedText.js +128 -111
- package/src/components/GenericInput.js +168 -136
- package/src/components/GenericInputSection.js +209 -161
- package/src/components/Header.js +620 -474
- package/src/components/Icon.js +119 -0
- package/src/components/ImagePopup.js +425 -221
- package/src/components/ImageUploadProgress.js +49 -41
- package/src/components/ImageUploader.js +968 -797
- package/src/components/InlineButton.js +79 -69
- package/src/components/Input.js +190 -156
- package/src/components/LoadingCircles.js +233 -233
- package/src/components/LoadingIndicator.js +87 -76
- package/src/components/LoadingStateWidget.js +47 -37
- package/src/components/MediaPlayer.js +416 -387
- package/src/components/MiddlePopup.js +62 -33
- package/src/components/PDFPopup.js +212 -159
- package/src/components/PlussChat.js +1224 -1025
- package/src/components/PlussChatMessage.js +329 -298
- package/src/components/PlussChatTime.js +57 -53
- package/src/components/Popup.js +138 -116
- package/src/components/PopupMenu.js +140 -110
- package/src/components/PositionedImage.js +281 -237
- package/src/components/ProfilePic.js +122 -113
- package/src/components/RadioButton.js +76 -52
- package/src/components/Reaction.js +134 -96
- package/src/components/Reactions.js +65 -63
- package/src/components/SharingTools.js +185 -134
- package/src/components/Spinner.js +13 -13
- package/src/components/StickyFooter.js +36 -26
- package/src/components/Text.js +62 -0
- package/src/components/TickIcon.js +20 -20
- package/src/components/Toggle.js +74 -73
- package/src/components/TouchableSearchBar.js +68 -50
- package/src/components/UserListPopup.js +161 -124
- package/src/components/UserListing.js +273 -238
- package/src/components/VideoPopup.js +110 -96
- package/src/components/WarningPopup.js +92 -71
- package/src/components/expo-image-picker-multiple/ImageBrowser.js +288 -256
- package/src/components/expo-image-picker-multiple/ImageTile.js +108 -84
- package/src/components/index.js +59 -58
- package/src/components/react-native-expo-image-cropper/ExpoImageManipulator.js +444 -359
- package/src/components/react-native-expo-image-cropper/ImageCropOverlay.js +420 -324
- package/src/config.js +26 -21
- package/src/constants.js +8 -10
- package/src/helper.js +469 -438
- package/src/index.js +24 -12
- package/src/js/images/detectFaces.js +28 -21
- package/src/js/images/findLandmarkRange.js +97 -90
- package/src/js/images/getScaledOffset.js +80 -75
- package/src/js/site/getSiteLevelFromState.js +26 -26
- package/src/js/site/isTVEnabled.js +10 -10
- package/src/session.js +32 -32
- package/src/styles.js +61 -61
- package/src/withNavigationFocus.js +28 -0
- package/dist/module/components/TextStyle.js +0 -45
- package/dist/module/components/TextStyle.js.map +0 -1
- package/dist/module/fonts/index.js +0 -2
- package/dist/module/fonts/index.js.map +0 -1
- package/dist/module/fonts/pluss60-icons.js +0 -5
- package/dist/module/fonts/pluss60-icons.js.map +0 -1
- package/dist/module/fonts/pluss60-icons.json +0 -1097
- package/src/components/TextStyle.js +0 -48
- package/src/fonts/index.js +0 -1
- package/src/fonts/pluss60-icons.js +0 -7
- package/src/fonts/pluss60-icons.json +0 -1097
|
@@ -1,34 +1,58 @@
|
|
|
1
|
-
import React, { Component } from
|
|
2
|
-
import { View, Image, ImageBackground, TouchableOpacity, Text, KeyboardAvoidingView, Platform, ScrollView, Alert } from 'react-native';
|
|
3
|
-
import { GiftedChat, Bubble, MessageText, Send, InputToolbar, Composer } from 'react-native-gifted-chat';
|
|
4
|
-
import { connect } from 'react-redux';
|
|
5
|
-
import _ from 'lodash';
|
|
6
|
-
import moment from 'moment';
|
|
7
|
-
import { Icon } from '@rneui/themed';
|
|
8
|
-
import { getBottomSpace } from 'react-native-iphone-x-helper';
|
|
9
|
-
import { Spinner } from './Spinner';
|
|
10
|
-
import { ProfilePic } from './ProfilePic';
|
|
11
|
-
import PlussChatTime from './PlussChatTime';
|
|
12
|
-
import { PDFPopup } from './PDFPopup';
|
|
13
|
-
import { Attachment } from './Attachment';
|
|
14
|
-
import PlussChatMessage from './PlussChatMessage';
|
|
15
|
-
import { TextStyle } from './TextStyle';
|
|
16
|
-
import { ConfirmPopup } from './ConfirmPopup';
|
|
1
|
+
import React, { Component } from "react";
|
|
17
2
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
3
|
+
View,
|
|
4
|
+
Image,
|
|
5
|
+
ImageBackground,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
KeyboardAvoidingView,
|
|
8
|
+
Platform,
|
|
9
|
+
ScrollView,
|
|
10
|
+
Alert,
|
|
11
|
+
TextInput,
|
|
12
|
+
} from "react-native";
|
|
13
|
+
import {
|
|
14
|
+
GiftedChat,
|
|
15
|
+
Bubble,
|
|
16
|
+
MessageText,
|
|
17
|
+
Send,
|
|
18
|
+
InputToolbar,
|
|
19
|
+
} from "react-native-gifted-chat";
|
|
20
|
+
import { connect } from "react-redux";
|
|
21
|
+
import _ from "lodash";
|
|
22
|
+
import moment from "moment";
|
|
23
|
+
import { Icon } from "@rneui/themed";
|
|
24
|
+
import { withSafeAreaInsets } from "react-native-safe-area-context";
|
|
25
|
+
import { Spinner } from "./Spinner";
|
|
26
|
+
import { ProfilePic } from "./ProfilePic";
|
|
27
|
+
import PlussChatTime from "./PlussChatTime";
|
|
28
|
+
import { PDFPopup } from "./PDFPopup";
|
|
29
|
+
import { Attachment } from "./Attachment";
|
|
30
|
+
import PlussChatMessage from "./PlussChatMessage";
|
|
31
|
+
import { Text } from ".";
|
|
32
|
+
import { ConfirmPopup } from "./ConfirmPopup";
|
|
33
|
+
import {
|
|
34
|
+
TEXT_DARK,
|
|
35
|
+
LINEGREY,
|
|
36
|
+
TEXT_DARKEST,
|
|
37
|
+
getMainBrandingColourFromState,
|
|
38
|
+
getLightBrandingColourFromState,
|
|
39
|
+
BG_GREY,
|
|
40
|
+
TEXT_BLUEGREY,
|
|
41
|
+
} from "../colours";
|
|
42
|
+
import {
|
|
43
|
+
getEnabledTabsFromState,
|
|
44
|
+
get1400,
|
|
45
|
+
getThumb300,
|
|
46
|
+
imageExists,
|
|
47
|
+
isVideo,
|
|
48
|
+
getImageSource,
|
|
49
|
+
getFileName,
|
|
50
|
+
} from "../helper";
|
|
51
|
+
import Config, { Services } from "../config";
|
|
52
|
+
import ImageUploader from "./ImageUploader";
|
|
53
|
+
import ImageUploadProgress from "./ImageUploadProgress";
|
|
54
|
+
import { ImagePopup } from "./ImagePopup";
|
|
55
|
+
import { VideoPopup } from "./VideoPopup";
|
|
32
56
|
|
|
33
57
|
const IMAGE_SIZE_SMALL = 55;
|
|
34
58
|
const IMAGE_SIZE_LARGE = 110;
|
|
@@ -38,1057 +62,1232 @@ const IMAGE_PREVIEW_AREA_HEIGHT = 105;
|
|
|
38
62
|
const IMAGE_PREVIEW_SIZE = IMAGE_PREVIEW_AREA_HEIGHT - 25;
|
|
39
63
|
|
|
40
64
|
class PlussChat extends Component {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
constructor(props) {
|
|
66
|
+
super(props);
|
|
67
|
+
const bottomInset = this.props.insets?.bottom ?? 0;
|
|
68
|
+
const isSingleTab = this.props.tabCount === 1 && bottomInset > 0;
|
|
69
|
+
this.MIN_COMPOSER_HEIGHT = Platform.select({
|
|
70
|
+
ios: isSingleTab ? 42 : 33,
|
|
71
|
+
android: 41,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
this.state = {
|
|
75
|
+
currentUser: {
|
|
76
|
+
_id: this.props.user.uid,
|
|
77
|
+
name: this.props.user.displayName,
|
|
78
|
+
avatar:
|
|
79
|
+
!_.isUndefined(this.props.user.profilePic) &&
|
|
80
|
+
!_.isEmpty(this.props.user.profilePic)
|
|
81
|
+
? this.props.user.profilePic
|
|
82
|
+
: Config.env.tinyChatDefault,
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
messages: [],
|
|
86
|
+
imagePopupSource: [],
|
|
87
|
+
imagePopupIndex: 0,
|
|
88
|
+
imagePopupOpen: false,
|
|
89
|
+
imagesToUpload: [],
|
|
90
|
+
showFullscreenVideo: false,
|
|
91
|
+
currentVideoUrl: "",
|
|
92
|
+
showDeleteMessageConfirm: false,
|
|
93
|
+
messageToDelete: null,
|
|
94
|
+
composerHeight: this.MIN_COMPOSER_HEIGHT,
|
|
95
|
+
};
|
|
96
|
+
this.checkThumb = null;
|
|
97
|
+
}
|
|
48
98
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
name: this.props.user.displayName,
|
|
53
|
-
avatar:
|
|
54
|
-
!_.isUndefined(this.props.user.profilePic) && !_.isEmpty(this.props.user.profilePic)
|
|
55
|
-
? this.props.user.profilePic
|
|
56
|
-
: Config.env.tinyChatDefault,
|
|
57
|
-
},
|
|
99
|
+
UNSAFE_componentWillMount() {
|
|
100
|
+
this.updateMessages(this.props);
|
|
101
|
+
}
|
|
58
102
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
currentVideoUrl: '',
|
|
66
|
-
showDeleteMessageConfirm: false,
|
|
67
|
-
messageToDelete: null,
|
|
68
|
-
};
|
|
69
|
-
this.checkThumb = null;
|
|
70
|
-
}
|
|
103
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
104
|
+
// Only update if messages actually changed
|
|
105
|
+
if (nextProps.messages !== this.props.messages) {
|
|
106
|
+
this.updateMessages(nextProps);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
71
109
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
110
|
+
updateMessages(props) {
|
|
111
|
+
// Only update if messages actually changed
|
|
112
|
+
if (
|
|
113
|
+
!_.isUndefined(props.messages) &&
|
|
114
|
+
!_.isEqual(props.messages, this.state.messages)
|
|
115
|
+
) {
|
|
116
|
+
this.setState({ messages: props.messages });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
75
119
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
120
|
+
/***
|
|
121
|
+
*
|
|
122
|
+
* Messaging functionality
|
|
123
|
+
*/
|
|
124
|
+
onSend(messages = []) {
|
|
125
|
+
// if (this.chatKey) {
|
|
126
|
+
// this.sendMessage(messages[0]);
|
|
127
|
+
// }
|
|
128
|
+
}
|
|
79
129
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
130
|
+
onPressEvent = (event) => {
|
|
131
|
+
Services.navigation.navigate("eventDetail", { event });
|
|
132
|
+
};
|
|
133
|
+
onPressAttachment = (attachment) => {
|
|
134
|
+
switch (attachment.Type) {
|
|
135
|
+
case "Event":
|
|
136
|
+
Services.navigation.navigate("eventDetail", { event: attachment });
|
|
137
|
+
break;
|
|
138
|
+
case "Place":
|
|
139
|
+
Services.navigation.navigate("placeDetail", { place: attachment });
|
|
140
|
+
break;
|
|
141
|
+
default:
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
87
145
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*/
|
|
92
|
-
onSend(messages = []) {
|
|
93
|
-
// if (this.chatKey) {
|
|
94
|
-
// this.sendMessage(messages[0]);
|
|
95
|
-
// }
|
|
96
|
-
}
|
|
146
|
+
hasImagesAttached = (imagesToUpload = null) => {
|
|
147
|
+
return !_.isEmpty(imagesToUpload || this.state.imagesToUpload);
|
|
148
|
+
};
|
|
97
149
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
break;
|
|
106
|
-
case 'Place':
|
|
107
|
-
Services.navigation.navigate('placeDetail', { place: attachment });
|
|
108
|
-
break;
|
|
109
|
-
default:
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
150
|
+
hasImagesReady = (imagesToUpload = null) => {
|
|
151
|
+
const upload = imagesToUpload || this.state.imagesToUpload;
|
|
152
|
+
return (
|
|
153
|
+
this.hasImagesAttached(upload) &&
|
|
154
|
+
upload.every((i) => !i.uploading && i.thumbNailExists)
|
|
155
|
+
);
|
|
156
|
+
};
|
|
113
157
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
};
|
|
158
|
+
waitForThumbnails = () => {
|
|
159
|
+
if (this.checkThumb) return;
|
|
117
160
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
161
|
+
this.checkThumb = setInterval(async () => {
|
|
162
|
+
const imagesToUpload = [];
|
|
163
|
+
await Promise.all(
|
|
164
|
+
this.state.imagesToUpload.map((image) => {
|
|
165
|
+
return new Promise(async (resolve) => {
|
|
166
|
+
const newImage = { ...image };
|
|
167
|
+
imagesToUpload.push(newImage);
|
|
168
|
+
if (newImage.url && !newImage.thumbNailExists) {
|
|
169
|
+
newImage.uploading = false;
|
|
170
|
+
newImage.allowRetry = false;
|
|
171
|
+
newImage.thumbNailExists = await imageExists(
|
|
172
|
+
newImage.thumbNailUrl,
|
|
173
|
+
);
|
|
174
|
+
resolve(newImage.thumbNailExists);
|
|
175
|
+
}
|
|
176
|
+
resolve(true);
|
|
177
|
+
});
|
|
178
|
+
}),
|
|
179
|
+
);
|
|
180
|
+
const thumbnailsExist = imagesToUpload.every(
|
|
181
|
+
(image) => !image.url || image.thumbNailExists,
|
|
182
|
+
);
|
|
183
|
+
if (thumbnailsExist) {
|
|
184
|
+
clearInterval(this.checkThumb);
|
|
185
|
+
this.checkThumb = null;
|
|
186
|
+
this.setState({ imagesToUpload });
|
|
187
|
+
}
|
|
188
|
+
}, 2000);
|
|
189
|
+
};
|
|
122
190
|
|
|
123
|
-
|
|
124
|
-
|
|
191
|
+
onOpenAttachment = (a) => {
|
|
192
|
+
this.setState({
|
|
193
|
+
selectedPDF: a,
|
|
194
|
+
});
|
|
195
|
+
};
|
|
125
196
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const newImage = { ...image };
|
|
132
|
-
imagesToUpload.push(newImage);
|
|
133
|
-
if (newImage.url && !newImage.thumbNailExists) {
|
|
134
|
-
newImage.uploading = false;
|
|
135
|
-
newImage.allowRetry = false;
|
|
136
|
-
newImage.thumbNailExists = await imageExists(newImage.thumbNailUrl);
|
|
137
|
-
resolve(newImage.thumbNailExists);
|
|
138
|
-
}
|
|
139
|
-
resolve(true);
|
|
140
|
-
});
|
|
141
|
-
}),
|
|
142
|
-
);
|
|
143
|
-
const thumbnailsExist = imagesToUpload.every(image => !image.url || image.thumbNailExists);
|
|
144
|
-
if (thumbnailsExist) {
|
|
145
|
-
clearInterval(this.checkThumb);
|
|
146
|
-
this.checkThumb = null;
|
|
147
|
-
this.setState({ imagesToUpload });
|
|
148
|
-
}
|
|
149
|
-
}, 2000);
|
|
150
|
-
};
|
|
197
|
+
onCloseAttachment = () => {
|
|
198
|
+
this.setState({
|
|
199
|
+
selectedPDF: null,
|
|
200
|
+
});
|
|
201
|
+
};
|
|
151
202
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
};
|
|
203
|
+
showUploadMenu() {
|
|
204
|
+
this.imageUploader.showUploadMenu();
|
|
205
|
+
}
|
|
157
206
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
207
|
+
onFocusInput = () => {
|
|
208
|
+
this.setState({
|
|
209
|
+
keyboardOpen: true,
|
|
210
|
+
});
|
|
211
|
+
if (this.props.keyboardOpen) {
|
|
212
|
+
this.props.keyboardOpen();
|
|
213
|
+
}
|
|
214
|
+
};
|
|
163
215
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
216
|
+
onBlurInput = () => {
|
|
217
|
+
this.setState({
|
|
218
|
+
keyboardOpen: false,
|
|
219
|
+
});
|
|
220
|
+
};
|
|
167
221
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
222
|
+
onUploadStarted = (uploadUri, imageUri) => {
|
|
223
|
+
const imagesToUpload = [
|
|
224
|
+
...this.state.imagesToUpload,
|
|
225
|
+
{
|
|
226
|
+
uploading: true,
|
|
227
|
+
uploadProgress: "0%",
|
|
228
|
+
uploadUri,
|
|
229
|
+
imageUri,
|
|
230
|
+
allowRetry: true,
|
|
231
|
+
},
|
|
232
|
+
];
|
|
233
|
+
this.setState({ imagesToUpload });
|
|
234
|
+
};
|
|
176
235
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
236
|
+
onUploadProgress = (progress) => {
|
|
237
|
+
const imagesToUpload = [...this.state.imagesToUpload];
|
|
238
|
+
imagesToUpload.map((img) => {
|
|
239
|
+
if (img.uploadUri === progress.uri) {
|
|
240
|
+
img.uploadProgress = progress.percentage;
|
|
241
|
+
img.uploading = true;
|
|
242
|
+
img.allowRetry = true;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
this.setState({ imagesToUpload });
|
|
246
|
+
};
|
|
182
247
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
248
|
+
onUploadSuccess = async (uri, uploadUri) => {
|
|
249
|
+
const imagesToUpload = [...this.state.imagesToUpload];
|
|
250
|
+
imagesToUpload.map((img) => {
|
|
251
|
+
if (img.uploadUri === uploadUri && img.uploading) {
|
|
252
|
+
img.url = uri.replace("/general/", "/general1400/");
|
|
253
|
+
img.thumbNailExists = false;
|
|
254
|
+
img.thumbNailUrl = getThumb300(img.url);
|
|
255
|
+
img.allowRetry = true;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
this.setState({ imagesToUpload }, () => this.waitForThumbnails());
|
|
259
|
+
};
|
|
196
260
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
261
|
+
onUploadFailed = (uploadUri) => {
|
|
262
|
+
const imagesToUpload = [...this.state.imagesToUpload];
|
|
263
|
+
imagesToUpload.map((img) => {
|
|
264
|
+
if (img.uploadUri === uploadUri) {
|
|
265
|
+
img.uploading = true; // Requried for retry
|
|
266
|
+
img.uploadProgress = "";
|
|
267
|
+
img.allowRetry = true;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
this.setState({ imagesToUpload });
|
|
271
|
+
};
|
|
208
272
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
273
|
+
onLibrarySelected = (uri) => {
|
|
274
|
+
const imagesToUpload = [
|
|
275
|
+
...this.state.imagesToUpload,
|
|
276
|
+
{
|
|
277
|
+
uploading: false,
|
|
278
|
+
allowRetry: false,
|
|
279
|
+
url: get1400(uri),
|
|
280
|
+
thumbNailExists: true,
|
|
281
|
+
thumbNailUrl: getThumb300(uri),
|
|
282
|
+
},
|
|
283
|
+
];
|
|
284
|
+
this.setState({ imagesToUpload });
|
|
285
|
+
};
|
|
221
286
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
this.setState({ imagesToUpload });
|
|
232
|
-
};
|
|
287
|
+
onPressImage = (images, selected) => {
|
|
288
|
+
this.setState({
|
|
289
|
+
imagePopupSource: images,
|
|
290
|
+
imagePopupIndex: images.indexOf(selected),
|
|
291
|
+
imagePopupOpen: true,
|
|
292
|
+
});
|
|
293
|
+
};
|
|
233
294
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
allowRetry: false,
|
|
240
|
-
url: get1400(uri),
|
|
241
|
-
thumbNailExists: true,
|
|
242
|
-
thumbNailUrl: getThumb300(uri),
|
|
243
|
-
},
|
|
244
|
-
];
|
|
245
|
-
this.setState({ imagesToUpload });
|
|
246
|
-
};
|
|
295
|
+
onReply = (message) => {
|
|
296
|
+
this.setState({
|
|
297
|
+
replyingTo: message,
|
|
298
|
+
});
|
|
299
|
+
};
|
|
247
300
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
});
|
|
254
|
-
};
|
|
301
|
+
onDelete = (message) => {
|
|
302
|
+
// Only proceed if delete handler is provided
|
|
303
|
+
if (!this.props.onDeleteMessage) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
255
306
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
};
|
|
307
|
+
// Only allow deletion of own messages
|
|
308
|
+
if (message.user._id !== this.props.user.uid) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
261
311
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
312
|
+
this.setState({
|
|
313
|
+
showDeleteMessageConfirm: true,
|
|
314
|
+
messageToDelete: message,
|
|
315
|
+
});
|
|
316
|
+
};
|
|
267
317
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
318
|
+
onCancelDeleteMessage = () => {
|
|
319
|
+
this.setState({
|
|
320
|
+
showDeleteMessageConfirm: false,
|
|
321
|
+
messageToDelete: null,
|
|
322
|
+
});
|
|
323
|
+
};
|
|
272
324
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
});
|
|
277
|
-
};
|
|
325
|
+
onConfirmDeleteMessage = async () => {
|
|
326
|
+
const { messageToDelete } = this.state;
|
|
327
|
+
if (!messageToDelete) return;
|
|
278
328
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
messageToDelete: null,
|
|
283
|
-
});
|
|
284
|
-
};
|
|
329
|
+
this.setState({
|
|
330
|
+
showDeleteMessageConfirm: false,
|
|
331
|
+
});
|
|
285
332
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
333
|
+
try {
|
|
334
|
+
// Call the parent's delete handler if provided
|
|
335
|
+
if (this.props.onDeleteMessage) {
|
|
336
|
+
await this.props.onDeleteMessage(messageToDelete);
|
|
337
|
+
}
|
|
289
338
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
339
|
+
this.setState({
|
|
340
|
+
messageToDelete: null,
|
|
341
|
+
});
|
|
342
|
+
} catch (error) {
|
|
343
|
+
// Handle error gracefully if parent handler fails
|
|
344
|
+
console.log("onConfirmDeleteMessage error", error);
|
|
345
|
+
// Error is already handled by parent component
|
|
346
|
+
this.setState({ messageToDelete: null });
|
|
347
|
+
}
|
|
348
|
+
};
|
|
293
349
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
350
|
+
closeGallery() {
|
|
351
|
+
this.setState({
|
|
352
|
+
imagePopupSource: [],
|
|
353
|
+
imagePopupIndex: 0,
|
|
354
|
+
imagePopupOpen: false,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
299
357
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
// Error is already handled by parent component
|
|
307
|
-
this.setState({ messageToDelete: null });
|
|
308
|
-
}
|
|
309
|
-
};
|
|
358
|
+
onRemoveImage = (url) => {
|
|
359
|
+
const imagesToUpload = this.state.imagesToUpload.filter(
|
|
360
|
+
(image) => image.url !== url,
|
|
361
|
+
);
|
|
362
|
+
this.setState({ imagesToUpload });
|
|
363
|
+
};
|
|
310
364
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
365
|
+
toggleFullscreenVideo = (url) => {
|
|
366
|
+
if (typeof url !== "string") url = "";
|
|
367
|
+
this.setState({
|
|
368
|
+
showFullscreenVideo: url.length > 0,
|
|
369
|
+
currentVideoUrl: url,
|
|
370
|
+
});
|
|
371
|
+
};
|
|
318
372
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
373
|
+
sendMessages(messages) {
|
|
374
|
+
if (this.hasImagesAttached()) {
|
|
375
|
+
// Don't allow send if attached images aren't ready
|
|
376
|
+
if (!this.hasImagesReady()) return;
|
|
377
|
+
messages[0].image = this.state.imagesToUpload.map((image) => image.url);
|
|
378
|
+
}
|
|
379
|
+
if (_.isEmpty(messages[0].text)) {
|
|
380
|
+
messages[0].text = "";
|
|
381
|
+
}
|
|
382
|
+
if (!messages[0].text && !messages[0].image) return;
|
|
323
383
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
};
|
|
384
|
+
if (this.state.replyingTo) {
|
|
385
|
+
messages[0].replyingTo = this.state.replyingTo;
|
|
386
|
+
}
|
|
328
387
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if (!this.hasImagesReady()) return;
|
|
333
|
-
messages[0].image = this.state.imagesToUpload.map(image => image.url);
|
|
334
|
-
}
|
|
335
|
-
if (_.isEmpty(messages[0].text)) {
|
|
336
|
-
messages[0].text = '';
|
|
337
|
-
}
|
|
338
|
-
if (!messages[0].text && !messages[0].image) return;
|
|
388
|
+
this.props.onSend(messages);
|
|
389
|
+
this.setState({ imagesToUpload: [], replyingTo: null });
|
|
390
|
+
}
|
|
339
391
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
392
|
+
/**
|
|
393
|
+
*
|
|
394
|
+
* Render Functions
|
|
395
|
+
*/
|
|
396
|
+
renderBubble(bubbleProps) {
|
|
397
|
+
const wrapperStyle = {};
|
|
398
|
+
if (
|
|
399
|
+
!_.isEmpty(bubbleProps.currentMessage.text) &&
|
|
400
|
+
!_.isEmpty(bubbleProps.currentMessage.image)
|
|
401
|
+
) {
|
|
402
|
+
wrapperStyle.paddingTop = 8;
|
|
403
|
+
wrapperStyle.paddingBottom = 16;
|
|
404
|
+
wrapperStyle.minWidth = 142; // 110 image width + 16 padding either side
|
|
405
|
+
}
|
|
406
|
+
if (!_.isEmpty(bubbleProps.currentMessage.attachments)) {
|
|
407
|
+
wrapperStyle.paddingTop = 8;
|
|
408
|
+
wrapperStyle.paddingBottom = 16;
|
|
409
|
+
wrapperStyle.paddingHorizontal = 16;
|
|
410
|
+
}
|
|
411
|
+
return (
|
|
412
|
+
<Bubble
|
|
413
|
+
{...bubbleProps}
|
|
414
|
+
renderMessageImage={() => null}
|
|
415
|
+
isCustomViewBottom={true}
|
|
416
|
+
wrapperStyle={{
|
|
417
|
+
left: {
|
|
418
|
+
backgroundColor: LINEGREY,
|
|
419
|
+
borderRadius: 25,
|
|
420
|
+
...wrapperStyle,
|
|
421
|
+
},
|
|
422
|
+
right: {
|
|
423
|
+
backgroundColor: this.props.colourBrandingLight,
|
|
424
|
+
borderRadius: 25,
|
|
425
|
+
...wrapperStyle,
|
|
426
|
+
},
|
|
427
|
+
}}
|
|
428
|
+
containerToNextStyle={{
|
|
429
|
+
left: {
|
|
430
|
+
borderBottomLeftRadius: 5,
|
|
431
|
+
},
|
|
432
|
+
right: {
|
|
433
|
+
borderBottomRightRadius: 5,
|
|
434
|
+
},
|
|
435
|
+
}}
|
|
436
|
+
containerToPreviousStyle={{
|
|
437
|
+
left: {
|
|
438
|
+
borderTopLeftRadius: 5,
|
|
439
|
+
},
|
|
440
|
+
right: {
|
|
441
|
+
borderTopRightRadius: 5,
|
|
442
|
+
},
|
|
443
|
+
}}
|
|
444
|
+
/>
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
renderMessage(props) {
|
|
448
|
+
return (
|
|
449
|
+
<PlussChatMessage
|
|
450
|
+
key={props.RowId}
|
|
451
|
+
colourBrandingMain={this.props.colourBrandingMain}
|
|
452
|
+
onPressReply={() => {
|
|
453
|
+
this.onReply(props.currentMessage);
|
|
454
|
+
}}
|
|
455
|
+
onPressDelete={
|
|
456
|
+
this.props.onDeleteMessage
|
|
457
|
+
? () => {
|
|
458
|
+
this.onDelete(props.currentMessage);
|
|
459
|
+
}
|
|
460
|
+
: null
|
|
461
|
+
}
|
|
462
|
+
{...props}
|
|
463
|
+
/>
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
renderMessageText(messageTextProps) {
|
|
467
|
+
// If message is deleted, show placeholder text
|
|
468
|
+
const props = messageTextProps.currentMessage.deleted
|
|
469
|
+
? {
|
|
470
|
+
...messageTextProps,
|
|
471
|
+
currentMessage: {
|
|
472
|
+
...messageTextProps.currentMessage,
|
|
473
|
+
text: "[Message deleted]",
|
|
474
|
+
},
|
|
475
|
+
}
|
|
476
|
+
: messageTextProps;
|
|
343
477
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
478
|
+
return (
|
|
479
|
+
<MessageText
|
|
480
|
+
{...props}
|
|
481
|
+
textStyle={{
|
|
482
|
+
left: {
|
|
483
|
+
fontFamily: "sf-regular",
|
|
484
|
+
fontSize: 16,
|
|
485
|
+
color: TEXT_DARKEST,
|
|
486
|
+
marginTop: 10,
|
|
487
|
+
marginBottom: 10,
|
|
488
|
+
marginLeft: 15,
|
|
489
|
+
marginRight: 15,
|
|
490
|
+
},
|
|
491
|
+
right: {
|
|
492
|
+
fontFamily: "sf-regular",
|
|
493
|
+
fontSize: 16,
|
|
494
|
+
color: this.props.colourBrandingMain,
|
|
495
|
+
marginTop: 10,
|
|
496
|
+
marginBottom: 10,
|
|
497
|
+
marginLeft: 15,
|
|
498
|
+
marginRight: 15,
|
|
499
|
+
},
|
|
500
|
+
}}
|
|
501
|
+
linkStyle={{
|
|
502
|
+
left: {
|
|
503
|
+
color: TEXT_DARKEST,
|
|
504
|
+
},
|
|
505
|
+
right: {
|
|
506
|
+
color: this.props.colourBrandingMain,
|
|
507
|
+
},
|
|
508
|
+
}}
|
|
509
|
+
textProps={{
|
|
510
|
+
selectable: true,
|
|
511
|
+
}}
|
|
512
|
+
/>
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
renderTime() {
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
renderDay(dayProps) {
|
|
519
|
+
return (
|
|
520
|
+
<PlussChatTime
|
|
521
|
+
{...dayProps}
|
|
522
|
+
textStyle={{
|
|
523
|
+
fontFamily: "sf-semibold",
|
|
524
|
+
color: TEXT_DARK,
|
|
525
|
+
fontSize: 12,
|
|
526
|
+
}}
|
|
527
|
+
/>
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
renderCustomView({ currentMessage, position }) {
|
|
531
|
+
// Don't show images or attachments for deleted messages
|
|
532
|
+
if (currentMessage.deleted) {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
347
535
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
536
|
+
if (currentMessage.image) {
|
|
537
|
+
const images =
|
|
538
|
+
typeof currentMessage.image === "string"
|
|
539
|
+
? [currentMessage.image]
|
|
540
|
+
: currentMessage.image;
|
|
541
|
+
const containerWidth = (() => {
|
|
542
|
+
if (images.length === 0) return 0;
|
|
543
|
+
if (images.length === 1) return IMAGE_SIZE_LARGE;
|
|
544
|
+
if (images.length <= IMAGES_PER_ROW)
|
|
545
|
+
return (IMAGE_SIZE_SMALL + IMAGE_MARGIN) * images.length;
|
|
546
|
+
return (IMAGE_SIZE_SMALL + IMAGE_MARGIN) * IMAGES_PER_ROW;
|
|
547
|
+
})();
|
|
548
|
+
return (
|
|
549
|
+
<View
|
|
550
|
+
style={[
|
|
551
|
+
styles.imagesContainer,
|
|
552
|
+
{
|
|
553
|
+
width: containerWidth,
|
|
554
|
+
paddingVertical: currentMessage.text ? 0 : 20,
|
|
555
|
+
},
|
|
556
|
+
]}
|
|
557
|
+
>
|
|
558
|
+
{images.map((img) => {
|
|
559
|
+
const thumb = getThumb300(img);
|
|
560
|
+
if (isVideo(img)) {
|
|
561
|
+
return (
|
|
562
|
+
<TouchableOpacity
|
|
563
|
+
key={thumb}
|
|
564
|
+
onPress={this.toggleFullscreenVideo.bind(this, img)}
|
|
565
|
+
>
|
|
566
|
+
<ImageBackground
|
|
567
|
+
style={
|
|
568
|
+
images.length > 1
|
|
569
|
+
? styles.messageImageSmall
|
|
570
|
+
: styles.messageImageLarge
|
|
571
|
+
}
|
|
572
|
+
source={{ uri: thumb }}
|
|
573
|
+
>
|
|
574
|
+
<View style={styles.imagePlayContainer}>
|
|
575
|
+
<Icon
|
|
576
|
+
name="play"
|
|
577
|
+
type="font-awesome"
|
|
578
|
+
iconStyle={styles.imageControlIcon}
|
|
579
|
+
/>
|
|
580
|
+
</View>
|
|
581
|
+
</ImageBackground>
|
|
582
|
+
</TouchableOpacity>
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
return (
|
|
586
|
+
<TouchableOpacity
|
|
587
|
+
key={thumb}
|
|
588
|
+
onPress={() => this.onPressImage(images, img)}
|
|
589
|
+
>
|
|
590
|
+
<Image
|
|
591
|
+
source={{ uri: thumb }}
|
|
592
|
+
style={
|
|
593
|
+
images.length > 1
|
|
594
|
+
? styles.messageImageSmall
|
|
595
|
+
: styles.messageImageLarge
|
|
596
|
+
}
|
|
597
|
+
/>
|
|
598
|
+
</TouchableOpacity>
|
|
599
|
+
);
|
|
600
|
+
})}
|
|
601
|
+
</View>
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
if (!_.isEmpty(currentMessage.attachments)) {
|
|
605
|
+
return (
|
|
606
|
+
<View>
|
|
607
|
+
{currentMessage.attachments.map((url, i) => {
|
|
608
|
+
return (
|
|
609
|
+
<Attachment
|
|
610
|
+
onPress={() => {
|
|
611
|
+
this.onOpenAttachment(url);
|
|
612
|
+
}}
|
|
613
|
+
key={i}
|
|
614
|
+
title={getFileName(url)}
|
|
615
|
+
/>
|
|
616
|
+
);
|
|
617
|
+
})}
|
|
618
|
+
</View>
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
if (currentMessage.event) {
|
|
622
|
+
return (
|
|
623
|
+
<TouchableOpacity
|
|
624
|
+
onPress={this.onPressEvent.bind(this, currentMessage.event)}
|
|
625
|
+
>
|
|
626
|
+
<View style={styles.eventContainer[position]}>
|
|
627
|
+
<Image
|
|
628
|
+
style={[styles.eventImage, styles.eventImageMargin[position]]}
|
|
629
|
+
source={{ uri: currentMessage.event.Thumbnail }}
|
|
630
|
+
/>
|
|
631
|
+
<View style={styles.eventInfo}>
|
|
632
|
+
<Text
|
|
633
|
+
numberOfLines={3}
|
|
634
|
+
style={[
|
|
635
|
+
styles.eventTitle,
|
|
636
|
+
styles.eventInfoAlign[position],
|
|
637
|
+
{ color: this.props.colourBrandingMain },
|
|
638
|
+
]}
|
|
639
|
+
>
|
|
640
|
+
{currentMessage.event.Title}
|
|
641
|
+
</Text>
|
|
642
|
+
<Text
|
|
643
|
+
style={[
|
|
644
|
+
styles.eventDate,
|
|
645
|
+
styles.eventInfoAlign[position],
|
|
646
|
+
{ color: this.props.colourBrandingMain },
|
|
647
|
+
]}
|
|
648
|
+
>
|
|
649
|
+
{moment
|
|
650
|
+
.utc(currentMessage.event.StartTime)
|
|
651
|
+
.local()
|
|
652
|
+
.format("ddd D MMM")}
|
|
653
|
+
</Text>
|
|
654
|
+
</View>
|
|
655
|
+
</View>
|
|
656
|
+
</TouchableOpacity>
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
if (currentMessage.attachment) {
|
|
660
|
+
return (
|
|
661
|
+
<TouchableOpacity
|
|
662
|
+
onPress={this.onPressAttachment.bind(this, currentMessage.attachment)}
|
|
663
|
+
>
|
|
664
|
+
<View style={styles.eventContainer[position]}>
|
|
665
|
+
<Image
|
|
666
|
+
style={[styles.eventImage, styles.eventImageMargin[position]]}
|
|
667
|
+
source={{ uri: currentMessage.attachment.Thumbnail }}
|
|
668
|
+
/>
|
|
669
|
+
<View style={styles.eventInfo}>
|
|
670
|
+
<Text
|
|
671
|
+
numberOfLines={3}
|
|
672
|
+
style={[
|
|
673
|
+
styles.eventTitle,
|
|
674
|
+
styles.eventInfoAlign[position],
|
|
675
|
+
{ color: this.props.colourBrandingMain },
|
|
676
|
+
]}
|
|
677
|
+
>
|
|
678
|
+
{currentMessage.attachment.Title}
|
|
679
|
+
</Text>
|
|
680
|
+
{currentMessage.attachment.StartTime && (
|
|
681
|
+
<Text
|
|
682
|
+
style={[
|
|
683
|
+
styles.eventDate,
|
|
684
|
+
styles.eventInfoAlign[position],
|
|
685
|
+
{ color: this.props.colourBrandingMain },
|
|
686
|
+
]}
|
|
687
|
+
>
|
|
688
|
+
{moment
|
|
689
|
+
.utc(currentMessage.attachment.StartTime)
|
|
690
|
+
.local()
|
|
691
|
+
.format("ddd D MMM")}
|
|
692
|
+
</Text>
|
|
693
|
+
)}
|
|
694
|
+
</View>
|
|
695
|
+
</View>
|
|
696
|
+
</TouchableOpacity>
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
430
701
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
color: TEXT_DARKEST,
|
|
457
|
-
},
|
|
458
|
-
right: {
|
|
459
|
-
color: this.props.colourBrandingMain,
|
|
460
|
-
},
|
|
461
|
-
}}
|
|
462
|
-
/>
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
renderTime() {
|
|
466
|
-
return null;
|
|
467
|
-
}
|
|
468
|
-
renderDay(dayProps) {
|
|
469
|
-
return (
|
|
470
|
-
<PlussChatTime
|
|
471
|
-
{...dayProps}
|
|
472
|
-
textStyle={{
|
|
473
|
-
fontFamily: 'sf-semibold',
|
|
474
|
-
color: TEXT_DARK,
|
|
475
|
-
fontSize: 12,
|
|
476
|
-
}}
|
|
477
|
-
/>
|
|
478
|
-
);
|
|
479
|
-
}
|
|
480
|
-
renderCustomView({ currentMessage, position }) {
|
|
481
|
-
// Don't show images or attachments for deleted messages
|
|
482
|
-
if (currentMessage.deleted) {
|
|
483
|
-
return null;
|
|
484
|
-
}
|
|
702
|
+
renderSend(props) {
|
|
703
|
+
const buttonTopOffset = this.state.replyingTo ? 46 : 4;
|
|
704
|
+
const showSendButton =
|
|
705
|
+
!_.isEmpty(props.text) || this.hasImagesReady(props.imagesToUpload);
|
|
706
|
+
return (
|
|
707
|
+
<View
|
|
708
|
+
style={{
|
|
709
|
+
position: "absolute",
|
|
710
|
+
top: buttonTopOffset,
|
|
711
|
+
right: 8,
|
|
712
|
+
flexDirection: "row",
|
|
713
|
+
alignItems: "center",
|
|
714
|
+
}}
|
|
715
|
+
>
|
|
716
|
+
{/* Image upload button - always visible */}
|
|
717
|
+
<TouchableOpacity
|
|
718
|
+
onPress={this.showUploadMenu.bind(this)}
|
|
719
|
+
style={[
|
|
720
|
+
styles.sendContainer,
|
|
721
|
+
{
|
|
722
|
+
right:
|
|
723
|
+
_.isEmpty(props.text) &&
|
|
724
|
+
!this.hasImagesReady(props.imagesToUpload)
|
|
725
|
+
? 0
|
|
726
|
+
: this.MIN_COMPOSER_HEIGHT,
|
|
485
727
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
const thumb = getThumb300(img);
|
|
498
|
-
if (isVideo(img)) {
|
|
499
|
-
return (
|
|
500
|
-
<TouchableOpacity key={thumb} onPress={this.toggleFullscreenVideo.bind(this, img)}>
|
|
501
|
-
<ImageBackground style={images.length > 1 ? styles.messageImageSmall : styles.messageImageLarge} source={{ uri: thumb }}>
|
|
502
|
-
<View style={styles.imagePlayContainer}>
|
|
503
|
-
<Icon name="play" type="font-awesome" iconStyle={styles.imageControlIcon} />
|
|
504
|
-
</View>
|
|
505
|
-
</ImageBackground>
|
|
506
|
-
</TouchableOpacity>
|
|
507
|
-
);
|
|
508
|
-
}
|
|
509
|
-
return (
|
|
510
|
-
<TouchableOpacity key={thumb} onPress={() => this.onPressImage(images, img)}>
|
|
511
|
-
<Image source={{ uri: thumb }} style={images.length > 1 ? styles.messageImageSmall : styles.messageImageLarge} />
|
|
512
|
-
</TouchableOpacity>
|
|
513
|
-
);
|
|
514
|
-
})}
|
|
515
|
-
</View>
|
|
516
|
-
);
|
|
517
|
-
}
|
|
518
|
-
if (!_.isEmpty(currentMessage.attachments)) {
|
|
519
|
-
return (
|
|
520
|
-
<View>
|
|
521
|
-
{currentMessage.attachments.map((url, i) => {
|
|
522
|
-
return (
|
|
523
|
-
<Attachment
|
|
524
|
-
onPress={() => {
|
|
525
|
-
this.onOpenAttachment(url);
|
|
526
|
-
}}
|
|
527
|
-
key={i}
|
|
528
|
-
title={getFileName(url)}
|
|
529
|
-
/>
|
|
530
|
-
);
|
|
531
|
-
})}
|
|
532
|
-
</View>
|
|
533
|
-
);
|
|
534
|
-
}
|
|
535
|
-
if (currentMessage.event) {
|
|
536
|
-
return (
|
|
537
|
-
<TouchableOpacity onPress={this.onPressEvent.bind(this, currentMessage.event)}>
|
|
538
|
-
<View style={styles.eventContainer[position]}>
|
|
539
|
-
<Image style={[styles.eventImage, styles.eventImageMargin[position]]} source={{ uri: currentMessage.event.Thumbnail }} />
|
|
540
|
-
<View style={styles.eventInfo}>
|
|
541
|
-
<Text
|
|
542
|
-
numberOfLines={3}
|
|
543
|
-
style={[styles.eventTitle, styles.eventInfoAlign[position], { color: this.props.colourBrandingMain }]}
|
|
544
|
-
>
|
|
545
|
-
{currentMessage.event.Title}
|
|
546
|
-
</Text>
|
|
547
|
-
<Text style={[styles.eventDate, styles.eventInfoAlign[position], { color: this.props.colourBrandingMain }]}>
|
|
548
|
-
{moment
|
|
549
|
-
.utc(currentMessage.event.StartTime)
|
|
550
|
-
.local()
|
|
551
|
-
.format('ddd D MMM')}
|
|
552
|
-
</Text>
|
|
553
|
-
</View>
|
|
554
|
-
</View>
|
|
555
|
-
</TouchableOpacity>
|
|
556
|
-
);
|
|
557
|
-
}
|
|
558
|
-
if (currentMessage.attachment) {
|
|
559
|
-
return (
|
|
560
|
-
<TouchableOpacity onPress={this.onPressAttachment.bind(this, currentMessage.attachment)}>
|
|
561
|
-
<View style={styles.eventContainer[position]}>
|
|
562
|
-
<Image style={[styles.eventImage, styles.eventImageMargin[position]]} source={{ uri: currentMessage.attachment.Thumbnail }} />
|
|
563
|
-
<View style={styles.eventInfo}>
|
|
564
|
-
<Text
|
|
565
|
-
numberOfLines={3}
|
|
566
|
-
style={[styles.eventTitle, styles.eventInfoAlign[position], { color: this.props.colourBrandingMain }]}
|
|
567
|
-
>
|
|
568
|
-
{currentMessage.attachment.Title}
|
|
569
|
-
</Text>
|
|
570
|
-
{currentMessage.attachment.StartTime && (
|
|
571
|
-
<Text style={[styles.eventDate, styles.eventInfoAlign[position], { color: this.props.colourBrandingMain }]}>
|
|
572
|
-
{moment
|
|
573
|
-
.utc(currentMessage.attachment.StartTime)
|
|
574
|
-
.local()
|
|
575
|
-
.format('ddd D MMM')}
|
|
576
|
-
</Text>
|
|
577
|
-
)}
|
|
578
|
-
</View>
|
|
579
|
-
</View>
|
|
580
|
-
</TouchableOpacity>
|
|
581
|
-
);
|
|
582
|
-
}
|
|
583
|
-
return null;
|
|
584
|
-
}
|
|
728
|
+
width: this.MIN_COMPOSER_HEIGHT,
|
|
729
|
+
height: this.MIN_COMPOSER_HEIGHT,
|
|
730
|
+
},
|
|
731
|
+
]}
|
|
732
|
+
>
|
|
733
|
+
<Icon
|
|
734
|
+
name={"picture-o"}
|
|
735
|
+
type="font-awesome"
|
|
736
|
+
iconStyle={[styles.send, { width: this.MIN_COMPOSER_HEIGHT }]}
|
|
737
|
+
/>
|
|
738
|
+
</TouchableOpacity>
|
|
585
739
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
height: this.MIN_COMPOSER_HEIGHT,
|
|
612
|
-
},
|
|
613
|
-
]}
|
|
614
|
-
>
|
|
615
|
-
<Icon name={'picture-o'} type="font-awesome" iconStyle={[styles.send, { width: this.MIN_COMPOSER_HEIGHT }]} />
|
|
616
|
-
</TouchableOpacity>
|
|
617
|
-
</View>
|
|
618
|
-
);
|
|
619
|
-
}
|
|
740
|
+
{/* Send button - only visible when there's text or images */}
|
|
741
|
+
{showSendButton && (
|
|
742
|
+
<Send
|
|
743
|
+
{...props}
|
|
744
|
+
alwaysShowSend={true}
|
|
745
|
+
onSend={props.onSend}
|
|
746
|
+
text={props.text || " "}
|
|
747
|
+
containerStyle={[
|
|
748
|
+
styles.sendContainer,
|
|
749
|
+
{
|
|
750
|
+
width: this.MIN_COMPOSER_HEIGHT,
|
|
751
|
+
height: this.MIN_COMPOSER_HEIGHT,
|
|
752
|
+
},
|
|
753
|
+
]}
|
|
754
|
+
>
|
|
755
|
+
<Icon
|
|
756
|
+
name={"paper-plane"}
|
|
757
|
+
type="font-awesome"
|
|
758
|
+
iconStyle={[styles.send, { width: this.MIN_COMPOSER_HEIGHT }]}
|
|
759
|
+
/>
|
|
760
|
+
</Send>
|
|
761
|
+
)}
|
|
762
|
+
</View>
|
|
763
|
+
);
|
|
764
|
+
}
|
|
620
765
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
766
|
+
renderAccessory(props) {
|
|
767
|
+
const hasAttachment = this.hasImagesAttached(props.imagesToUpload);
|
|
768
|
+
if (!hasAttachment) {
|
|
769
|
+
return null;
|
|
770
|
+
}
|
|
771
|
+
return (
|
|
772
|
+
<ScrollView horizontal style={styles.uploadImagesContainer}>
|
|
773
|
+
{props.imagesToUpload.map((image) => {
|
|
774
|
+
if (image.uploading) {
|
|
775
|
+
return (
|
|
776
|
+
<ImageUploadProgress
|
|
777
|
+
key={image.uploadUri}
|
|
778
|
+
uploader={this.imageUploader}
|
|
779
|
+
image={image}
|
|
780
|
+
color={this.props.colourBrandingMain}
|
|
781
|
+
style={{ width: IMAGE_PREVIEW_SIZE, marginRight: 10 }}
|
|
782
|
+
progressTextStyle={{ fontSize: 10 }}
|
|
783
|
+
/>
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
const isVideoUrl = isVideo(image.url);
|
|
787
|
+
return (
|
|
788
|
+
<View key={image.url} style={styles.accessoryImageContainer}>
|
|
789
|
+
<ImageBackground
|
|
790
|
+
style={styles.accessoryImage}
|
|
791
|
+
imageStyle={styles.accessoryImageBorder}
|
|
792
|
+
source={getImageSource(
|
|
793
|
+
image.thumbNailExists ? image.thumbNailUrl : image.url,
|
|
794
|
+
)}
|
|
795
|
+
>
|
|
796
|
+
{isVideoUrl && (
|
|
797
|
+
<View style={styles.imagePlayContainer}>
|
|
798
|
+
<TouchableOpacity
|
|
799
|
+
onPress={this.toggleFullscreenVideo.bind(this, image.url)}
|
|
800
|
+
>
|
|
801
|
+
<Icon
|
|
802
|
+
name="play"
|
|
803
|
+
type="font-awesome"
|
|
804
|
+
iconStyle={styles.imageControlIcon}
|
|
805
|
+
/>
|
|
806
|
+
</TouchableOpacity>
|
|
807
|
+
</View>
|
|
808
|
+
)}
|
|
809
|
+
</ImageBackground>
|
|
810
|
+
<TouchableOpacity
|
|
811
|
+
style={styles.previewItemRemoveButton}
|
|
812
|
+
onPress={() => this.onRemoveImage(image.url)}
|
|
813
|
+
hitSlop={{ top: 8, right: 8, bottom: 8, left: 8 }}
|
|
814
|
+
>
|
|
815
|
+
<View
|
|
816
|
+
style={[
|
|
817
|
+
styles.previewItemRemoveContainer,
|
|
818
|
+
{ backgroundColor: this.props.colourBrandingMain },
|
|
819
|
+
]}
|
|
820
|
+
>
|
|
821
|
+
<Icon
|
|
822
|
+
name="times"
|
|
823
|
+
type="font-awesome"
|
|
824
|
+
iconStyle={styles.previewItemRemoveIcon}
|
|
825
|
+
/>
|
|
826
|
+
</View>
|
|
827
|
+
</TouchableOpacity>
|
|
828
|
+
</View>
|
|
829
|
+
);
|
|
830
|
+
})}
|
|
831
|
+
</ScrollView>
|
|
832
|
+
);
|
|
833
|
+
}
|
|
672
834
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
835
|
+
renderInputToolbar(props) {
|
|
836
|
+
const hasAttachment = this.hasImagesAttached(props.imagesToUpload);
|
|
837
|
+
return (
|
|
838
|
+
<InputToolbar
|
|
839
|
+
{...props}
|
|
840
|
+
containerStyle={styles.inputContainer}
|
|
841
|
+
renderComposer={this.renderComposer.bind(this)}
|
|
842
|
+
renderAccessory={hasAttachment ? this.renderAccessory.bind(this) : null}
|
|
843
|
+
accessoryStyle={hasAttachment && styles.accessory}
|
|
844
|
+
/>
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
renderFooter() {
|
|
848
|
+
// if (this.state.keyboardOpen) {
|
|
849
|
+
// return null;
|
|
850
|
+
// }
|
|
851
|
+
// fixes an issue where there's no gap between bottom message and reply container
|
|
852
|
+
return <View style={{ height: 10 }} />;
|
|
853
|
+
}
|
|
854
|
+
renderLoading() {
|
|
855
|
+
return (
|
|
856
|
+
<View
|
|
857
|
+
style={{
|
|
858
|
+
marginTop: 15,
|
|
859
|
+
justifyContent: "center",
|
|
860
|
+
alignContent: "center",
|
|
861
|
+
}}
|
|
862
|
+
>
|
|
863
|
+
<Spinner size={"small"} color={this.props.colourBrandingMain} />
|
|
864
|
+
</View>
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
renderAvatar(props) {
|
|
868
|
+
return (
|
|
869
|
+
<View style={{ marginRight: 2 }}>
|
|
870
|
+
<ProfilePic
|
|
871
|
+
ProfilePic={props.currentMessage.user.avatar}
|
|
872
|
+
Diameter={28}
|
|
873
|
+
/>
|
|
874
|
+
</View>
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
renderComposer(props) {
|
|
878
|
+
return (
|
|
879
|
+
<View style={{ width: "100%" }}>
|
|
880
|
+
{/* Replying to section - stacked vertically on top */}
|
|
881
|
+
{this.state.replyingTo && (
|
|
882
|
+
<View style={styles.replyingTo}>
|
|
883
|
+
<Text type="body">
|
|
884
|
+
Replying to{" "}
|
|
885
|
+
{_.isEmpty(this.state.replyingTo?.user?.name)
|
|
886
|
+
? "message"
|
|
887
|
+
: this.state.replyingTo?.user?.name}
|
|
888
|
+
</Text>
|
|
889
|
+
<TouchableOpacity
|
|
890
|
+
style={styles.replyingRemoveButton}
|
|
891
|
+
onPress={() => this.onReply(null)}
|
|
892
|
+
hitSlop={{ top: 8, right: 8, bottom: 8, left: 8 }}
|
|
893
|
+
>
|
|
894
|
+
<View
|
|
895
|
+
style={[
|
|
896
|
+
styles.replyingRemoveContainer,
|
|
897
|
+
{ backgroundColor: this.props.colourBrandingMain },
|
|
898
|
+
]}
|
|
899
|
+
>
|
|
900
|
+
<Icon
|
|
901
|
+
name="times"
|
|
902
|
+
type="font-awesome"
|
|
903
|
+
iconStyle={styles.replyingRemoveIcon}
|
|
904
|
+
/>
|
|
905
|
+
</View>
|
|
906
|
+
</TouchableOpacity>
|
|
907
|
+
</View>
|
|
908
|
+
)}
|
|
909
|
+
{/* Horizontal row for input - buttons are absolutely positioned via renderSend */}
|
|
910
|
+
<View
|
|
911
|
+
style={{
|
|
912
|
+
flexDirection: "row",
|
|
913
|
+
alignItems: "flex-end",
|
|
914
|
+
width: "100%",
|
|
915
|
+
paddingBottom: 8,
|
|
916
|
+
}}
|
|
917
|
+
>
|
|
918
|
+
<View
|
|
919
|
+
style={[
|
|
920
|
+
styles.input,
|
|
921
|
+
{
|
|
922
|
+
flex: 1,
|
|
923
|
+
marginRight:
|
|
924
|
+
_.isEmpty(props.text) &&
|
|
925
|
+
!this.hasImagesReady(props.imagesToUpload)
|
|
926
|
+
? 16 + this.MIN_COMPOSER_HEIGHT
|
|
927
|
+
: 2 * (this.MIN_COMPOSER_HEIGHT + 8),
|
|
928
|
+
paddingHorizontal: 12,
|
|
929
|
+
paddingVertical: Platform.select({ ios: 8, android: 6 }),
|
|
930
|
+
},
|
|
931
|
+
]}
|
|
932
|
+
>
|
|
933
|
+
<TextInput
|
|
934
|
+
maxFontSizeMultiplier={1.2}
|
|
935
|
+
placeholder="Type a message..."
|
|
936
|
+
multiline
|
|
937
|
+
value={props.text}
|
|
938
|
+
onChangeText={props.onTextChanged}
|
|
939
|
+
style={[
|
|
940
|
+
styles.inputText,
|
|
941
|
+
{
|
|
942
|
+
lineHeight: 20,
|
|
943
|
+
minHeight: this.MIN_COMPOSER_HEIGHT - 16,
|
|
944
|
+
maxHeight: 100,
|
|
945
|
+
},
|
|
946
|
+
]}
|
|
947
|
+
onFocus={this.onFocusInput.bind(this)}
|
|
948
|
+
onBlur={this.onBlurInput.bind(this)}
|
|
949
|
+
placeholderTextColor="#999"
|
|
950
|
+
/>
|
|
951
|
+
</View>
|
|
952
|
+
</View>
|
|
953
|
+
</View>
|
|
954
|
+
);
|
|
955
|
+
}
|
|
758
956
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
957
|
+
/***
|
|
958
|
+
* Main Render
|
|
959
|
+
*/
|
|
960
|
+
renderChat() {
|
|
961
|
+
const minInputToolbarHeight =
|
|
962
|
+
this.MIN_COMPOSER_HEIGHT +
|
|
963
|
+
32 +
|
|
964
|
+
(this.state.replyingTo ? 38 : 0) +
|
|
965
|
+
(this.hasImagesAttached() ? IMAGE_PREVIEW_AREA_HEIGHT : 0);
|
|
767
966
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
967
|
+
return (
|
|
968
|
+
<GiftedChat
|
|
969
|
+
isKeyboardInternallyHandled={false}
|
|
970
|
+
alwaysShowSend={false}
|
|
971
|
+
keyboardShouldPersistTaps={"never"}
|
|
972
|
+
renderAvatarOnTop
|
|
973
|
+
minInputToolbarHeight={minInputToolbarHeight}
|
|
974
|
+
minComposerHeight={this.MIN_COMPOSER_HEIGHT}
|
|
975
|
+
bottomOffset={0}
|
|
976
|
+
onSend={this.sendMessages.bind(this)}
|
|
977
|
+
messages={this.state.messages}
|
|
978
|
+
user={this.state.currentUser}
|
|
979
|
+
renderBubble={this.renderBubble.bind(this)}
|
|
980
|
+
renderMessage={this.renderMessage.bind(this)}
|
|
981
|
+
renderMessageText={this.renderMessageText.bind(this)}
|
|
982
|
+
renderTime={this.renderTime.bind(this)}
|
|
983
|
+
renderDay={this.renderDay.bind(this)}
|
|
984
|
+
renderCustomView={this.renderCustomView.bind(this)}
|
|
985
|
+
renderSend={this.renderSend.bind(this)}
|
|
986
|
+
renderInputToolbar={this.renderInputToolbar.bind(this)}
|
|
987
|
+
renderFooter={this.renderFooter.bind(this)}
|
|
988
|
+
renderLoading={this.renderLoading.bind(this)}
|
|
989
|
+
renderAvatar={this.renderAvatar.bind(this)}
|
|
990
|
+
imagesToUpload={this.state.imagesToUpload}
|
|
991
|
+
/>
|
|
992
|
+
);
|
|
993
|
+
}
|
|
793
994
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
995
|
+
renderImageUploader() {
|
|
996
|
+
return (
|
|
997
|
+
<ImageUploader
|
|
998
|
+
ref={(ref) => (this.imageUploader = ref)}
|
|
999
|
+
onUploadStarted={this.onUploadStarted}
|
|
1000
|
+
onUploadProgress={this.onUploadProgress}
|
|
1001
|
+
onUploadSuccess={this.onUploadSuccess}
|
|
1002
|
+
onUploadFailed={this.onUploadFailed}
|
|
1003
|
+
onLibrarySelected={this.onLibrarySelected}
|
|
1004
|
+
quality={0.8}
|
|
1005
|
+
allowsEditing={false}
|
|
1006
|
+
fileName={"imageInput"}
|
|
1007
|
+
popupTitle={"Add Image"}
|
|
1008
|
+
userId={this.props.user.uid}
|
|
1009
|
+
multiple
|
|
1010
|
+
allowVideo
|
|
1011
|
+
/>
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
813
1014
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
}
|
|
1015
|
+
renderImagePopup() {
|
|
1016
|
+
const { imagePopupOpen, imagePopupSource, imagePopupIndex } = this.state;
|
|
1017
|
+
return (
|
|
1018
|
+
<ImagePopup
|
|
1019
|
+
visible={imagePopupOpen}
|
|
1020
|
+
images={imagePopupSource}
|
|
1021
|
+
index={imagePopupIndex}
|
|
1022
|
+
onClose={this.closeGallery.bind(this)}
|
|
1023
|
+
/>
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
826
1026
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1027
|
+
renderVideoPlayerPopup() {
|
|
1028
|
+
const { showFullscreenVideo, currentVideoUrl } = this.state;
|
|
1029
|
+
if (!currentVideoUrl) return;
|
|
830
1030
|
|
|
831
|
-
|
|
832
|
-
|
|
1031
|
+
return (
|
|
1032
|
+
<VideoPopup
|
|
1033
|
+
uri={currentVideoUrl}
|
|
1034
|
+
visible={showFullscreenVideo}
|
|
1035
|
+
onClose={this.toggleFullscreenVideo}
|
|
1036
|
+
/>
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
833
1039
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
1040
|
+
renderPDF() {
|
|
1041
|
+
if (_.isEmpty(this.state.selectedPDF)) {
|
|
1042
|
+
return null;
|
|
1043
|
+
}
|
|
1044
|
+
return (
|
|
1045
|
+
<PDFPopup
|
|
1046
|
+
source={this.state.selectedPDF}
|
|
1047
|
+
onClose={this.onCloseAttachment}
|
|
1048
|
+
title={getFileName(this.state.selectedPDF)}
|
|
1049
|
+
pdfCount={1}
|
|
1050
|
+
/>
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
842
1053
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
1054
|
+
renderDeleteConfirmPopup() {
|
|
1055
|
+
return (
|
|
1056
|
+
<ConfirmPopup
|
|
1057
|
+
visible={this.state.showDeleteMessageConfirm}
|
|
1058
|
+
onConfirm={this.onConfirmDeleteMessage}
|
|
1059
|
+
onCancel={this.onCancelDeleteMessage}
|
|
1060
|
+
text="Are you sure you want to delete this message?"
|
|
1061
|
+
yesText="Delete"
|
|
1062
|
+
noText="Cancel"
|
|
1063
|
+
/>
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
855
1066
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}
|
|
869
|
-
return (
|
|
870
|
-
<View style={styles.chatContainer}>
|
|
871
|
-
{this.renderChat()}
|
|
872
|
-
{this.renderImageUploader()}
|
|
873
|
-
{this.renderImagePopup()}
|
|
874
|
-
{this.renderVideoPlayerPopup()}
|
|
875
|
-
{this.renderPDF()}
|
|
876
|
-
{this.renderDeleteConfirmPopup()}
|
|
877
|
-
</View>
|
|
878
|
-
);
|
|
879
|
-
}
|
|
1067
|
+
render() {
|
|
1068
|
+
return (
|
|
1069
|
+
<KeyboardAvoidingView behavior="padding" style={styles.chatContainer}>
|
|
1070
|
+
{this.renderChat()}
|
|
1071
|
+
{this.renderImageUploader()}
|
|
1072
|
+
{this.renderImagePopup()}
|
|
1073
|
+
{this.renderVideoPlayerPopup()}
|
|
1074
|
+
{this.renderPDF()}
|
|
1075
|
+
{this.renderDeleteConfirmPopup()}
|
|
1076
|
+
</KeyboardAvoidingView>
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
880
1079
|
}
|
|
881
1080
|
|
|
882
1081
|
const styles = {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1082
|
+
chatContainer: {
|
|
1083
|
+
flex: 1,
|
|
1084
|
+
justifyContent: "center",
|
|
1085
|
+
},
|
|
1086
|
+
eventContainer: {
|
|
1087
|
+
left: {
|
|
1088
|
+
paddingTop: 5,
|
|
1089
|
+
paddingLeft: 15,
|
|
1090
|
+
paddingRight: 15,
|
|
1091
|
+
paddingBottom: 5,
|
|
1092
|
+
flexDirection: "row",
|
|
1093
|
+
},
|
|
1094
|
+
right: {
|
|
1095
|
+
paddingTop: 5,
|
|
1096
|
+
paddingLeft: 15,
|
|
1097
|
+
paddingRight: 15,
|
|
1098
|
+
paddingBottom: 5,
|
|
1099
|
+
flexDirection: "row-reverse",
|
|
1100
|
+
},
|
|
1101
|
+
},
|
|
1102
|
+
eventImage: {
|
|
1103
|
+
width: 80,
|
|
1104
|
+
height: 80,
|
|
1105
|
+
resizeMode: "cover",
|
|
1106
|
+
borderRadius: 2,
|
|
1107
|
+
},
|
|
1108
|
+
eventImageMargin: {
|
|
1109
|
+
right: {
|
|
1110
|
+
marginLeft: 15,
|
|
1111
|
+
},
|
|
1112
|
+
left: {
|
|
1113
|
+
marginRight: 15,
|
|
1114
|
+
},
|
|
1115
|
+
},
|
|
1116
|
+
eventInfo: {
|
|
1117
|
+
minHeight: 80,
|
|
1118
|
+
width: 150,
|
|
1119
|
+
},
|
|
1120
|
+
eventTitle: {
|
|
1121
|
+
fontSize: 12,
|
|
1122
|
+
fontFamily: "sf-bold",
|
|
1123
|
+
backgroundColor: "rgba(255,255,255,0)",
|
|
1124
|
+
},
|
|
1125
|
+
eventInfoAlign: {
|
|
1126
|
+
left: {
|
|
1127
|
+
textAlign: "left",
|
|
1128
|
+
},
|
|
1129
|
+
right: {
|
|
1130
|
+
textAlign: "right",
|
|
1131
|
+
},
|
|
1132
|
+
},
|
|
1133
|
+
messageImageLarge: {
|
|
1134
|
+
width: IMAGE_SIZE_LARGE,
|
|
1135
|
+
height: IMAGE_SIZE_LARGE,
|
|
1136
|
+
borderRadius: 2,
|
|
1137
|
+
alignSelf: "center",
|
|
1138
|
+
},
|
|
1139
|
+
messageImageSmall: {
|
|
1140
|
+
width: IMAGE_SIZE_SMALL,
|
|
1141
|
+
height: IMAGE_SIZE_SMALL,
|
|
1142
|
+
borderRadius: 2,
|
|
1143
|
+
alignSelf: "center",
|
|
1144
|
+
marginRight: IMAGE_MARGIN,
|
|
1145
|
+
marginBottom: IMAGE_MARGIN,
|
|
1146
|
+
},
|
|
1147
|
+
eventDate: {
|
|
1148
|
+
fontSize: 12,
|
|
1149
|
+
fontFamily: "sf-regular",
|
|
1150
|
+
backgroundColor: "rgba(255,255,255,0)",
|
|
1151
|
+
},
|
|
1152
|
+
inputContainer: {
|
|
1153
|
+
backgroundColor: "#fff",
|
|
1154
|
+
paddingVertical: 8,
|
|
1155
|
+
paddingHorizontal: 8,
|
|
1156
|
+
},
|
|
1157
|
+
inputText: {
|
|
1158
|
+
color: TEXT_DARKEST,
|
|
1159
|
+
fontSize: 14,
|
|
1160
|
+
fontFamily: "sf-medium",
|
|
1161
|
+
},
|
|
1162
|
+
input: {
|
|
1163
|
+
margin: 0,
|
|
1164
|
+
backgroundColor: BG_GREY,
|
|
1165
|
+
borderRadius: 5,
|
|
1166
|
+
flex: 1,
|
|
1167
|
+
},
|
|
1168
|
+
composerContainer: {
|
|
1169
|
+
flex: 1,
|
|
1170
|
+
},
|
|
1171
|
+
composerInputWrapper: {
|
|
1172
|
+
flex: 1,
|
|
1173
|
+
flexDirection: "row",
|
|
1174
|
+
},
|
|
1175
|
+
replyingTo: {
|
|
1176
|
+
minHeight: 30,
|
|
1177
|
+
flexDirection: "row",
|
|
1178
|
+
alignItems: "center",
|
|
1179
|
+
borderBottomWidth: 1,
|
|
1180
|
+
borderBottomColor: LINEGREY,
|
|
1181
|
+
marginBottom: 8,
|
|
1182
|
+
},
|
|
1183
|
+
replyingRemoveButton: {
|
|
1184
|
+
marginLeft: 10,
|
|
1185
|
+
},
|
|
1186
|
+
replyingRemoveContainer: {
|
|
1187
|
+
justifyContent: "center",
|
|
1188
|
+
alignItems: "center",
|
|
1189
|
+
borderRadius: 10,
|
|
1190
|
+
width: 20,
|
|
1191
|
+
height: 20,
|
|
1192
|
+
borderWidth: 2,
|
|
1193
|
+
borderColor: "#fff",
|
|
1194
|
+
},
|
|
1195
|
+
replyingRemoveIcon: {
|
|
1196
|
+
fontSize: 10,
|
|
1197
|
+
color: "#fff",
|
|
1198
|
+
marginBottom: 1,
|
|
1199
|
+
},
|
|
1200
|
+
sendContainer: {
|
|
1201
|
+
position: "absolute",
|
|
1202
|
+
top: 0,
|
|
1203
|
+
right: 0,
|
|
1204
|
+
height: 30,
|
|
1205
|
+
width: 30,
|
|
1206
|
+
alignItems: "center",
|
|
1207
|
+
justifyContent: "center",
|
|
1208
|
+
backgroundColor: "#fff",
|
|
1209
|
+
},
|
|
1210
|
+
send: {
|
|
1211
|
+
fontSize: 15,
|
|
1212
|
+
color: TEXT_BLUEGREY,
|
|
1213
|
+
fontSize: 24,
|
|
1214
|
+
textAlign: "center",
|
|
1215
|
+
},
|
|
1216
|
+
accessory: {
|
|
1217
|
+
height: IMAGE_PREVIEW_AREA_HEIGHT,
|
|
1218
|
+
borderTopWidth: 1,
|
|
1219
|
+
borderTopColor: LINEGREY,
|
|
1220
|
+
paddingTop: 8,
|
|
1221
|
+
marginTop: 8,
|
|
1222
|
+
},
|
|
1223
|
+
accessoryImageContainer: {
|
|
1224
|
+
paddingRight: 8,
|
|
1225
|
+
paddingTop: 8,
|
|
1226
|
+
marginRight: 5,
|
|
1227
|
+
},
|
|
1228
|
+
accessoryImage: {
|
|
1229
|
+
width: IMAGE_PREVIEW_SIZE,
|
|
1230
|
+
height: IMAGE_PREVIEW_SIZE,
|
|
1231
|
+
},
|
|
1232
|
+
accessoryImageBorder: {
|
|
1233
|
+
borderRadius: 2,
|
|
1234
|
+
},
|
|
1235
|
+
settingDropDownOpen: {
|
|
1236
|
+
height: "auto",
|
|
1237
|
+
},
|
|
1238
|
+
imagesContainer: {
|
|
1239
|
+
marginLeft: 10,
|
|
1240
|
+
marginRight: 10,
|
|
1241
|
+
flexDirection: "row",
|
|
1242
|
+
flexWrap: "wrap",
|
|
1243
|
+
},
|
|
1244
|
+
uploadImagesContainer: {
|
|
1245
|
+
flexDirection: "row",
|
|
1246
|
+
overflow: "visible",
|
|
1247
|
+
},
|
|
1248
|
+
previewItemRemoveButton: {
|
|
1249
|
+
position: "absolute",
|
|
1250
|
+
top: 0,
|
|
1251
|
+
right: 0,
|
|
1252
|
+
},
|
|
1253
|
+
previewItemRemoveContainer: {
|
|
1254
|
+
justifyContent: "center",
|
|
1255
|
+
alignItems: "center",
|
|
1256
|
+
borderRadius: 10,
|
|
1257
|
+
width: 20,
|
|
1258
|
+
height: 20,
|
|
1259
|
+
borderWidth: 2,
|
|
1260
|
+
borderColor: "#fff",
|
|
1261
|
+
},
|
|
1262
|
+
previewItemRemoveIcon: {
|
|
1263
|
+
fontSize: 10,
|
|
1264
|
+
color: "#fff",
|
|
1265
|
+
marginBottom: 1,
|
|
1266
|
+
},
|
|
1267
|
+
imagePlayContainer: {
|
|
1268
|
+
position: "absolute",
|
|
1269
|
+
top: 0,
|
|
1270
|
+
left: 0,
|
|
1271
|
+
right: 0,
|
|
1272
|
+
bottom: 0,
|
|
1273
|
+
alignItems: "center",
|
|
1274
|
+
justifyContent: "center",
|
|
1275
|
+
},
|
|
1276
|
+
imageControlIcon: {
|
|
1277
|
+
color: "#fff",
|
|
1278
|
+
fontSize: 20,
|
|
1279
|
+
textShadowColor: "rgba(0,0,0,0.3)",
|
|
1280
|
+
textShadowOffset: { width: 2, height: 2 },
|
|
1281
|
+
},
|
|
1083
1282
|
};
|
|
1084
1283
|
|
|
1085
|
-
const mapStateToProps = state => {
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1284
|
+
const mapStateToProps = (state) => {
|
|
1285
|
+
return {
|
|
1286
|
+
user: state.user,
|
|
1287
|
+
colourBrandingMain: getMainBrandingColourFromState(state),
|
|
1288
|
+
colourBrandingLight: getLightBrandingColourFromState(state),
|
|
1289
|
+
tabCount: getEnabledTabsFromState(state).length,
|
|
1290
|
+
};
|
|
1092
1291
|
};
|
|
1093
1292
|
|
|
1094
|
-
export default connect(mapStateToProps, {})(PlussChat);
|
|
1293
|
+
export default connect(mapStateToProps, {})(withSafeAreaInsets(PlussChat));
|