agora-appbuilder-core 2.2.0 → 2.3.0-beta.10
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/Readme.md +7 -1
- package/package.json +4 -3
- package/template/Gulpfile.js +389 -82
- package/template/_gitignore +4 -1
- package/template/_package-lock.json +32214 -3080
- package/template/agora-rn-uikit/src/AgoraUIKit.tsx +23 -20
- package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +13 -8
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +25 -9
- package/template/agora-rn-uikit/src/Contexts/RenderContext.tsx +10 -0
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +11 -5
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +6 -2
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +1 -1
- package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +6 -2
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +2 -2
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +2 -2
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +6 -2
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +11 -6
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +10 -6
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +7 -6
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +6 -5
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +3 -3
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +16 -13
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +16 -13
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +13 -13
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +16 -13
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +28 -31
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +48 -35
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +11 -13
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +11 -13
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +18 -15
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +22 -3
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +19 -3
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +161 -44
- package/template/agora-rn-uikit/src/Utils/useLocalUid.ts +8 -0
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +8 -6
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +8 -6
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +18 -9
- package/template/agora-rn-uikit/src/index.ts +12 -12
- package/template/babel.config.js +17 -1
- package/template/bridge/rtc/webNg/RtcEngine.ts +34 -28
- package/template/bridge/rtc/webNg/SurfaceView.tsx +3 -2
- package/template/bridge/rtc/webNg/Types.ts +14 -0
- package/template/bridge/rtc/webNg/index.ts +5 -2
- package/template/bridge/rtm/web/index.ts +13 -7
- package/template/electron-builder.js +3 -2
- package/template/esbuild.rsdk.go +240 -0
- package/template/{src/subComponents/LayoutEnum.tsx → esbuildConfigTransform.js} +1 -5
- package/template/fpe-api/components.ts +43 -0
- package/template/fpe-api/context.ts +45 -0
- package/template/fpe-api/fpeEvents.ts +9 -0
- package/template/fpe-api/index.ts +21 -0
- package/template/fpe-api/install.ts +138 -0
- package/template/fpe-api/typeDefinition.ts +144 -0
- package/template/fpe-api/useFpe.tsx +35 -0
- package/template/fpe-api/utils.ts +61 -0
- package/template/fpe-implementation/createHook.ts +33 -0
- package/template/fpe-implementation/dummyFpe.ts +17 -0
- package/template/fpe-implementation/index.ts +1 -0
- package/template/fpe-todo.txt +14 -0
- package/template/fpe.config.js +29 -0
- package/template/global.d.ts +4 -0
- package/template/index.rsdk.tsx +27 -0
- package/template/index.wsdk.tsx +27 -0
- package/template/package.json +30 -13
- package/template/react-native-toast-message/src/index.js +9 -10
- package/template/react-native-toast-message/src/index.wsdk.js +419 -0
- package/template/src/App.tsx +97 -65
- package/template/src/AppWrapper.tsx +79 -0
- package/template/src/SDKAppWrapper.tsx +67 -0
- package/template/src/atoms/PrimaryButton.tsx +14 -8
- package/template/src/atoms/TextInput.tsx +13 -5
- package/template/src/components/Chat.tsx +178 -137
- package/template/src/components/ChatContext.ts +18 -22
- package/template/src/components/ColorConfigure.tsx +2 -2
- package/template/src/components/Controls.native.tsx +72 -62
- package/template/src/components/Controls.tsx +90 -69
- package/template/src/components/DeviceConfigure.tsx +1 -1
- package/template/src/components/DeviceContext.tsx +14 -7
- package/template/src/components/GraphQLProvider.tsx +9 -2
- package/template/src/components/GridVideo.tsx +20 -159
- package/template/src/components/HostControlView.tsx +54 -15
- package/template/src/components/Navbar.tsx +408 -157
- package/template/src/components/NetworkQualityContext.tsx +29 -22
- package/template/src/components/ParticipantsView.tsx +91 -115
- package/template/src/components/PinnedVideo.tsx +41 -188
- package/template/src/components/Precall.native.tsx +131 -97
- package/template/src/components/Precall.tsx +193 -158
- package/template/src/components/RTMConfigure.tsx +309 -415
- package/template/src/components/Router.sdk.ts +20 -0
- package/template/src/components/SessionContext.tsx +6 -3
- package/template/src/components/Settings.native.tsx +3 -0
- package/template/src/components/Settings.tsx +65 -31
- package/template/src/components/SettingsView.tsx +14 -8
- package/template/src/components/Share.tsx +188 -220
- package/template/src/components/StorageContext.tsx +5 -5
- package/template/src/components/StoreToken.tsx +5 -1
- package/template/src/components/chat-messages/useChatMessages.tsx +208 -0
- package/template/src/components/chat-notification/useChatNotification.tsx +78 -0
- package/template/src/components/chat-ui/useChatUIControl.tsx +66 -0
- package/template/src/components/common/Error.tsx +54 -0
- package/template/src/components/common/Logo.tsx +35 -0
- package/template/src/components/common/index.tsx +8 -0
- package/template/src/components/contexts/LiveStreamDataContext.tsx +79 -0
- package/template/src/components/contexts/ScreenShareContext.tsx +47 -0
- package/template/src/components/contexts/WhiteboardContext.tsx +59 -0
- package/template/src/components/dimension/DimensionContext.ts +27 -0
- package/template/src/components/dimension/DimensionProvider.tsx +34 -0
- package/template/src/components/livestream/LiveStreamContext.tsx +297 -273
- package/template/src/components/livestream/Types.ts +26 -7
- package/template/src/components/livestream/index.ts +13 -2
- package/template/src/components/livestream/views/LiveStreamControls.tsx +5 -1
- package/template/src/components/meeting-info/useMeetingInfo.tsx +63 -0
- package/template/src/components/meeting-info/useSetMeetingInfo.tsx +38 -0
- package/template/src/components/participants/AllAudienceParticipants.tsx +26 -21
- package/template/src/components/participants/AllHostParticipants.tsx +41 -53
- package/template/src/components/participants/MeParticipant.tsx +9 -10
- package/template/src/components/participants/ParticipantName.tsx +2 -1
- package/template/src/components/participants/RemoteParticipants.tsx +3 -3
- package/template/src/components/precall/LocalMute.native.tsx +91 -0
- package/template/src/components/precall/LocalMute.tsx +90 -0
- package/template/src/components/precall/VideoPreview.native.tsx +35 -0
- package/template/src/components/precall/VideoPreview.tsx +33 -0
- package/template/src/components/precall/index.tsx +28 -0
- package/template/src/components/precall/joinCallBtn.native.tsx +69 -0
- package/template/src/components/precall/joinCallBtn.tsx +91 -0
- package/template/src/components/precall/meetingTitle.tsx +26 -0
- package/template/src/components/precall/selectDevice.tsx +46 -0
- package/template/src/components/precall/textInput.tsx +43 -0
- package/template/src/components/precall/usePreCall.tsx +41 -0
- package/template/src/components/styles.ts +20 -3
- package/template/src/components/useShareLink.tsx +237 -0
- package/template/src/components/useUserPreference.tsx +125 -0
- package/template/src/components/useWakeLock.tsx +3 -3
- package/template/src/custom-events/CustomEvents.ts +238 -0
- package/template/src/custom-events/index.tsx +4 -0
- package/template/src/custom-events/types.ts +51 -0
- package/template/src/language/default-labels/commonLabels.ts +21 -0
- package/template/src/language/default-labels/createScreenLabels.ts +22 -0
- package/template/src/language/default-labels/index.ts +38 -0
- package/template/src/language/default-labels/joinScreenLabels.ts +13 -0
- package/template/src/language/default-labels/precallScreenLabels.ts +33 -0
- package/template/src/language/default-labels/shareLinkScreenLabels.ts +44 -0
- package/template/src/language/default-labels/videoCallScreenLabels.ts +191 -0
- package/template/src/language/i18nTypes.ts +10 -0
- package/template/src/language/index.ts +18 -0
- package/template/src/language/useLanguage.tsx +92 -0
- package/template/src/pages/Authenticate.tsx +21 -15
- package/template/src/pages/Create.tsx +180 -159
- package/template/src/pages/Join.tsx +47 -32
- package/template/src/pages/VideoCall.tsx +138 -407
- package/template/src/pages/create/useCreate.tsx +37 -0
- package/template/src/pages/video-call/CustomLayout.ts +17 -0
- package/template/src/pages/video-call/CustomUserContextHolder.tsx +20 -0
- package/template/src/pages/video-call/DefaultLayouts.ts +65 -0
- package/template/src/pages/video-call/NameWithMicStatus.tsx +62 -0
- package/template/src/pages/video-call/RenderComponent.tsx +52 -0
- package/template/src/pages/video-call/VideoCallScreen.tsx +191 -0
- package/template/src/pages/video-call/VideoComponent.tsx +34 -0
- package/template/src/pages/video-call/VideoRenderer.tsx +86 -0
- package/template/src/pages/video-call/index.ts +20 -0
- package/template/src/rtm/RTMEngine.ts +58 -0
- package/template/src/rtm/utils.ts +44 -0
- package/template/src/rtm-events/EventUtils.ts +267 -0
- package/template/src/rtm-events/EventsQueue.ts +38 -0
- package/template/src/rtm-events/constants.ts +42 -0
- package/template/src/rtm-events/index.tsx +8 -0
- package/template/src/rtm-events/types.ts +7 -0
- package/template/src/subComponents/ChatBubble.tsx +21 -12
- package/template/src/subComponents/ChatContainer.tsx +79 -30
- package/template/src/subComponents/ChatInput.tsx +146 -70
- package/template/src/subComponents/CopyJoinInfo.tsx +52 -67
- package/template/src/subComponents/Error.tsx +35 -24
- package/template/src/subComponents/LanguageSelector.tsx +85 -0
- package/template/src/subComponents/LayoutIconDropdown.native.tsx +163 -0
- package/template/src/subComponents/LayoutIconDropdown.tsx +198 -0
- package/template/src/subComponents/LocalAudioMute.tsx +52 -30
- package/template/src/subComponents/LocalEndCall.tsx +52 -0
- package/template/src/subComponents/LocalSwitchCamera.tsx +61 -0
- package/template/src/subComponents/LocalVideoMute.tsx +48 -30
- package/template/src/subComponents/LogoutButton.tsx +20 -5
- package/template/src/subComponents/NetworkQualityPill.tsx +43 -13
- package/template/src/subComponents/OpenInNativeButton.tsx +3 -2
- package/template/src/subComponents/Recording.tsx +46 -138
- package/template/src/subComponents/RemoteAudioMute.tsx +30 -34
- package/template/src/subComponents/RemoteEndCall.tsx +18 -7
- package/template/src/subComponents/RemoteVideoMute.tsx +17 -9
- package/template/src/subComponents/ScreenShareNotice.tsx +40 -40
- package/template/src/subComponents/SelectDevice.tsx +88 -45
- package/template/src/subComponents/SelectOAuth.tsx +30 -6
- package/template/src/subComponents/SidePanelButtons.ts +39 -0
- package/template/src/subComponents/TextWithTooltip.native.tsx +2 -1
- package/template/src/subComponents/TextWithTooltip.tsx +15 -20
- package/template/src/subComponents/chat/ChatParticipants.tsx +31 -32
- package/template/src/subComponents/livestream/ApprovedLiveStreamControlsView.tsx +7 -3
- package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +32 -18
- package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +22 -8
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +12 -7
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +24 -27
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +23 -26
- package/template/src/subComponents/livestream/index.ts +10 -2
- package/template/src/subComponents/recording/useRecording.tsx +209 -0
- package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +64 -0
- package/template/src/subComponents/screenshare/ScreenshareButton.native.tsx +18 -0
- package/template/src/subComponents/screenshare/ScreenshareButton.tsx +61 -31
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +57 -52
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +104 -144
- package/template/src/subComponents/screenshare/useScreenshare.tsx +29 -0
- package/template/src/subComponents/toastConfig.tsx +25 -20
- package/template/src/utils/IsAttendeeUser.ts +34 -0
- package/template/src/utils/SdkEvents.ts +68 -0
- package/template/src/utils/common.tsx +40 -0
- package/template/src/utils/eventEmitter.ts +29 -0
- package/template/src/utils/getMeetingInvite.ts +53 -0
- package/template/src/utils/index.tsx +11 -2
- package/template/src/utils/isAudioEnabled.ts +29 -0
- package/template/src/utils/isHostUser.ts +33 -0
- package/template/src/utils/isMobileOrTablet.native.ts +5 -0
- package/template/src/utils/{mobileWebTest.tsx → isMobileOrTablet.ts} +5 -2
- package/template/src/utils/isPSTNUser.ts +30 -0
- package/template/src/utils/isSDK.sdk.ts +5 -0
- package/template/src/utils/isSDK.ts +5 -0
- package/template/src/utils/isScreenShareUser.ts +31 -0
- package/template/src/utils/isVideoEnabled.ts +29 -0
- package/template/src/utils/useButtonTemplate.tsx +43 -0
- package/template/src/utils/useCreateMeeting.ts +74 -0
- package/template/src/utils/useGetLiveStreamingRequests.ts +24 -0
- package/template/src/utils/useGetMeetingPhrase.ts +68 -0
- package/template/src/utils/useGetName.ts +19 -0
- package/template/src/{subComponents/screenshare/ScreenshareContext.tsx → utils/useGroupMessages.ts} +10 -7
- package/template/src/utils/useJoinMeeting.ts +128 -0
- package/template/src/utils/useLayout.tsx +40 -0
- package/template/src/utils/useLiveStreamingUids.ts +26 -0
- package/template/src/utils/useLocalShareScreenUid.ts +19 -0
- package/template/src/utils/useMutePSTN.ts +43 -0
- package/template/src/utils/useMuteToggleLocal.ts +109 -0
- package/template/src/utils/useNavParams.ts +6 -0
- package/template/src/utils/useNavigateTo.ts +8 -0
- package/template/src/utils/usePrivateMessages.ts +33 -0
- package/template/src/utils/useRemoteEndCall.ts +27 -0
- package/template/src/utils/useRemoteMute.ts +64 -0
- package/template/src/utils/useSendControlMessage.ts +51 -0
- package/template/src/utils/useSendMessage.ts +40 -0
- package/template/src/utils/useSetName.ts +18 -0
- package/template/src/utils/useSetUnreadMessageCount.ts +43 -0
- package/template/src/utils/useSidePanel.tsx +41 -0
- package/template/src/utils/useString.ts +61 -0
- package/template/src/utils/useUnreadMessageCount.ts +50 -0
- package/template/src/utils/useUserList.ts +26 -0
- package/template/tsconfig.json +4 -4
- package/template/tsconfig_fpeApi.json +103 -0
- package/template/tsconfig_rsdk_index.json +105 -0
- package/template/tsconfig_wsdk_index.json +104 -0
- package/template/webpack.commons.js +40 -16
- package/template/webpack.main.config.js +2 -1
- package/template/webpack.renderer.config.js +1 -1
- package/template/webpack.rsdk.config.js +33 -0
- package/template/webpack.ts.config.js +89 -0
- package/template/webpack.web.config.js +8 -1
- package/template/webpack.wsdk.config.js +34 -0
- package/template/agora-rn-uikit/.git/HEAD +0 -1
- package/template/agora-rn-uikit/.git/config +0 -16
- package/template/agora-rn-uikit/.git/description +0 -1
- package/template/agora-rn-uikit/.git/hooks/applypatch-msg.sample +0 -15
- package/template/agora-rn-uikit/.git/hooks/commit-msg.sample +0 -24
- package/template/agora-rn-uikit/.git/hooks/fsmonitor-watchman.sample +0 -173
- package/template/agora-rn-uikit/.git/hooks/post-update.sample +0 -8
- package/template/agora-rn-uikit/.git/hooks/pre-applypatch.sample +0 -14
- package/template/agora-rn-uikit/.git/hooks/pre-commit.sample +0 -49
- package/template/agora-rn-uikit/.git/hooks/pre-merge-commit.sample +0 -13
- package/template/agora-rn-uikit/.git/hooks/pre-push.sample +0 -53
- package/template/agora-rn-uikit/.git/hooks/pre-rebase.sample +0 -169
- package/template/agora-rn-uikit/.git/hooks/pre-receive.sample +0 -24
- package/template/agora-rn-uikit/.git/hooks/prepare-commit-msg.sample +0 -42
- package/template/agora-rn-uikit/.git/hooks/push-to-checkout.sample +0 -78
- package/template/agora-rn-uikit/.git/hooks/update.sample +0 -128
- package/template/agora-rn-uikit/.git/index +0 -0
- package/template/agora-rn-uikit/.git/info/exclude +0 -6
- package/template/agora-rn-uikit/.git/logs/HEAD +0 -2
- package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +0 -1
- package/template/agora-rn-uikit/.git/logs/refs/heads/master +0 -1
- package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +0 -1
- package/template/agora-rn-uikit/.git/objects/pack/pack-0061d00cd98162a329a32b537488a35d0abeb069.idx +0 -0
- package/template/agora-rn-uikit/.git/objects/pack/pack-0061d00cd98162a329a32b537488a35d0abeb069.pack +0 -0
- package/template/agora-rn-uikit/.git/packed-refs +0 -24
- package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +0 -1
- package/template/agora-rn-uikit/.git/refs/heads/master +0 -1
- package/template/agora-rn-uikit/.git/refs/remotes/origin/HEAD +0 -1
- package/template/agora-rn-uikit/.gitignore +0 -63
- package/template/agora-rn-uikit/package-lock.json +0 -7612
- package/template/agora-rn-uikit/src/Contexts/MaxUidContext.tsx +0 -7
- package/template/agora-rn-uikit/src/Contexts/MinUidContext.tsx +0 -8
- package/template/package-lock.json +0 -22923
- package/template/react-native-toast-message/.gitignore +0 -5
- package/template/react-native-toast-message/.npmignore +0 -5
- package/template/react-native-toast-message/package-lock.json +0 -10553
- package/template/src/.DS_Store +0 -0
- package/template/src/components/participants/context/ParticipantContext.tsx +0 -97
- package/template/src/subComponents/.DS_Store +0 -0
- package/template/src/subComponents/ScreenshareButton.tsx +0 -257
- package/template/src/subComponents/SwitchCamera.tsx +0 -35
- package/template/src/utils/hasBrandLogo.tsx +0 -3
- package/template/src/utils/mobileWebTest.native.tsx +0 -5
- package/template/src/utils/shouldAuthenticate.tsx +0 -7
|
@@ -9,87 +9,163 @@
|
|
|
9
9
|
information visit https://appbuilder.agora.io.
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
|
-
import React, {
|
|
13
|
-
import {
|
|
14
|
-
View,
|
|
15
|
-
TouchableOpacity,
|
|
16
|
-
Text,
|
|
17
|
-
StyleSheet,
|
|
18
|
-
Image,
|
|
19
|
-
TextInput as Ti,
|
|
20
|
-
UIManager,
|
|
21
|
-
} from 'react-native';
|
|
22
|
-
import ChatContext from '../components/ChatContext';
|
|
12
|
+
import React, {useContext} from 'react';
|
|
13
|
+
import {View, TouchableOpacity, StyleSheet, Image} from 'react-native';
|
|
23
14
|
import ColorContext from '../components/ColorContext';
|
|
24
15
|
import TextInput from '../atoms/TextInput';
|
|
25
16
|
import icons from '../assets/icons';
|
|
17
|
+
import {useString} from '../utils/useString';
|
|
18
|
+
import {useChatMessages} from '../components/chat-messages/useChatMessages';
|
|
19
|
+
import {isValidReactComponent} from '../utils/common';
|
|
20
|
+
import {useFpe} from 'fpe-api';
|
|
21
|
+
import {useChatUIControl} from '../components/chat-ui/useChatUIControl';
|
|
22
|
+
|
|
23
|
+
export interface ChatSendButtonProps {
|
|
24
|
+
render?: (onPress: () => void) => JSX.Element;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ChatSendButton = (props: ChatSendButtonProps) => {
|
|
28
|
+
const {
|
|
29
|
+
selectedChatUserId: selectedUserId,
|
|
30
|
+
message,
|
|
31
|
+
setMessage,
|
|
32
|
+
} = useChatUIControl();
|
|
33
|
+
const {sendChatMessage} = useChatMessages();
|
|
34
|
+
const onPress = () => {
|
|
35
|
+
if (!selectedUserId) {
|
|
36
|
+
sendChatMessage(message);
|
|
37
|
+
setMessage && setMessage('');
|
|
38
|
+
} else {
|
|
39
|
+
sendChatMessage(message, selectedUserId);
|
|
40
|
+
setMessage && setMessage('');
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return props?.render ? (
|
|
44
|
+
props.render(onPress)
|
|
45
|
+
) : (
|
|
46
|
+
<TouchableOpacity style={style.chatInputButton} onPress={onPress}>
|
|
47
|
+
<Image
|
|
48
|
+
source={{
|
|
49
|
+
uri: icons.send,
|
|
50
|
+
}}
|
|
51
|
+
style={style.chatInputButtonIcon}
|
|
52
|
+
resizeMode={'contain'}
|
|
53
|
+
/>
|
|
54
|
+
</TouchableOpacity>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
export interface ChatTextInputProps {
|
|
58
|
+
render?: (
|
|
59
|
+
message: string,
|
|
60
|
+
onChangeText: (text: string) => void,
|
|
61
|
+
onSubmitEditing: () => void,
|
|
62
|
+
chatMessageInputPlaceholder: string,
|
|
63
|
+
) => JSX.Element;
|
|
64
|
+
}
|
|
65
|
+
export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
66
|
+
const {
|
|
67
|
+
selectedChatUserId: selectedUserId,
|
|
68
|
+
message,
|
|
69
|
+
setMessage,
|
|
70
|
+
} = useChatUIControl();
|
|
71
|
+
const {sendChatMessage} = useChatMessages();
|
|
72
|
+
//commented for v1 release
|
|
73
|
+
// const chatMessageInputPlaceholder = useString(
|
|
74
|
+
// 'chatMessageInputPlaceholder',
|
|
75
|
+
// )();
|
|
76
|
+
const chatMessageInputPlaceholder = 'Type your message..';
|
|
77
|
+
const onChangeText = (text: string) => setMessage(text);
|
|
78
|
+
const onSubmitEditing = () => {
|
|
79
|
+
if (!selectedUserId) {
|
|
80
|
+
sendChatMessage(message);
|
|
81
|
+
setMessage('');
|
|
82
|
+
} else {
|
|
83
|
+
sendChatMessage(message, selectedUserId);
|
|
84
|
+
setMessage('');
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return props?.render ? (
|
|
89
|
+
props.render(
|
|
90
|
+
message,
|
|
91
|
+
onChangeText,
|
|
92
|
+
onSubmitEditing,
|
|
93
|
+
chatMessageInputPlaceholder,
|
|
94
|
+
)
|
|
95
|
+
) : (
|
|
96
|
+
<TextInput
|
|
97
|
+
value={message}
|
|
98
|
+
onChangeText={onChangeText}
|
|
99
|
+
style={{
|
|
100
|
+
borderRadius: 10,
|
|
101
|
+
backgroundColor: $config.PRIMARY_FONT_COLOR + '10',
|
|
102
|
+
borderWidth: 1,
|
|
103
|
+
color: $config.PRIMARY_FONT_COLOR,
|
|
104
|
+
textAlign: 'left',
|
|
105
|
+
height: 40,
|
|
106
|
+
paddingVertical: 10,
|
|
107
|
+
flex: 1,
|
|
108
|
+
alignSelf: 'center',
|
|
109
|
+
}}
|
|
110
|
+
blurOnSubmit={false}
|
|
111
|
+
onSubmitEditing={onSubmitEditing}
|
|
112
|
+
placeholder={chatMessageInputPlaceholder}
|
|
113
|
+
placeholderTextColor={$config.PRIMARY_FONT_COLOR}
|
|
114
|
+
autoCorrect={false}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
26
118
|
|
|
27
119
|
/**
|
|
28
120
|
* Input component for the Chat interface
|
|
29
121
|
*/
|
|
30
|
-
const ChatInput = (
|
|
122
|
+
const ChatInput = () => {
|
|
31
123
|
const {primaryColor} = useContext(ColorContext);
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
124
|
+
const {ChatInputComponent, ChatSendButtonComponent} = useFpe((data) => {
|
|
125
|
+
let components: {
|
|
126
|
+
ChatInputComponent: React.ComponentType<ChatTextInputProps>;
|
|
127
|
+
ChatSendButtonComponent: React.ComponentType<ChatSendButtonProps>;
|
|
128
|
+
} = {
|
|
129
|
+
ChatInputComponent: ChatTextInput,
|
|
130
|
+
ChatSendButtonComponent: ChatSendButton,
|
|
131
|
+
};
|
|
132
|
+
if (
|
|
133
|
+
data?.components?.videoCall &&
|
|
134
|
+
typeof data?.components?.videoCall === 'object'
|
|
135
|
+
) {
|
|
136
|
+
// commented for v1 release
|
|
137
|
+
// if (
|
|
138
|
+
// data?.components?.videoCall?.chat &&
|
|
139
|
+
// typeof data?.components?.videoCall?.chat === 'object'
|
|
140
|
+
// ) {
|
|
141
|
+
// if (
|
|
142
|
+
// data?.components?.videoCall?.chat?.chatInput &&
|
|
143
|
+
// typeof data?.components?.videoCall?.chat?.chatInput !== 'object' &&
|
|
144
|
+
// isValidReactComponent(data?.components?.videoCall?.chat?.chatInput)
|
|
145
|
+
// ) {
|
|
146
|
+
// components.ChatInputComponent =
|
|
147
|
+
// data?.components?.videoCall?.chat?.chatInput;
|
|
148
|
+
// }
|
|
149
|
+
// if (
|
|
150
|
+
// data?.components?.videoCall?.chat?.chatSentButton &&
|
|
151
|
+
// typeof data?.components?.videoCall?.chat?.chatSentButton !==
|
|
152
|
+
// 'object' &&
|
|
153
|
+
// isValidReactComponent(
|
|
154
|
+
// data?.components?.videoCall?.chat?.chatSentButton,
|
|
155
|
+
// )
|
|
156
|
+
// ) {
|
|
157
|
+
// components.ChatSendButtonComponent =
|
|
158
|
+
// data?.components?.videoCall?.chat?.chatSentButton;
|
|
159
|
+
// }
|
|
160
|
+
// }
|
|
161
|
+
}
|
|
162
|
+
return components;
|
|
163
|
+
});
|
|
36
164
|
|
|
37
165
|
return (
|
|
38
166
|
<View style={[style.inputView, {borderColor: primaryColor, height: 40}]}>
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
// onContentSizeChange={(event) => {
|
|
42
|
-
// causes infinite react state update on ctrl+A -> delete
|
|
43
|
-
// setHeight(event.nativeEvent.contentSize.height);
|
|
44
|
-
// }}
|
|
45
|
-
onChangeText={(text) => onChangeMessage(text)}
|
|
46
|
-
style={{
|
|
47
|
-
borderRadius: 10,
|
|
48
|
-
backgroundColor: $config.PRIMARY_FONT_COLOR + '10',
|
|
49
|
-
borderWidth: 1,
|
|
50
|
-
color: $config.PRIMARY_FONT_COLOR,
|
|
51
|
-
textAlign: 'left',
|
|
52
|
-
height: 40,
|
|
53
|
-
paddingVertical: 10,
|
|
54
|
-
flex: 1,
|
|
55
|
-
alignSelf: 'center',
|
|
56
|
-
}}
|
|
57
|
-
blurOnSubmit={false}
|
|
58
|
-
onSubmitEditing={() => {
|
|
59
|
-
// console.log('!click');
|
|
60
|
-
if (!privateActive) {
|
|
61
|
-
sendMessage(message);
|
|
62
|
-
onChangeMessage('');
|
|
63
|
-
} else {
|
|
64
|
-
sendMessageToUid(message, selectedUserID);
|
|
65
|
-
onChangeMessage('');
|
|
66
|
-
}
|
|
67
|
-
}}
|
|
68
|
-
placeholder="Type your message.."
|
|
69
|
-
placeholderTextColor={$config.PRIMARY_FONT_COLOR}
|
|
70
|
-
autoCorrect={false}
|
|
71
|
-
/>
|
|
72
|
-
<TouchableOpacity
|
|
73
|
-
style={style.chatInputButton}
|
|
74
|
-
onPress={() => {
|
|
75
|
-
if (!privateActive) {
|
|
76
|
-
sendMessage(message);
|
|
77
|
-
onChangeMessage('');
|
|
78
|
-
// setHeight(40);
|
|
79
|
-
} else {
|
|
80
|
-
sendMessageToUid(message, selectedUserID);
|
|
81
|
-
onChangeMessage('');
|
|
82
|
-
// setHeight(40);
|
|
83
|
-
}
|
|
84
|
-
}}>
|
|
85
|
-
<Image
|
|
86
|
-
source={{
|
|
87
|
-
uri: icons.send,
|
|
88
|
-
}}
|
|
89
|
-
style={style.chatInputButtonIcon}
|
|
90
|
-
resizeMode={'contain'}
|
|
91
|
-
/>
|
|
92
|
-
</TouchableOpacity>
|
|
167
|
+
<ChatInputComponent />
|
|
168
|
+
<ChatSendButtonComponent />
|
|
93
169
|
</View>
|
|
94
170
|
);
|
|
95
171
|
};
|
|
@@ -9,78 +9,63 @@
|
|
|
9
9
|
information visit https://appbuilder.agora.io.
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import Clipboard from './Clipboard';
|
|
15
|
-
import {gql, useQuery} from '@apollo/client';
|
|
16
|
-
import icons from '../assets/icons';
|
|
17
|
-
import platform from '../subComponents/Platform';
|
|
12
|
+
import React, {useEffect} from 'react';
|
|
13
|
+
import {StyleSheet} from 'react-native';
|
|
18
14
|
import {useParams} from '../components/Router';
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
15
|
+
import {BtnTemplate, BtnTemplateInterface} from '../../agora-rn-uikit';
|
|
16
|
+
import {useString} from '../utils/useString';
|
|
17
|
+
import useGetMeetingPhrase from '../utils/useGetMeetingPhrase';
|
|
18
|
+
import {
|
|
19
|
+
SHARE_LINK_CONTENT_TYPE,
|
|
20
|
+
useShareLink,
|
|
21
|
+
} from '../components/useShareLink';
|
|
22
|
+
import {
|
|
23
|
+
ButtonTemplateName,
|
|
24
|
+
useButtonTemplate,
|
|
25
|
+
} from '../utils/useButtonTemplate';
|
|
26
|
+
import Styles from '../components/styles';
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
title
|
|
31
|
-
pstn {
|
|
32
|
-
number
|
|
33
|
-
dtmf
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
28
|
+
export interface CopyJoinInfoProps {
|
|
29
|
+
showText?: boolean;
|
|
30
|
+
buttonTemplateName?: ButtonTemplateName;
|
|
31
|
+
render?: (
|
|
32
|
+
onPress: () => void,
|
|
33
|
+
buttonTemplateName?: ButtonTemplateName,
|
|
34
|
+
) => JSX.Element;
|
|
35
|
+
}
|
|
38
36
|
|
|
39
|
-
const
|
|
37
|
+
const CopyJoinInfo = (props: CopyJoinInfoProps) => {
|
|
40
38
|
const {phrase} = useParams<{phrase: string}>();
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
stringToCopy += `\nURL for Host: ${window.location.origin}/${data.share.passphrase.host}`;
|
|
58
|
-
}
|
|
59
|
-
} else {
|
|
60
|
-
stringToCopy += `Meeting - ${data.share.title}\nAttendee Meeting ID: ${data.share.passphrase.view}`;
|
|
61
|
-
if (data.share.passphrase.host) {
|
|
62
|
-
stringToCopy += `\nHost Meeting ID: ${data.share.passphrase.host}`;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (data.share.pstn) {
|
|
67
|
-
stringToCopy += `\nPSTN Number: ${data.share.pstn.number}\nPSTN Pin: ${data.share.pstn.dtmf}`;
|
|
68
|
-
}
|
|
69
|
-
console.log('Copying string to clipboard:', stringToCopy);
|
|
70
|
-
Clipboard.setString(stringToCopy);
|
|
71
|
-
// Clipboard.setString(JSON.stringify(data));
|
|
72
|
-
}
|
|
39
|
+
const getMeeting = useGetMeetingPhrase();
|
|
40
|
+
const {copyShareLinkToClipboard} = useShareLink();
|
|
41
|
+
//commented for v1 release
|
|
42
|
+
//const copyMeetingInviteButton = useString('copyMeetingInviteButton')();
|
|
43
|
+
const copyMeetingInviteButton = 'Copy Meeting Invite';
|
|
44
|
+
const defaultTemplateValue = useButtonTemplate().buttonTemplateName;
|
|
45
|
+
const {buttonTemplateName = defaultTemplateValue} = props;
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
getMeeting(phrase);
|
|
48
|
+
}, [phrase]);
|
|
49
|
+
|
|
50
|
+
const onPress = () =>
|
|
51
|
+
copyShareLinkToClipboard(SHARE_LINK_CONTENT_TYPE.MEETING_INVITE);
|
|
52
|
+
let btnTemplateProps: BtnTemplateInterface = {
|
|
53
|
+
onPress: onPress,
|
|
54
|
+
name: 'clipboard',
|
|
73
55
|
};
|
|
56
|
+
if (buttonTemplateName === ButtonTemplateName.bottomBar) {
|
|
57
|
+
btnTemplateProps.btnText = copyMeetingInviteButton;
|
|
58
|
+
btnTemplateProps.style = Styles.localButtonWithoutBG as Object;
|
|
59
|
+
} else {
|
|
60
|
+
btnTemplateProps.color = $config.PRIMARY_FONT_COLOR;
|
|
61
|
+
btnTemplateProps.style = style.backButton;
|
|
62
|
+
btnTemplateProps.btnText = props.showText ? copyMeetingInviteButton : '';
|
|
63
|
+
}
|
|
74
64
|
|
|
75
|
-
return (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
onPress={() => copyToClipboard()}
|
|
80
|
-
name={'clipboard'}
|
|
81
|
-
btnText={props.showText ? 'Copy Meeting Invite' : ''}
|
|
82
|
-
color={$config.PRIMARY_FONT_COLOR}
|
|
83
|
-
/>
|
|
65
|
+
return props?.render ? (
|
|
66
|
+
props.render(onPress, buttonTemplateName)
|
|
67
|
+
) : (
|
|
68
|
+
<BtnTemplate {...btnTemplateProps} />
|
|
84
69
|
);
|
|
85
70
|
};
|
|
86
71
|
|
|
@@ -101,4 +86,4 @@ const style = StyleSheet.create({
|
|
|
101
86
|
},
|
|
102
87
|
});
|
|
103
88
|
|
|
104
|
-
export default
|
|
89
|
+
export default CopyJoinInfo;
|
|
@@ -9,17 +9,21 @@
|
|
|
9
9
|
information visit https://appbuilder.agora.io.
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
|
-
import React, {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from 'react-native';
|
|
18
|
-
import { useHistory } from '../components/Router';
|
|
19
|
-
|
|
20
|
-
const Error = (props: { error: { name: string; message: string }, showBack?: boolean }) => {
|
|
12
|
+
import React, {useContext, useState} from 'react';
|
|
13
|
+
import {View, Text, TouchableOpacity} from 'react-native';
|
|
14
|
+
import {useString} from '../utils/useString';
|
|
15
|
+
import {ErrorContext} from '../components/common';
|
|
16
|
+
import {useHistory} from '../components/Router';
|
|
21
17
|
|
|
18
|
+
const Error = (props: {
|
|
19
|
+
error: {name: string; message: string};
|
|
20
|
+
showBack?: boolean;
|
|
21
|
+
}) => {
|
|
22
|
+
const {resetError} = useContext(ErrorContext);
|
|
22
23
|
const history = useHistory();
|
|
24
|
+
//commented for v1 release
|
|
25
|
+
//const goBackButton = useString('goBackButton')();
|
|
26
|
+
const goBackButton = 'Go back';
|
|
23
27
|
return (
|
|
24
28
|
<View
|
|
25
29
|
style={{
|
|
@@ -45,20 +49,27 @@ const Error = (props: { error: { name: string; message: string }, showBack?: boo
|
|
|
45
49
|
}}>
|
|
46
50
|
{props.error.name}
|
|
47
51
|
</Text>
|
|
48
|
-
<Text style={{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
style={{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
<Text style={{textAlign: 'center', padding: 4}}>
|
|
53
|
+
{props.error.message}
|
|
54
|
+
</Text>
|
|
55
|
+
{props.showBack ? (
|
|
56
|
+
<TouchableOpacity
|
|
57
|
+
style={{alignSelf: 'center'}}
|
|
58
|
+
onPress={() => {
|
|
59
|
+
resetError && resetError();
|
|
60
|
+
history.replace('./');
|
|
57
61
|
}}>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
<Text
|
|
63
|
+
style={{
|
|
64
|
+
fontWeight: '500',
|
|
65
|
+
textAlign: 'center',
|
|
66
|
+
textDecorationLine: 'underline',
|
|
67
|
+
}}>
|
|
68
|
+
{goBackButton}
|
|
69
|
+
</Text>
|
|
70
|
+
</TouchableOpacity>
|
|
71
|
+
) : null}
|
|
61
72
|
</View>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
export default Error;
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
export default Error;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
********************************************
|
|
3
|
+
Copyright © 2021 Agora Lab, Inc., all rights reserved.
|
|
4
|
+
AppBuilder and all associated components, source code, APIs, services, and documentation
|
|
5
|
+
(the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
|
|
6
|
+
accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
|
|
7
|
+
Use without a license or in violation of any license terms and conditions (including use for
|
|
8
|
+
any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
|
|
9
|
+
information visit https://appbuilder.agora.io.
|
|
10
|
+
*********************************************
|
|
11
|
+
*/
|
|
12
|
+
import React, {useContext} from 'react';
|
|
13
|
+
import {Picker, StyleSheet, Text} from 'react-native';
|
|
14
|
+
import ColorContext from '../components/ColorContext';
|
|
15
|
+
import {useLanguage} from '../language/useLanguage';
|
|
16
|
+
import {useFpe} from 'fpe-api';
|
|
17
|
+
import {useString} from '../utils/useString';
|
|
18
|
+
import {DEFAULT_I18_DATA} from '../language';
|
|
19
|
+
|
|
20
|
+
const LanguageSelector = () => {
|
|
21
|
+
const {primaryColor} = useContext(ColorContext);
|
|
22
|
+
const {languageCode, setLanguageCode} = useLanguage();
|
|
23
|
+
const languageData = useFpe((data) => data?.i18n);
|
|
24
|
+
//commented for v1 release
|
|
25
|
+
//const languageText = useString('language')();
|
|
26
|
+
const languageText = 'Language';
|
|
27
|
+
if (!languageData || !languageData.length) {
|
|
28
|
+
return <></>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (
|
|
32
|
+
languageData.length === 1 &&
|
|
33
|
+
languageData[0].locale === DEFAULT_I18_DATA.locale
|
|
34
|
+
) {
|
|
35
|
+
return <></>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<Text style={style.heading}>{languageText}</Text>
|
|
41
|
+
<Picker
|
|
42
|
+
selectedValue={languageCode}
|
|
43
|
+
style={[{borderColor: primaryColor}, style.popupPicker]}
|
|
44
|
+
onValueChange={(itemValue) => setLanguageCode(itemValue)}>
|
|
45
|
+
{languageData.map((item) => {
|
|
46
|
+
return (
|
|
47
|
+
<Picker.Item
|
|
48
|
+
label={item.label || item.locale}
|
|
49
|
+
value={item.locale}
|
|
50
|
+
key={item.locale}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
})}
|
|
54
|
+
{!languageData.filter((i) => i.locale === DEFAULT_I18_DATA.locale)
|
|
55
|
+
.length ? (
|
|
56
|
+
<Picker.Item
|
|
57
|
+
label={DEFAULT_I18_DATA.label || DEFAULT_I18_DATA.locale}
|
|
58
|
+
value={DEFAULT_I18_DATA.locale}
|
|
59
|
+
key={DEFAULT_I18_DATA.locale}
|
|
60
|
+
/>
|
|
61
|
+
) : null}
|
|
62
|
+
</Picker>
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const style = StyleSheet.create({
|
|
68
|
+
heading: {
|
|
69
|
+
fontSize: 20,
|
|
70
|
+
fontWeight: '700',
|
|
71
|
+
color: $config.PRIMARY_FONT_COLOR,
|
|
72
|
+
// marginBottom: 20,
|
|
73
|
+
alignSelf: 'center',
|
|
74
|
+
},
|
|
75
|
+
popupPicker: {
|
|
76
|
+
height: 30,
|
|
77
|
+
marginBottom: 10,
|
|
78
|
+
borderRadius: 50,
|
|
79
|
+
paddingHorizontal: 15,
|
|
80
|
+
fontSize: 15,
|
|
81
|
+
minHeight: 35,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export default LanguageSelector;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React, {SetStateAction} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
TouchableWithoutFeedback,
|
|
8
|
+
Modal,
|
|
9
|
+
Dimensions,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import {ImageIcon} from '../../agora-rn-uikit';
|
|
12
|
+
import useCustomLayout from '../pages/video-call/CustomLayout';
|
|
13
|
+
import {useLayout} from '../utils/useLayout';
|
|
14
|
+
|
|
15
|
+
const deviceHeight = Dimensions.get('screen').height;
|
|
16
|
+
interface LayoutIconDropdownProps {
|
|
17
|
+
dropdownPosition: {
|
|
18
|
+
top: number;
|
|
19
|
+
right: number;
|
|
20
|
+
};
|
|
21
|
+
showDropdown: boolean;
|
|
22
|
+
setShowDropdown: React.Dispatch<SetStateAction<boolean>>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const LayoutIconDropdown = (props: LayoutIconDropdownProps) => {
|
|
26
|
+
const {showDropdown, setShowDropdown} = props;
|
|
27
|
+
const layouts = useCustomLayout();
|
|
28
|
+
const {activeLayoutName, setActiveLayoutName} = useLayout();
|
|
29
|
+
const selectedItemHighlighter = (isSelected: boolean) => {
|
|
30
|
+
return <View style={isSelected ? style.highlighter : {}} />;
|
|
31
|
+
};
|
|
32
|
+
const renderDropdown = () => {
|
|
33
|
+
const data = layouts.map((item, index) => {
|
|
34
|
+
let onPress = () => {
|
|
35
|
+
setActiveLayoutName(item.name);
|
|
36
|
+
setShowDropdown(false);
|
|
37
|
+
};
|
|
38
|
+
let content = [];
|
|
39
|
+
let BtnTemplateLocal = [
|
|
40
|
+
item?.iconName ? (
|
|
41
|
+
<ImageIcon
|
|
42
|
+
key={'btnTemplateNameDropdown' + index}
|
|
43
|
+
style={style.btnHolderCustom}
|
|
44
|
+
name={item?.iconName}
|
|
45
|
+
/>
|
|
46
|
+
) : (
|
|
47
|
+
<ImageIcon
|
|
48
|
+
key={'btnTemplateIconDropdown' + index}
|
|
49
|
+
style={style.btnHolderCustom}
|
|
50
|
+
icon={item.icon}
|
|
51
|
+
/>
|
|
52
|
+
),
|
|
53
|
+
];
|
|
54
|
+
content.push(
|
|
55
|
+
<TouchableOpacity
|
|
56
|
+
style={style.dropdownIconContainer}
|
|
57
|
+
onPress={onPress}
|
|
58
|
+
key={'dropdownLayoutIcon' + index}>
|
|
59
|
+
<>
|
|
60
|
+
<View style={style.highlighterContainer}>
|
|
61
|
+
{selectedItemHighlighter(item.name === activeLayoutName)}
|
|
62
|
+
</View>
|
|
63
|
+
<View style={{flex: 1}}>{BtnTemplateLocal}</View>
|
|
64
|
+
<View style={style.layoutNameContainer}>
|
|
65
|
+
<Text numberOfLines={2} style={style.layoutNameText}>
|
|
66
|
+
{item.label}
|
|
67
|
+
</Text>
|
|
68
|
+
</View>
|
|
69
|
+
</>
|
|
70
|
+
</TouchableOpacity>,
|
|
71
|
+
);
|
|
72
|
+
return content;
|
|
73
|
+
});
|
|
74
|
+
return (
|
|
75
|
+
<Modal
|
|
76
|
+
animationType="fade"
|
|
77
|
+
transparent={true}
|
|
78
|
+
visible={showDropdown}
|
|
79
|
+
onRequestClose={() => {
|
|
80
|
+
setShowDropdown(false);
|
|
81
|
+
}}>
|
|
82
|
+
<TouchableWithoutFeedback
|
|
83
|
+
onPress={() => {
|
|
84
|
+
setShowDropdown(false);
|
|
85
|
+
}}>
|
|
86
|
+
<View style={style.backDrop} />
|
|
87
|
+
</TouchableWithoutFeedback>
|
|
88
|
+
<View style={style.dropdownContentContainer}>{data}</View>
|
|
89
|
+
</Modal>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
return <>{renderDropdown()}</>;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const style = StyleSheet.create({
|
|
96
|
+
layoutNameContainer: {
|
|
97
|
+
flex: 3,
|
|
98
|
+
justifyContent: 'center',
|
|
99
|
+
paddingHorizontal: 5,
|
|
100
|
+
},
|
|
101
|
+
layoutNameText: {
|
|
102
|
+
textAlign: 'left',
|
|
103
|
+
},
|
|
104
|
+
highlighterContainer: {
|
|
105
|
+
flex: 0.3,
|
|
106
|
+
justifyContent: 'center',
|
|
107
|
+
},
|
|
108
|
+
highlighter: {
|
|
109
|
+
justifyContent: 'center',
|
|
110
|
+
alignSelf: 'center',
|
|
111
|
+
height: 1,
|
|
112
|
+
width: 1,
|
|
113
|
+
borderRadius: 10,
|
|
114
|
+
borderWidth: 4,
|
|
115
|
+
borderColor: $config.PRIMARY_COLOR,
|
|
116
|
+
},
|
|
117
|
+
dropdownIconContainer: {
|
|
118
|
+
flexDirection: 'row',
|
|
119
|
+
maxHeight: 40,
|
|
120
|
+
marginVertical: 5,
|
|
121
|
+
},
|
|
122
|
+
navItem: {
|
|
123
|
+
height: '100%',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
position: 'relative',
|
|
126
|
+
},
|
|
127
|
+
navItemSeparatorHorizontal: {
|
|
128
|
+
backgroundColor: $config.PRIMARY_FONT_COLOR + '80',
|
|
129
|
+
width: '100%',
|
|
130
|
+
height: 1,
|
|
131
|
+
marginVertical: 10,
|
|
132
|
+
alignSelf: 'center',
|
|
133
|
+
opacity: 0.8,
|
|
134
|
+
},
|
|
135
|
+
separaterContainer: {
|
|
136
|
+
flex: 0.5,
|
|
137
|
+
paddingHorizontal: 5,
|
|
138
|
+
},
|
|
139
|
+
dropdownContentContainer: {
|
|
140
|
+
backgroundColor: 'white',
|
|
141
|
+
alignSelf: 'center',
|
|
142
|
+
width: '70%',
|
|
143
|
+
marginTop: (1 / 3) * deviceHeight,
|
|
144
|
+
marginBottom: 30,
|
|
145
|
+
borderRadius: 10,
|
|
146
|
+
padding: 10,
|
|
147
|
+
},
|
|
148
|
+
btnHolderCustom: {
|
|
149
|
+
width: '100%',
|
|
150
|
+
height: '100%',
|
|
151
|
+
resizeMode: 'contain',
|
|
152
|
+
},
|
|
153
|
+
backDrop: {
|
|
154
|
+
position: 'absolute',
|
|
155
|
+
top: 0,
|
|
156
|
+
bottom: 0,
|
|
157
|
+
left: 0,
|
|
158
|
+
right: 0,
|
|
159
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export default LayoutIconDropdown;
|