agora-appbuilder-core 3.0.10 → 3.0.12
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 +0 -6
- package/package.json +2 -2
- package/template/_package-lock.json +4979 -7086
- package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +0 -4
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +0 -18
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +0 -2
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +26 -30
- package/template/agora-rn-uikit/src/Controls/Icons.ts +83 -30
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +0 -2
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +0 -1
- package/template/agora-rn-uikit/src/Reducer/index.ts +0 -3
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +1 -89
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +2 -39
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +5 -15
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +9 -15
- package/template/agora-rn-uikit/src/index.ts +1 -3
- package/template/android/app/build.gradle +0 -1
- package/template/android/app/src/main/AndroidManifest.xml +15 -22
- package/template/android/app/src/main/java/com/helloworld/MainActivity.java +0 -50
- package/template/android/build.gradle +3 -3
- package/template/babel.config.js +0 -1
- package/template/bridge/rtc/webNg/RtcEngine.ts +17 -110
- package/template/customization-api/sub-components.ts +1 -1
- package/template/customization-api/typeDefinition.ts +1 -2
- package/template/electron/index.html +27 -27
- package/template/electron/renderer/index.js +0 -1
- package/template/global.d.ts +4 -26
- package/template/index.js +0 -4
- package/template/index.rsdk.tsx +0 -1
- package/template/index.web.js +1 -7
- package/template/index.wsdk.tsx +1 -1
- package/template/ios/HelloWorld/Info.plist +1 -14
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +0 -17
- package/template/metro.config.js +1 -1
- package/template/package.json +7 -21
- package/template/react-native-toast-message/index.d.ts +43 -43
- package/template/react-native-toast-message/src/colors/index.js +2 -3
- package/template/react-native-toast-message/src/components/base/index.js +59 -46
- package/template/react-native-toast-message/src/components/base/styles.js +32 -16
- package/template/react-native-toast-message/src/components/error.js +2 -3
- package/template/react-native-toast-message/src/components/info.js +2 -3
- package/template/react-native-toast-message/src/components/success.js +2 -3
- package/template/react-native-toast-message/src/index.js +31 -122
- package/template/react-native-toast-message/src/index.sdk.tsx +35 -125
- package/template/react-native-toast-message/src/styles.js +4 -3
- package/template/react-native-toast-message/src/styles.sdk.ts +4 -3
- package/template/src/App.tsx +0 -6
- package/template/src/AppWrapper.tsx +28 -63
- package/template/src/assets/icons.ts +102 -0
- package/template/src/atoms/HorizontalRule.tsx +1 -3
- package/template/src/atoms/PrimaryButton.tsx +26 -51
- package/template/src/atoms/SecondaryButton.tsx +5 -8
- package/template/src/atoms/TextInput.tsx +14 -12
- package/template/src/components/Chat.tsx +214 -86
- package/template/src/components/ChatContext.ts +1 -8
- package/template/src/components/ColorConfigure.tsx +1 -1
- package/template/src/components/ColorContext.ts +1 -1
- package/template/src/components/{Controls1.native.tsx → Controls.native.tsx} +4 -6
- package/template/src/components/Controls.tsx +42 -342
- package/template/src/components/DeviceConfigure.tsx +101 -461
- package/template/src/components/DeviceContext.tsx +4 -8
- package/template/src/components/EventsConfigure.tsx +7 -144
- package/template/src/components/GraphQLProvider.tsx +1 -1
- package/template/src/components/GridVideo.tsx +44 -59
- package/template/src/components/HostControlView.tsx +35 -114
- package/template/src/components/Navbar.tsx +398 -216
- package/template/src/components/NetworkQualityContext.tsx +20 -20
- package/template/src/components/ParticipantsView.tsx +154 -177
- package/template/src/components/PinnedVideo.tsx +120 -207
- package/template/src/components/Precall.native.tsx +119 -358
- package/template/src/components/Precall.tsx +135 -269
- package/template/src/components/RTMConfigure.tsx +4 -27
- package/template/src/components/Router.electron.ts +0 -1
- package/template/src/components/Router.native.ts +0 -1
- package/template/src/components/Router.sdk.ts +0 -1
- package/template/src/components/Router.ts +0 -1
- package/template/src/components/Settings.tsx +95 -26
- package/template/src/components/SettingsView.tsx +56 -251
- package/template/src/components/Share.tsx +273 -302
- package/template/src/components/StorageContext.tsx +3 -30
- package/template/src/components/chat-messages/useChatMessages.tsx +23 -69
- package/template/src/components/chat-ui/useChatUIControl.tsx +0 -7
- package/template/src/components/common/Error.tsx +6 -20
- package/template/src/components/common/Logo.tsx +15 -16
- package/template/src/components/contexts/LiveStreamDataContext.tsx +5 -10
- package/template/src/components/contexts/VideoMeetingDataContext.tsx +7 -37
- package/template/src/components/livestream/LiveStreamContext.tsx +36 -270
- package/template/src/components/livestream/Types.ts +14 -39
- package/template/src/components/livestream/index.ts +0 -1
- package/template/src/components/livestream/views/LiveStreamControls.tsx +4 -12
- package/template/src/components/participants/AllAudienceParticipants.tsx +30 -101
- package/template/src/components/participants/AllHostParticipants.tsx +34 -103
- package/template/src/components/participants/MeParticipant.tsx +38 -0
- package/template/src/components/participants/ParticipantName.tsx +7 -13
- package/template/src/components/participants/ParticipantSectionTitle.tsx +10 -35
- package/template/src/components/participants/RemoteParticipants.tsx +71 -0
- package/template/src/components/participants/ScreenshareParticipants.tsx +12 -144
- package/template/src/components/precall/{LocalMute1.native.tsx → LocalMute.native.tsx} +5 -21
- package/template/src/components/precall/LocalMute.tsx +14 -84
- package/template/src/components/precall/VideoPreview.native.tsx +3 -48
- package/template/src/components/precall/VideoPreview.tsx +7 -163
- package/template/src/components/precall/joinCallBtn.tsx +2 -15
- package/template/src/components/precall/meetingTitle.tsx +12 -15
- package/template/src/components/precall/selectDevice.tsx +21 -1
- package/template/src/components/precall/textInput.tsx +4 -32
- package/template/src/components/precall/usePreCall.tsx +0 -16
- package/template/src/components/styles.ts +21 -42
- package/template/src/components/useShareLink.tsx +14 -12
- package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
- package/template/src/pages/Authenticate.tsx +15 -5
- package/template/src/pages/Create.tsx +165 -293
- package/template/src/pages/Join.tsx +67 -93
- package/template/src/pages/VideoCall.tsx +64 -89
- package/template/src/pages/video-call/DefaultLayouts.ts +4 -4
- package/template/src/pages/video-call/NameWithMicIcon.tsx +44 -120
- package/template/src/pages/video-call/RenderComponent.tsx +2 -3
- package/template/src/pages/video-call/VideoCallScreen.tsx +9 -45
- package/template/src/pages/video-call/VideoComponent.tsx +3 -18
- package/template/src/pages/video-call/VideoRenderer.tsx +60 -218
- package/template/src/rtm-events/constants.ts +0 -2
- package/template/src/subComponents/ChatBubble.tsx +83 -123
- package/template/src/subComponents/ChatContainer.tsx +84 -257
- package/template/src/subComponents/ChatInput.tsx +46 -61
- package/template/src/subComponents/Checkbox.native.tsx +5 -16
- package/template/src/subComponents/Checkbox.tsx +2 -2
- package/template/src/subComponents/CopyJoinInfo.tsx +58 -36
- package/template/src/subComponents/FallbackLogo.tsx +40 -122
- package/template/src/subComponents/LanguageSelector.tsx +1 -1
- package/template/src/subComponents/{LayoutIconDropdown1.native.tsx → LayoutIconDropdown.native.tsx} +18 -4
- package/template/src/subComponents/LayoutIconDropdown.tsx +134 -131
- package/template/src/subComponents/LocalAudioMute.tsx +27 -119
- package/template/src/subComponents/LocalEndCall.tsx +33 -71
- package/template/src/subComponents/LocalSwitchCamera.tsx +30 -17
- package/template/src/subComponents/LocalVideoMute.tsx +27 -117
- package/template/src/subComponents/Logo.tsx +4 -3
- package/template/src/subComponents/LogoutButton.tsx +1 -1
- package/template/src/subComponents/NetworkQualityPill.tsx +63 -60
- package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
- package/template/src/subComponents/Recording.tsx +29 -28
- package/template/src/subComponents/RemoteAudioMute.tsx +29 -83
- package/template/src/subComponents/RemoteEndCall.tsx +5 -8
- package/template/src/subComponents/RemoteVideoMute.tsx +21 -74
- package/template/src/subComponents/ScreenShareNotice.tsx +8 -83
- package/template/src/subComponents/SelectDevice.tsx +61 -404
- package/template/src/subComponents/SelectOAuth.tsx +8 -9
- package/template/src/subComponents/ToastConfig.tsx +10 -150
- package/template/src/subComponents/chat/ChatParticipants.tsx +78 -187
- package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +32 -95
- package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +33 -29
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +6 -6
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +11 -24
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +10 -17
- package/template/src/subComponents/recording/useRecording.tsx +27 -79
- package/template/src/subComponents/screenshare/ScreenshareButton.tsx +70 -52
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +2 -11
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +4 -26
- package/template/src/utils/common.tsx +1 -155
- package/template/src/utils/index.tsx +0 -19
- package/template/src/utils/isMobileOrTablet.ts +2 -7
- package/template/src/utils/useButtonTemplate.tsx +0 -1
- package/template/src/utils/useMuteToggleLocal.ts +3 -54
- package/template/web/index.html +0 -5
- package/template/webpack.commons.js +8 -13
- package/template/webpack.web.config.js +0 -1
- package/template/agora-rn-uikit/src/Reducer/ActiveSpeakerDetected.ts +0 -11
- package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +0 -24
- package/template/agora-rn-uikit/src/Reducer/UserPin.ts +0 -11
- package/template/android/app/src/main/assets/fonts/SourceSansPro-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
- package/template/android/app/src/main/res/values/colors.xml +0 -7
- package/template/react-native-toast-message/src/components/checkbox.js +0 -178
- package/template/react-native.config.js +0 -7
- package/template/src/assets/font-styles.css +0 -329
- package/template/src/assets/fonts/SourceSansPro-Regular.ttf +0 -0
- package/template/src/assets/fonts/icomoon.ttf +0 -0
- package/template/src/assets/permission.png +0 -0
- package/template/src/assets/selection.json +0 -1
- package/template/src/atoms/ActionMenu.tsx +0 -236
- package/template/src/atoms/AnimatedActiveSpeaker.native.tsx +0 -71
- package/template/src/atoms/AnimatedActiveSpeaker.tsx +0 -84
- package/template/src/atoms/AnimatedRings.native.tsx +0 -68
- package/template/src/atoms/AnimatedRings.tsx +0 -70
- package/template/src/atoms/Card.tsx +0 -61
- package/template/src/atoms/CircularProgress.native.tsx +0 -121
- package/template/src/atoms/CircularProgress.tsx +0 -102
- package/template/src/atoms/CustomIcon.tsx +0 -88
- package/template/src/atoms/CustomSwitch.tsx +0 -287
- package/template/src/atoms/Dropdown.tsx +0 -306
- package/template/src/atoms/IconButton.tsx +0 -162
- package/template/src/atoms/ImageIcon.tsx +0 -98
- package/template/src/atoms/InfoBubble.tsx +0 -291
- package/template/src/atoms/Input.tsx +0 -87
- package/template/src/atoms/InviteInfo.tsx +0 -166
- package/template/src/atoms/LinkButton.tsx +0 -28
- package/template/src/atoms/OutlineButton.tsx +0 -61
- package/template/src/atoms/ParticipantsCount.tsx +0 -73
- package/template/src/atoms/Popup.tsx +0 -147
- package/template/src/atoms/RecordingInfo.tsx +0 -49
- package/template/src/atoms/Spacer.tsx +0 -22
- package/template/src/atoms/TertiaryButton.tsx +0 -78
- package/template/src/atoms/Toggle.tsx +0 -47
- package/template/src/atoms/Tooltip.native.tsx +0 -65
- package/template/src/atoms/Tooltip.tsx +0 -94
- package/template/src/atoms/UserAvatar.tsx +0 -60
- package/template/src/components/CommonStyles.ts +0 -44
- package/template/src/components/ToastComponent.tsx +0 -8
- package/template/src/components/participants/Participant.tsx +0 -302
- package/template/src/components/participants/UserActionMenuOptions.tsx +0 -398
- package/template/src/components/popups/InvitePopup.tsx +0 -115
- package/template/src/components/popups/StopRecordingPopup.tsx +0 -114
- package/template/src/components/precall/PermissionHelper.native.tsx +0 -5
- package/template/src/components/precall/PermissionHelper.tsx +0 -126
- package/template/src/components/precall/PreCallSettings.tsx +0 -52
- package/template/src/components/useToast.tsx +0 -41
- package/template/src/components/useVideoCall.tsx +0 -65
- package/template/src/pages/Endcall.tsx +0 -148
- package/template/src/pages/video-call/ActionSheet.native.tsx +0 -215
- package/template/src/pages/video-call/ActionSheet.tsx +0 -226
- package/template/src/pages/video-call/ActionSheetContent.tsx +0 -479
- package/template/src/pages/video-call/ActionSheetHandle.tsx +0 -38
- package/template/src/pages/video-call/ActionSheetStyles.css +0 -138
- package/template/src/pages/video-call/SidePanelHeader.tsx +0 -190
- package/template/src/pages/video-call/VideoCallMobileView.tsx +0 -139
- package/template/src/pages/video-call/VideoCallScreen.native.tsx +0 -37
- package/template/src/subComponents/ChatInput.ios.tsx +0 -237
- package/template/src/subComponents/EndcallPopup.tsx +0 -107
- package/template/src/subComponents/LayoutIconButton.tsx +0 -201
- package/template/src/subComponents/RemoteMutePopup.tsx +0 -193
- package/template/src/subComponents/RemoveMeetingPopup.tsx +0 -109
- package/template/src/subComponents/RemoveScreensharePopup.tsx +0 -109
- package/template/src/subComponents/SelectDeviceSettings.backup.tsx +0 -207
- package/template/src/subComponents/SidePanelHeader.tsx +0 -112
- package/template/src/theme/index.ts +0 -46
- package/template/src/utils/PlatformWrapper.tsx +0 -21
- package/template/src/utils/hexadecimalTransparency.ts +0 -108
- package/template/src/utils/pendingStateUpdateHelper.ts +0 -19
- package/template/src/utils/useFocus.tsx +0 -46
- package/template/src/utils/useIsActiveSpeaker.ts +0 -27
- package/template/src/utils/useIsHandRaised.ts +0 -13
- package/template/src/utils/useRemoteEndScreenshare.ts +0 -26
- package/template/src/utils/useRemoteRequest.ts +0 -84
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ViewStyle, TextStyle, ImageSourcePropType } from 'react-native'
|
|
2
|
+
import { ViewStyle, TextStyle, ImageSourcePropType } from 'react-native'
|
|
3
3
|
|
|
4
4
|
declare module 'react-native-toast-message' {
|
|
5
5
|
interface AnyObject {
|
|
6
6
|
[key: string]: any;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export type ToastPosition = 'top' | 'bottom'
|
|
9
|
+
export type ToastPosition = 'top' | 'bottom'
|
|
10
10
|
|
|
11
11
|
export interface BaseToastProps {
|
|
12
|
-
leadingIcon?:
|
|
13
|
-
trailingIcon?:
|
|
14
|
-
text1?: string
|
|
15
|
-
text2?: string
|
|
16
|
-
onPress?: () => void
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
leadingIcon?: ImageSourcePropType,
|
|
13
|
+
trailingIcon?: ImageSourcePropType,
|
|
14
|
+
text1?: string,
|
|
15
|
+
text2?: string,
|
|
16
|
+
onPress?: () => void,
|
|
17
|
+
onTrailingIconPress?: () => void,
|
|
18
|
+
onLeadingIconPress?: () => void,
|
|
19
|
+
style?: ViewStyle,
|
|
20
|
+
leadingIconContainerStyle?: ViewStyle,
|
|
21
|
+
trailingIconContainerStyle?: ViewStyle,
|
|
22
|
+
leadingIconStyle?: ViewStyle,
|
|
23
|
+
trailingIconStyle?: ViewStyle,
|
|
24
|
+
contentContainerStyle?: ViewStyle,
|
|
25
|
+
text1Style?: TextStyle,
|
|
26
|
+
text2Style?: TextStyle,
|
|
27
|
+
activeOpacity?: number,
|
|
28
|
+
text1NumberOfLines: number,
|
|
29
|
+
text2NumberOfLines: number,
|
|
26
30
|
}
|
|
27
|
-
export const BaseToast: React.FC<BaseToastProps
|
|
31
|
+
export const BaseToast: React.FC<BaseToastProps>
|
|
28
32
|
|
|
29
33
|
export interface ToastProps {
|
|
30
34
|
ref: (ref: any) => any;
|
|
31
|
-
config?: AnyObject
|
|
32
|
-
style?: ViewStyle
|
|
33
|
-
topOffset?: number
|
|
34
|
-
bottomOffset?: number
|
|
35
|
-
keyboardOffset?: number
|
|
36
|
-
visibilityTime?: number
|
|
37
|
-
autoHide?: boolean
|
|
38
|
-
height?: number
|
|
39
|
-
position?: ToastPosition
|
|
40
|
-
type?: string
|
|
35
|
+
config?: AnyObject,
|
|
36
|
+
style?: ViewStyle,
|
|
37
|
+
topOffset?: number,
|
|
38
|
+
bottomOffset?: number,
|
|
39
|
+
keyboardOffset?: number,
|
|
40
|
+
visibilityTime?: number,
|
|
41
|
+
autoHide?: boolean,
|
|
42
|
+
height?: number,
|
|
43
|
+
position?: ToastPosition,
|
|
44
|
+
type?: string
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
export default class Toast extends React.Component<ToastProps> {
|
|
44
48
|
static show(options: {
|
|
45
|
-
type: string
|
|
46
|
-
position?: ToastPosition
|
|
47
|
-
text1?: string
|
|
48
|
-
text2?: string
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
onHide?: () => void;
|
|
58
|
-
onPress?: () => void;
|
|
49
|
+
type: string,
|
|
50
|
+
position?: ToastPosition,
|
|
51
|
+
text1?: string,
|
|
52
|
+
text2?: string,
|
|
53
|
+
visibilityTime?: number,
|
|
54
|
+
autoHide?: boolean,
|
|
55
|
+
topOffset?: number,
|
|
56
|
+
bottomOffset?: number,
|
|
57
|
+
props?: AnyObject,
|
|
58
|
+
onShow?: () => void,
|
|
59
|
+
onHide?: () => void,
|
|
60
|
+
onPress?: () => void
|
|
59
61
|
}): void;
|
|
60
62
|
|
|
61
63
|
static hide(): void;
|
|
62
64
|
|
|
63
|
-
static getToastId(): number;
|
|
64
|
-
|
|
65
65
|
static setRef(ref: any): any;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
const colors = {
|
|
2
2
|
white: '#FFF',
|
|
3
|
-
blazeOrange: '#
|
|
3
|
+
blazeOrange: '#FE6301',
|
|
4
4
|
mantis: '#69C779',
|
|
5
5
|
alto: '#D8D8D8',
|
|
6
6
|
dustyGray: '#979797',
|
|
7
|
-
lightSkyBlue: '#87CEFA'
|
|
8
|
-
black: '#040405'
|
|
7
|
+
lightSkyBlue: '#87CEFA'
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
export default colors;
|
|
@@ -13,51 +13,53 @@ function BaseToast({
|
|
|
13
13
|
text1,
|
|
14
14
|
text2,
|
|
15
15
|
onPress,
|
|
16
|
+
onLeadingIconPress,
|
|
17
|
+
onTrailingIconPress,
|
|
16
18
|
style,
|
|
19
|
+
leadingIconContainerStyle,
|
|
20
|
+
trailingIconContainerStyle,
|
|
21
|
+
leadingIconStyle,
|
|
22
|
+
trailingIconStyle,
|
|
17
23
|
contentContainerStyle,
|
|
18
24
|
text1Style,
|
|
19
25
|
text2Style,
|
|
20
26
|
activeOpacity,
|
|
21
27
|
text1NumberOfLines,
|
|
22
|
-
text2NumberOfLines
|
|
23
|
-
primaryBtn,
|
|
24
|
-
secondaryBtn
|
|
28
|
+
text2NumberOfLines
|
|
25
29
|
}) {
|
|
26
30
|
return (
|
|
27
31
|
<TouchableOpacity
|
|
28
32
|
testID='rootView'
|
|
29
|
-
style={[styles.base, styles.
|
|
33
|
+
style={[styles.base, styles.borderLeft, style]}
|
|
30
34
|
onPress={onPress}
|
|
31
35
|
activeOpacity={onPress ? activeOpacity : 1}>
|
|
36
|
+
{leadingIcon && (
|
|
37
|
+
<TouchableOpacity
|
|
38
|
+
testID='leadingIcon'
|
|
39
|
+
style={[styles.leadingIconContainer, leadingIconContainerStyle]}
|
|
40
|
+
onPress={onLeadingIconPress}
|
|
41
|
+
activeOpacity={onLeadingIconPress ? activeOpacity : 1}>
|
|
42
|
+
<Icon
|
|
43
|
+
style={{ ...styles.leadingIcon, ...leadingIconStyle }}
|
|
44
|
+
source={leadingIcon}
|
|
45
|
+
/>
|
|
46
|
+
</TouchableOpacity>
|
|
47
|
+
)}
|
|
48
|
+
|
|
32
49
|
<View
|
|
33
50
|
testID='contentContainer'
|
|
34
51
|
style={[styles.contentContainer, contentContainerStyle]}>
|
|
35
|
-
{
|
|
36
|
-
<View
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
style={{
|
|
44
|
-
flexDirection: 'row',
|
|
45
|
-
flex: 1
|
|
46
|
-
}}>
|
|
47
|
-
{leadingIcon ? leadingIcon : <></>}
|
|
48
|
-
<Text
|
|
49
|
-
testID='text1'
|
|
50
|
-
style={[styles.text1, text1Style]}
|
|
51
|
-
numberOfLines={text1NumberOfLines}>
|
|
52
|
-
{text1}
|
|
53
|
-
</Text>
|
|
54
|
-
</View>
|
|
55
|
-
<View style={{ justifyContent: 'flex-start', alignSelf: 'center' }}>
|
|
56
|
-
{trailingIcon ? trailingIcon : <></>}
|
|
57
|
-
</View>
|
|
52
|
+
{text1?.length > 0 && (
|
|
53
|
+
<View>
|
|
54
|
+
<Text
|
|
55
|
+
testID='text1'
|
|
56
|
+
style={[styles.text1, text1Style]}
|
|
57
|
+
numberOfLines={text1NumberOfLines}>
|
|
58
|
+
{text1}
|
|
59
|
+
</Text>
|
|
58
60
|
</View>
|
|
59
61
|
)}
|
|
60
|
-
{
|
|
62
|
+
{text2?.length > 0 && (
|
|
61
63
|
<View>
|
|
62
64
|
<Text
|
|
63
65
|
testID='text2'
|
|
@@ -67,21 +69,20 @@ function BaseToast({
|
|
|
67
69
|
</Text>
|
|
68
70
|
</View>
|
|
69
71
|
)}
|
|
70
|
-
{primaryBtn || secondaryBtn ? (
|
|
71
|
-
<View
|
|
72
|
-
style={{
|
|
73
|
-
flex: 1,
|
|
74
|
-
flexDirection: 'row',
|
|
75
|
-
paddingTop: 32,
|
|
76
|
-
paddingBottom: 24
|
|
77
|
-
}}>
|
|
78
|
-
{primaryBtn ? primaryBtn : <></>}
|
|
79
|
-
{secondaryBtn ? secondaryBtn : <></>}
|
|
80
|
-
</View>
|
|
81
|
-
) : (
|
|
82
|
-
<></>
|
|
83
|
-
)}
|
|
84
72
|
</View>
|
|
73
|
+
|
|
74
|
+
{trailingIcon && (
|
|
75
|
+
<TouchableOpacity
|
|
76
|
+
testID='trailingIcon'
|
|
77
|
+
style={[styles.trailingIconContainer, trailingIconContainerStyle]}
|
|
78
|
+
onPress={onTrailingIconPress}
|
|
79
|
+
activeOpacity={onTrailingIconPress ? activeOpacity : 1}>
|
|
80
|
+
<Icon
|
|
81
|
+
style={{ ...styles.trailingIcon, ...trailingIconStyle }}
|
|
82
|
+
source={trailingIcon}
|
|
83
|
+
/>
|
|
84
|
+
</TouchableOpacity>
|
|
85
|
+
)}
|
|
85
86
|
</TouchableOpacity>
|
|
86
87
|
);
|
|
87
88
|
}
|
|
@@ -89,12 +90,18 @@ function BaseToast({
|
|
|
89
90
|
BaseToast.HEIGHT = HEIGHT;
|
|
90
91
|
|
|
91
92
|
BaseToast.propTypes = {
|
|
92
|
-
leadingIcon:
|
|
93
|
-
trailingIcon:
|
|
93
|
+
leadingIcon: Icon.propTypes.source,
|
|
94
|
+
trailingIcon: Icon.propTypes.source,
|
|
94
95
|
text1: PropTypes.string,
|
|
95
96
|
text2: PropTypes.string,
|
|
96
97
|
onPress: PropTypes.func,
|
|
98
|
+
onTrailingIconPress: PropTypes.func,
|
|
99
|
+
onLeadingIconPress: PropTypes.func,
|
|
97
100
|
style: stylePropType,
|
|
101
|
+
leadingIconContainerStyle: stylePropType,
|
|
102
|
+
trailingIconContainerStyle: stylePropType,
|
|
103
|
+
leadingIconStyle: stylePropType,
|
|
104
|
+
trailingIconStyle: stylePropType,
|
|
98
105
|
contentContainerStyle: stylePropType,
|
|
99
106
|
text1Style: stylePropType,
|
|
100
107
|
text2Style: stylePropType,
|
|
@@ -104,12 +111,18 @@ BaseToast.propTypes = {
|
|
|
104
111
|
};
|
|
105
112
|
|
|
106
113
|
BaseToast.defaultProps = {
|
|
107
|
-
leadingIcon:
|
|
108
|
-
trailingIcon:
|
|
114
|
+
leadingIcon: undefined,
|
|
115
|
+
trailingIcon: icons.close,
|
|
109
116
|
text1: undefined,
|
|
110
117
|
text2: undefined,
|
|
111
118
|
onPress: undefined,
|
|
119
|
+
onLeadingIconPress: undefined,
|
|
120
|
+
onTrailingIconPress: undefined,
|
|
112
121
|
style: undefined,
|
|
122
|
+
leadingIconContainerStyle: undefined,
|
|
123
|
+
trailingIconContainerStyle: undefined,
|
|
124
|
+
leadingIconStyle: undefined,
|
|
125
|
+
trailingIconStyle: undefined,
|
|
113
126
|
contentContainerStyle: undefined,
|
|
114
127
|
text1Style: undefined,
|
|
115
128
|
text2Style: undefined,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
import colors from '../../colors';
|
|
3
3
|
|
|
4
|
-
export const HEIGHT =
|
|
4
|
+
export const HEIGHT = 60;
|
|
5
5
|
|
|
6
6
|
export default StyleSheet.create({
|
|
7
7
|
base: {
|
|
8
8
|
flexDirection: 'row',
|
|
9
9
|
height: HEIGHT,
|
|
10
|
+
width: '90%',
|
|
10
11
|
borderRadius: 6,
|
|
11
12
|
backgroundColor: colors.white,
|
|
12
13
|
shadowOffset: { width: 0, height: 0 },
|
|
@@ -14,27 +15,42 @@ export default StyleSheet.create({
|
|
|
14
15
|
shadowRadius: 6,
|
|
15
16
|
elevation: 2
|
|
16
17
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
borderLeft: {
|
|
19
|
+
borderLeftWidth: 5,
|
|
20
|
+
borderLeftColor: colors.alto
|
|
21
|
+
},
|
|
22
|
+
leadingIconContainer: {
|
|
23
|
+
width: 50,
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
alignItems: 'center'
|
|
20
26
|
},
|
|
21
27
|
contentContainer: {
|
|
22
|
-
paddingLeft: 20,
|
|
23
28
|
flex: 1,
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
alignItems: 'flex-start' // in case of rtl the text will start from the right
|
|
31
|
+
},
|
|
32
|
+
trailingIconContainer: {
|
|
33
|
+
width: 40,
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
alignItems: 'center'
|
|
36
|
+
},
|
|
37
|
+
leadingIcon: {
|
|
38
|
+
width: 20,
|
|
39
|
+
height: 20
|
|
40
|
+
},
|
|
41
|
+
trailingIcon: {
|
|
42
|
+
width: 9,
|
|
43
|
+
height: 9
|
|
26
44
|
},
|
|
27
45
|
text1: {
|
|
28
|
-
fontSize:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
marginRight: 2
|
|
46
|
+
fontSize: 12,
|
|
47
|
+
fontWeight: 'bold',
|
|
48
|
+
marginBottom: 3,
|
|
49
|
+
width: '100%'
|
|
33
50
|
},
|
|
34
51
|
text2: {
|
|
35
|
-
fontSize:
|
|
36
|
-
|
|
37
|
-
width: '100%'
|
|
38
|
-
fontWeight: '400'
|
|
52
|
+
fontSize: 10,
|
|
53
|
+
color: colors.dustyGray,
|
|
54
|
+
width: '100%'
|
|
39
55
|
}
|
|
40
56
|
});
|
|
@@ -8,9 +8,8 @@ function ErrorToast(props) {
|
|
|
8
8
|
return (
|
|
9
9
|
<BaseToast
|
|
10
10
|
{...props}
|
|
11
|
-
style={{
|
|
12
|
-
|
|
13
|
-
text2Style={{ color: colors.blazeOrange }}
|
|
11
|
+
style={{ borderLeftColor: colors.blazeOrange }}
|
|
12
|
+
leadingIcon={icons.error}
|
|
14
13
|
/>
|
|
15
14
|
);
|
|
16
15
|
}
|
|
@@ -8,9 +8,8 @@ function InfoToast(props) {
|
|
|
8
8
|
return (
|
|
9
9
|
<BaseToast
|
|
10
10
|
{...props}
|
|
11
|
-
style={{
|
|
12
|
-
|
|
13
|
-
text2Style={{ color: colors.black }}
|
|
11
|
+
style={{ borderLeftColor: colors.lightSkyBlue }}
|
|
12
|
+
leadingIcon={icons.info}
|
|
14
13
|
/>
|
|
15
14
|
);
|
|
16
15
|
}
|
|
@@ -8,9 +8,8 @@ function SuccessToast(props) {
|
|
|
8
8
|
return (
|
|
9
9
|
<BaseToast
|
|
10
10
|
{...props}
|
|
11
|
-
style={{
|
|
12
|
-
|
|
13
|
-
text2Style={{ color: colors.black }}
|
|
11
|
+
style={{ borderLeftColor: colors.mantis }}
|
|
12
|
+
leadingIcon={icons.success}
|
|
14
13
|
/>
|
|
15
14
|
);
|
|
16
15
|
}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { Animated, PanResponder, Keyboard
|
|
2
|
+
import { Animated, PanResponder, Keyboard } from 'react-native';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
|
|
5
5
|
import SuccessToast from './components/success';
|
|
6
6
|
import ErrorToast from './components/error';
|
|
7
7
|
import InfoToast from './components/info';
|
|
8
|
-
|
|
9
8
|
import { complement } from './utils/arr';
|
|
10
9
|
import { includeKeys } from './utils/obj';
|
|
11
10
|
import { stylePropType } from './utils/prop-types';
|
|
12
11
|
import { isIOS } from './utils/platform';
|
|
13
12
|
import styles from './styles';
|
|
14
|
-
import isMobileOrTablet from '../../src/utils/isMobileOrTablet';
|
|
15
|
-
import { isMobileUA, isWebInternal } from '../../src/utils/common';
|
|
16
13
|
|
|
17
14
|
const FRICTION = 8;
|
|
18
15
|
|
|
@@ -84,15 +81,11 @@ class Toast extends Component {
|
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
static show(options = {}) {
|
|
87
|
-
Toast._ref
|
|
84
|
+
Toast._ref.show(options);
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
static hide() {
|
|
91
|
-
Toast._ref
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
static getToastId() {
|
|
95
|
-
return Toast._ref?.getToastId();
|
|
88
|
+
Toast._ref.hide();
|
|
96
89
|
}
|
|
97
90
|
|
|
98
91
|
constructor(props) {
|
|
@@ -116,10 +109,7 @@ class Toast extends Component {
|
|
|
116
109
|
keyboardHeight: 0,
|
|
117
110
|
keyboardVisible: false,
|
|
118
111
|
|
|
119
|
-
customProps: {}
|
|
120
|
-
customStyle: this.getCustomStyle(),
|
|
121
|
-
isHovered: false,
|
|
122
|
-
toastId: 0
|
|
112
|
+
customProps: {}
|
|
123
113
|
};
|
|
124
114
|
|
|
125
115
|
this.panResponder = PanResponder.create({
|
|
@@ -136,40 +126,6 @@ class Toast extends Component {
|
|
|
136
126
|
});
|
|
137
127
|
}
|
|
138
128
|
|
|
139
|
-
getToastId = () => {
|
|
140
|
-
return this.state?.toastId;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
getCustomStyle = () => {
|
|
144
|
-
let customStyle = {};
|
|
145
|
-
if (isMobileOrTablet() || Dimensions.get('window').width < 768) {
|
|
146
|
-
customStyle = {
|
|
147
|
-
left: '3%',
|
|
148
|
-
right: '3%',
|
|
149
|
-
width: '94%'
|
|
150
|
-
};
|
|
151
|
-
} else if (Dimensions.get('window').width < 900) {
|
|
152
|
-
customStyle = {
|
|
153
|
-
left: '18%',
|
|
154
|
-
right: '18%',
|
|
155
|
-
width: '64%'
|
|
156
|
-
};
|
|
157
|
-
} else if (Dimensions.get('window').width < 1200) {
|
|
158
|
-
customStyle = {
|
|
159
|
-
left: '25%',
|
|
160
|
-
right: '25%',
|
|
161
|
-
width: '50%'
|
|
162
|
-
};
|
|
163
|
-
} else {
|
|
164
|
-
customStyle = {
|
|
165
|
-
left: '33.33%',
|
|
166
|
-
right: '33.33%',
|
|
167
|
-
width: '33.33%'
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
return customStyle;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
129
|
componentDidMount() {
|
|
174
130
|
const noop = {
|
|
175
131
|
remove: () => {}
|
|
@@ -295,29 +251,24 @@ class Toast extends Component {
|
|
|
295
251
|
}
|
|
296
252
|
}
|
|
297
253
|
|
|
298
|
-
async hide({ speed
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
const { onHide } = this.state;
|
|
318
|
-
if (onHide) {
|
|
319
|
-
onHide();
|
|
320
|
-
}
|
|
254
|
+
async hide({ speed } = {}) {
|
|
255
|
+
await this._setState((prevState) => ({
|
|
256
|
+
...prevState,
|
|
257
|
+
inProgress: true
|
|
258
|
+
}));
|
|
259
|
+
await this.animateHide({
|
|
260
|
+
speed
|
|
261
|
+
});
|
|
262
|
+
this.clearTimer();
|
|
263
|
+
await this._setState((prevState) => ({
|
|
264
|
+
...prevState,
|
|
265
|
+
isVisible: false,
|
|
266
|
+
inProgress: false
|
|
267
|
+
}));
|
|
268
|
+
|
|
269
|
+
const { onHide } = this.state;
|
|
270
|
+
if (onHide) {
|
|
271
|
+
onHide();
|
|
321
272
|
}
|
|
322
273
|
}
|
|
323
274
|
|
|
@@ -380,14 +331,9 @@ class Toast extends Component {
|
|
|
380
331
|
'isVisible',
|
|
381
332
|
'text1',
|
|
382
333
|
'text2',
|
|
383
|
-
'leadingIcon',
|
|
384
334
|
'hide',
|
|
385
335
|
'show',
|
|
386
|
-
'onPress'
|
|
387
|
-
'primaryBtn',
|
|
388
|
-
'secondaryBtn',
|
|
389
|
-
'checkbox',
|
|
390
|
-
'toastId'
|
|
336
|
+
'onPress'
|
|
391
337
|
]
|
|
392
338
|
}),
|
|
393
339
|
props: { ...customProps },
|
|
@@ -412,11 +358,6 @@ class Toast extends Component {
|
|
|
412
358
|
|
|
413
359
|
return [
|
|
414
360
|
styles.base,
|
|
415
|
-
{
|
|
416
|
-
left: this.state.customStyle.left,
|
|
417
|
-
right: this.state.customStyle.right,
|
|
418
|
-
width: this.state.customStyle.width
|
|
419
|
-
},
|
|
420
361
|
styles[position],
|
|
421
362
|
{
|
|
422
363
|
transform: [{ translateY }]
|
|
@@ -425,10 +366,7 @@ class Toast extends Component {
|
|
|
425
366
|
}
|
|
426
367
|
|
|
427
368
|
onLayout(e) {
|
|
428
|
-
this.setState({
|
|
429
|
-
height: e.nativeEvent.layout.height,
|
|
430
|
-
customStyle: this.getCustomStyle()
|
|
431
|
-
});
|
|
369
|
+
this.setState({ height: e.nativeEvent.layout.height });
|
|
432
370
|
}
|
|
433
371
|
|
|
434
372
|
render() {
|
|
@@ -437,45 +375,16 @@ class Toast extends Component {
|
|
|
437
375
|
const baseStyle = this.getBaseStyle(position, keyboardHeight);
|
|
438
376
|
|
|
439
377
|
return (
|
|
440
|
-
<
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
if (!value) {
|
|
448
|
-
this.startTimer();
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
}}>
|
|
453
|
-
<Animated.View
|
|
454
|
-
testID='animatedView'
|
|
455
|
-
onLayout={this.onLayout}
|
|
456
|
-
style={[baseStyle, style, { zIndex: 100 }]} //added zindex
|
|
457
|
-
{...this.panResponder.panHandlers}>
|
|
458
|
-
{this.renderContent(this.props)}
|
|
459
|
-
</Animated.View>
|
|
460
|
-
</PlatformWrapper>
|
|
378
|
+
<Animated.View
|
|
379
|
+
testID='animatedView'
|
|
380
|
+
onLayout={this.onLayout}
|
|
381
|
+
style={[baseStyle, style, { zIndex: 100 }]} //added zindex
|
|
382
|
+
{...this.panResponder.panHandlers}>
|
|
383
|
+
{this.renderContent(this.props)}
|
|
384
|
+
</Animated.View>
|
|
461
385
|
);
|
|
462
386
|
}
|
|
463
387
|
}
|
|
464
|
-
const PlatformWrapper = ({ children, setIsHovered }) => {
|
|
465
|
-
return isWebInternal() ? (
|
|
466
|
-
<div
|
|
467
|
-
onMouseEnter={() => {
|
|
468
|
-
setIsHovered(true);
|
|
469
|
-
}}
|
|
470
|
-
onMouseLeave={() => {
|
|
471
|
-
setIsHovered(false);
|
|
472
|
-
}}>
|
|
473
|
-
{children}
|
|
474
|
-
</div>
|
|
475
|
-
) : (
|
|
476
|
-
<>{children}</>
|
|
477
|
-
);
|
|
478
|
-
};
|
|
479
388
|
|
|
480
389
|
Toast.propTypes = {
|
|
481
390
|
config: PropTypes.objectOf(PropTypes.func),
|