agora-appbuilder-core 2.0.0 → 2.0.1
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/package.json +3 -2
- package/template/_package-lock.json +22850 -0
- package/template/agora-rn-uikit/.git/HEAD +1 -1
- package/template/agora-rn-uikit/.git/index +0 -0
- package/template/agora-rn-uikit/.git/logs/HEAD +2 -3
- package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +1 -1
- package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -1
- package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -1
- package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.idx +0 -0
- package/template/agora-rn-uikit/.git/objects/pack/{pack-19a65e0782e617d79275088a06e668496d6e2d73.pack → pack-f379286d0537eb68377220b4929979324b8d5d1c.pack} +0 -0
- package/template/agora-rn-uikit/.git/packed-refs +3 -2
- package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +1 -1
- package/template/agora-rn-uikit/package.json +1 -0
- package/template/agora-rn-uikit/src/AgoraUIKit.tsx +8 -8
- package/template/agora-rn-uikit/src/{LocalUserContext.tsx → Contexts/LocalUserContext.tsx} +1 -1
- package/template/agora-rn-uikit/src/{MaxUidContext.tsx → Contexts/MaxUidContext.tsx} +0 -0
- package/template/agora-rn-uikit/src/{MinUidContext.tsx → Contexts/MinUidContext.tsx} +0 -0
- package/template/agora-rn-uikit/src/{PropsContext.tsx → Contexts/PropsContext.tsx} +34 -16
- package/template/agora-rn-uikit/src/{RtcContext.tsx → Contexts/RtcContext.tsx} +12 -21
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +25 -15
- package/template/agora-rn-uikit/src/Controls/Icons.ts +53 -3
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +53 -0
- package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +4 -3
- package/template/agora-rn-uikit/src/Controls/Local/FullScreen.tsx +3 -3
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +58 -14
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +60 -14
- package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +2 -2
- package/template/agora-rn-uikit/src/Controls/Local/Screenshare.tsx +2 -2
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +9 -9
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +20 -17
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +8 -8
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +3 -3
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +13 -8
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +1 -2
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +26 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +26 -0
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +46 -0
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +47 -0
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +20 -0
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +21 -0
- package/template/agora-rn-uikit/src/Reducer/index.ts +9 -0
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +138 -0
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +100 -0
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +197 -0
- package/template/agora-rn-uikit/src/Style.ts +3 -3
- package/template/agora-rn-uikit/src/Utils/actionTypeGuard.tsx +9 -0
- package/template/agora-rn-uikit/src/{events.ts → Utils/events.ts} +0 -0
- package/template/agora-rn-uikit/src/{permission.ts → Utils/permission.ts} +0 -0
- package/template/agora-rn-uikit/src/{quality.tsx → Utils/quality.tsx} +0 -0
- package/template/agora-rn-uikit/src/{MaxVideoView.native.tsx → Views/MaxVideoView.native.tsx} +3 -4
- package/template/agora-rn-uikit/src/{MaxVideoView.tsx → Views/MaxVideoView.tsx} +3 -4
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +86 -0
- package/template/agora-rn-uikit/src/index.ts +67 -0
- package/template/bridge/rtc/webNg/RtcEngine.ts +23 -6
- package/template/package-lock.json +22850 -0
- package/template/package.json +6 -5
- package/template/src/assets/icons.ts +35 -6
- package/template/src/atoms/SecondaryButton.tsx +6 -5
- package/template/src/atoms/TextInput.tsx +6 -1
- package/template/src/components/Chat.tsx +50 -21
- package/template/src/components/ChatContext.ts +22 -1
- package/template/src/components/Controls.native.tsx +2 -2
- package/template/src/components/Controls.tsx +2 -2
- package/template/src/components/DeviceConfigure.tsx +1 -1
- package/template/src/components/GridVideo.tsx +69 -31
- package/template/src/components/Navbar.tsx +136 -113
- package/template/src/components/NetworkQualityContext.tsx +134 -0
- package/template/src/components/ParticipantsView.tsx +105 -49
- package/template/src/components/PinnedVideo.tsx +112 -71
- package/template/src/components/Precall.native.tsx +20 -9
- package/template/src/components/Precall.tsx +35 -32
- package/template/src/components/RTMConfigure.tsx +331 -181
- package/template/src/components/RTMEvents.tsx +84 -0
- package/template/src/components/Settings.tsx +19 -16
- package/template/src/components/Share.tsx +131 -62
- package/template/src/hooks/useImageDelay.tsx +28 -0
- package/template/src/pages/Create.tsx +9 -3
- package/template/src/pages/VideoCall.tsx +124 -98
- package/template/src/subComponents/ChatContainer.tsx +40 -28
- package/template/src/subComponents/CopyJoinInfo.tsx +9 -12
- package/template/src/subComponents/LocalAudioMute.tsx +9 -9
- package/template/src/subComponents/LocalVideoMute.tsx +9 -9
- package/template/src/subComponents/NetworkQualityPill.tsx +161 -0
- package/template/src/subComponents/Recording.tsx +12 -16
- package/template/src/subComponents/RemoteAudioMute.tsx +23 -27
- package/template/src/subComponents/RemoteEndCall.tsx +7 -15
- package/template/src/subComponents/RemoteVideoMute.tsx +15 -28
- package/template/src/subComponents/ScreenShareNotice.tsx +61 -0
- package/template/src/subComponents/ScreenshareButton.tsx +74 -75
- package/template/src/subComponents/SwitchCamera.tsx +5 -2
- package/template/src/subComponents/TextWithTooltip.native.tsx +128 -0
- package/template/src/subComponents/TextWithTooltip.tsx +44 -0
- package/template/src/subComponents/toastConfig.tsx +2 -2
- package/template/src/utils/isSafariBrowser.tsx +22 -0
- package/template/agora-rn-uikit/.git/objects/pack/pack-19a65e0782e617d79275088a06e668496d6e2d73.idx +0 -0
- package/template/agora-rn-uikit/Components.js +0 -35
- package/template/agora-rn-uikit/Contexts.js +0 -7
- package/template/agora-rn-uikit/index.js +0 -12
- package/template/agora-rn-uikit/src/MinVideoView.tsx +0 -87
- package/template/agora-rn-uikit/src/RTCConfigure.tsx +0 -520
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
ref: refs/heads/ab-dev-auto
|
|
Binary file
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
0000000000000000000000000000000000000000 7f9cd41e1bf3ea1b110e2706c7e4c5a921230647 nitte93 <nitte.tiwari1993@gmail.com>
|
|
2
|
-
7f9cd41e1bf3ea1b110e2706c7e4c5a921230647
|
|
3
|
-
9905eb69508632f549ecf30575d2f87aae1577f4 8fc5fc01c21b962704586b9c1a5f15eee06a7500 nitte93 <nitte.tiwari1993@gmail.com> 1642669583 +0530 checkout: moving from ab-dev-auto to 8fc5fc01c21b962704586b9c1a5f15eee06a7500
|
|
1
|
+
0000000000000000000000000000000000000000 7f9cd41e1bf3ea1b110e2706c7e4c5a921230647 nitte93 <nitte.tiwari1993@gmail.com> 1643712825 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
|
|
2
|
+
7f9cd41e1bf3ea1b110e2706c7e4c5a921230647 3fad3e8996dbe300efbf023d89d38aae24bbb26f nitte93 <nitte.tiwari1993@gmail.com> 1643712825 +0530 checkout: moving from master to ab-dev-auto
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0000000000000000000000000000000000000000
|
|
1
|
+
0000000000000000000000000000000000000000 3fad3e8996dbe300efbf023d89d38aae24bbb26f nitte93 <nitte.tiwari1993@gmail.com> 1643712825 +0530 branch: Created from refs/remotes/origin/ab-dev-auto
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0000000000000000000000000000000000000000 7f9cd41e1bf3ea1b110e2706c7e4c5a921230647 nitte93 <nitte.tiwari1993@gmail.com>
|
|
1
|
+
0000000000000000000000000000000000000000 7f9cd41e1bf3ea1b110e2706c7e4c5a921230647 nitte93 <nitte.tiwari1993@gmail.com> 1643712825 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0000000000000000000000000000000000000000 7f9cd41e1bf3ea1b110e2706c7e4c5a921230647 nitte93 <nitte.tiwari1993@gmail.com>
|
|
1
|
+
0000000000000000000000000000000000000000 7f9cd41e1bf3ea1b110e2706c7e4c5a921230647 nitte93 <nitte.tiwari1993@gmail.com> 1643712825 +0530 clone: from https://github.com/AgoraIO-Community/ReactNative-UIKit
|
package/template/agora-rn-uikit/.git/objects/pack/pack-f379286d0537eb68377220b4929979324b8d5d1c.idx
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# pack-refs with: peeled fully-peeled sorted
|
|
2
|
-
|
|
2
|
+
3fad3e8996dbe300efbf023d89d38aae24bbb26f refs/remotes/origin/ab-dev-auto
|
|
3
3
|
fd59daf4876e4eb142856957f9450ef5175f4e0f refs/remotes/origin/app-builder
|
|
4
4
|
c60cde905c722aeaf8f25aeed2910a7b4d532cfa refs/remotes/origin/app-builder-dev
|
|
5
|
+
83064dc5031b9a88a170c6b91ee725ad072eadb1 refs/remotes/origin/bugfix/camera-green-light-on-precall
|
|
5
6
|
5d4f38ae0a89b20275e2497a4e8f43b0ca2830e4 refs/remotes/origin/dev
|
|
6
7
|
4ec093e51924049e37d247d867a5482a9376a8cf refs/remotes/origin/docs
|
|
7
8
|
002960cf34f06ffd3e905e6de9865460f02bd910 refs/remotes/origin/feat/icon-tint
|
|
8
|
-
|
|
9
|
+
233d494c4dfc2a18ce598f3a12f419ec894e91f5 refs/remotes/origin/feature/ui-kit/raise-hand
|
|
9
10
|
7f9cd41e1bf3ea1b110e2706c7e4c5a921230647 refs/remotes/origin/master
|
|
10
11
|
01ad019ae514b6502b64a30b357a20af49b8c8a5 refs/remotes/origin/refactor
|
|
11
12
|
ac8929fda04db3663a7c1eb9c71ca6a97728f0eb refs/remotes/origin/v2-legacy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3fad3e8996dbe300efbf023d89d38aae24bbb26f
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"name": "Vineeth Srinivasn",
|
|
6
6
|
"email": "vineeth@agora.io"
|
|
7
7
|
},
|
|
8
|
+
"main": "./src/index.ts",
|
|
8
9
|
"description": "Agora react native UI KIT. Rapidly integrate video calling into your React Native application with built in UI Elements.",
|
|
9
10
|
"scripts": {
|
|
10
11
|
"android": "react-native run-android",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {ScrollView, View} from 'react-native';
|
|
3
|
-
import RtcConfigure from './
|
|
4
|
-
import MaxVideoView from './MaxVideoView';
|
|
5
|
-
import MinVideoView from './MinVideoView';
|
|
6
|
-
import {MinUidConsumer} from './MinUidContext';
|
|
7
|
-
import {MaxUidConsumer} from './MaxUidContext';
|
|
8
|
-
import {PropsProvider, PropsInterface} from './PropsContext';
|
|
3
|
+
import RtcConfigure from './RtcConfigure';
|
|
4
|
+
import MaxVideoView from './Views/MaxVideoView';
|
|
5
|
+
import MinVideoView from './Views/MinVideoView';
|
|
6
|
+
import {MinUidConsumer} from './Contexts/MinUidContext';
|
|
7
|
+
import {MaxUidConsumer} from './Contexts/MaxUidContext';
|
|
8
|
+
import {PropsProvider, PropsInterface} from './Contexts/PropsContext';
|
|
9
9
|
|
|
10
10
|
import styles from './Style';
|
|
11
11
|
import LocalControls from './Controls/LocalControls';
|
|
@@ -15,7 +15,7 @@ import LocalControls from './Controls/LocalControls';
|
|
|
15
15
|
const AgoraUIKit: React.FC<PropsInterface> = (props) => {
|
|
16
16
|
return (
|
|
17
17
|
<PropsProvider value={props}>
|
|
18
|
-
<View>
|
|
18
|
+
<View style={{backgroundColor: '#000', flex: 1}}>
|
|
19
19
|
<RtcConfigure>
|
|
20
20
|
<MaxUidConsumer>
|
|
21
21
|
{(maxUsers) => (
|
|
@@ -30,7 +30,7 @@ const AgoraUIKit: React.FC<PropsInterface> = (props) => {
|
|
|
30
30
|
<MinUidConsumer>
|
|
31
31
|
{(minUsers) =>
|
|
32
32
|
minUsers.map((user) => (
|
|
33
|
-
<MinVideoView user={user} key={user.uid} />
|
|
33
|
+
<MinVideoView showOverlay user={user} key={user.uid} />
|
|
34
34
|
))
|
|
35
35
|
}
|
|
36
36
|
</MinUidConsumer>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {useContext, createContext} from 'react';
|
|
2
2
|
import MaxUidContext from './MaxUidContext';
|
|
3
3
|
import MinUidContext from './MinUidContext';
|
|
4
|
-
import {UidInterface} from './
|
|
4
|
+
import {UidInterface} from './PropsContext';
|
|
5
5
|
|
|
6
6
|
export const LocalContext = createContext<UidInterface>({} as UidInterface);
|
|
7
7
|
export const LocalProvider = LocalContext.Provider;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {StyleProp, ViewStyle} from 'react-native';
|
|
3
|
-
import {RtcEngineEvents} from 'react-native-agora/lib/RtcEvents';
|
|
3
|
+
import {RtcEngineEvents} from 'react-native-agora/lib/typescript/src/common/RtcEvents';
|
|
4
4
|
import {EncryptionMode} from 'react-native-agora';
|
|
5
|
-
import {VideoProfile} from '
|
|
6
|
-
|
|
5
|
+
import {VideoProfile} from '../Utils/quality';
|
|
6
|
+
|
|
7
|
+
// disabled is intentionally kept as the 1st item in the enum.
|
|
8
|
+
// This way, it evaluates to a falsy value in a if statement
|
|
9
|
+
export enum ToggleState {
|
|
10
|
+
disabled,
|
|
11
|
+
enabled,
|
|
12
|
+
disabling, // enabled -> disabling -> disabled
|
|
13
|
+
enabling, // disabled -> enabling -> enabled
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const toggleHelper = (state: ToggleState) =>
|
|
17
|
+
state === ToggleState.enabled ? ToggleState.disabled : ToggleState.enabled;
|
|
18
|
+
|
|
19
|
+
export interface UidInterface {
|
|
7
20
|
// TODO: refactor local to 0 and remove string.
|
|
8
21
|
uid: number | string;
|
|
9
|
-
audio:
|
|
10
|
-
video:
|
|
22
|
+
audio: ToggleState;
|
|
23
|
+
video: ToggleState;
|
|
24
|
+
streamType: 'high' | 'low';
|
|
11
25
|
}
|
|
12
26
|
|
|
13
27
|
interface remoteBtnStylesInterface {
|
|
@@ -49,7 +63,8 @@ export interface RtcPropsInterface {
|
|
|
49
63
|
token?: string | null;
|
|
50
64
|
dual?: boolean | null;
|
|
51
65
|
profile?: VideoProfile;
|
|
52
|
-
initialDualStreamMode
|
|
66
|
+
initialDualStreamMode?: DualStreamMode;
|
|
67
|
+
callActive?: boolean;
|
|
53
68
|
encryption?: {
|
|
54
69
|
key: string;
|
|
55
70
|
mode:
|
|
@@ -59,21 +74,24 @@ export interface RtcPropsInterface {
|
|
|
59
74
|
};
|
|
60
75
|
}
|
|
61
76
|
|
|
62
|
-
export interface
|
|
63
|
-
EndCall(): void;
|
|
64
|
-
FullScreen(): void;
|
|
65
|
-
SwitchCamera(): void;
|
|
77
|
+
export interface CallbacksInterface {
|
|
78
|
+
EndCall(): void; //?
|
|
79
|
+
FullScreen(): void; //?
|
|
80
|
+
SwitchCamera(): void; //Not in reducer
|
|
81
|
+
UpdateDualStreamMode(mode: DualStreamMode): void;
|
|
82
|
+
UserJoined: RtcEngineEvents['UserJoined'];
|
|
83
|
+
UserOffline: RtcEngineEvents['UserOffline'];
|
|
66
84
|
SwapVideo(user: UidInterface): void;
|
|
67
85
|
UserMuteRemoteAudio(user: UidInterface, muted: UidInterface['audio']): void;
|
|
68
86
|
UserMuteRemoteVideo(user: UidInterface, muted: UidInterface['video']): void;
|
|
69
|
-
LocalMuteAudio(muted:
|
|
70
|
-
LocalMuteVideo(muted:
|
|
71
|
-
|
|
87
|
+
LocalMuteAudio(muted: ToggleState): void;
|
|
88
|
+
LocalMuteVideo(muted: ToggleState): void;
|
|
89
|
+
RemoteAudioStateChanged: RtcEngineEvents['RemoteAudioStateChanged'];
|
|
90
|
+
RemoteVideoStateChanged: RtcEngineEvents['RemoteVideoStateChanged'];
|
|
91
|
+
JoinChannelSuccess: RtcEngineEvents['JoinChannelSuccess'];
|
|
72
92
|
}
|
|
73
93
|
|
|
74
|
-
export
|
|
75
|
-
extends RtcEngineEvents,
|
|
76
|
-
CustomCallbacksInterface {}
|
|
94
|
+
export type CustomCallbacksInterface = CallbacksInterface;
|
|
77
95
|
|
|
78
96
|
export interface PropsInterface {
|
|
79
97
|
rtcProps: RtcPropsInterface;
|
|
@@ -1,40 +1,31 @@
|
|
|
1
1
|
import React, {Dispatch} from 'react';
|
|
2
2
|
import {CallbacksInterface} from './PropsContext';
|
|
3
3
|
import RtcEngine from 'react-native-agora';
|
|
4
|
-
import type {DualStreamMode} from './PropsContext';
|
|
5
|
-
export interface UidInterface {
|
|
6
|
-
// TODO: refactor local to 0 and remove string.
|
|
7
|
-
uid: number | string;
|
|
8
|
-
audio: boolean;
|
|
9
|
-
video: boolean;
|
|
10
|
-
streamType: 'high' | 'low';
|
|
11
|
-
}
|
|
4
|
+
import type {DualStreamMode, UidInterface} from './PropsContext';
|
|
12
5
|
|
|
13
6
|
export interface UidStateInterface {
|
|
14
7
|
min: Array<UidInterface>;
|
|
15
8
|
max: Array<UidInterface>;
|
|
16
9
|
}
|
|
17
10
|
|
|
18
|
-
export interface ActionInterface<
|
|
19
|
-
T extends keyof CallbacksInterface,
|
|
20
|
-
K extends CallbacksInterface
|
|
21
|
-
> {
|
|
11
|
+
export interface ActionInterface<T extends keyof CallbacksInterface> {
|
|
22
12
|
type: T;
|
|
23
|
-
value: Parameters<
|
|
13
|
+
value: Parameters<CallbacksInterface[T]>;
|
|
24
14
|
}
|
|
25
15
|
|
|
26
|
-
export type DispatchType
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
export type DispatchType = <
|
|
17
|
+
T extends keyof CallbacksInterface,
|
|
18
|
+
V extends Parameters<CallbacksInterface[T]>,
|
|
19
|
+
>(action: {
|
|
20
|
+
type: T;
|
|
21
|
+
value: V;
|
|
22
|
+
}) => void;
|
|
29
23
|
|
|
30
|
-
export type ActionType<T extends keyof CallbacksInterface> = ActionInterface<
|
|
31
|
-
T,
|
|
32
|
-
CallbacksInterface
|
|
33
|
-
>;
|
|
24
|
+
export type ActionType<T extends keyof CallbacksInterface> = ActionInterface<T>;
|
|
34
25
|
|
|
35
26
|
export interface RtcContextInterface {
|
|
36
27
|
RtcEngine: RtcEngine;
|
|
37
|
-
dispatch: DispatchType
|
|
28
|
+
dispatch: DispatchType;
|
|
38
29
|
setDualStreamMode: React.Dispatch<React.SetStateAction<DualStreamMode>>;
|
|
39
30
|
}
|
|
40
31
|
|
|
@@ -8,9 +8,11 @@ import {
|
|
|
8
8
|
Text,
|
|
9
9
|
View,
|
|
10
10
|
} from 'react-native';
|
|
11
|
-
import PropsContext from '
|
|
11
|
+
import PropsContext from '../Contexts/PropsContext';
|
|
12
12
|
import styles from '../Style';
|
|
13
13
|
import icons, {IconsInterface} from './Icons';
|
|
14
|
+
import useImageDelay from '../../../src/hooks/useImageDelay';
|
|
15
|
+
import isSafariBrowser from '../../../src/utils/isSafariBrowser';
|
|
14
16
|
|
|
15
17
|
interface BtnTemplateInterface {
|
|
16
18
|
name: keyof IconsInterface;
|
|
@@ -18,28 +20,38 @@ interface BtnTemplateInterface {
|
|
|
18
20
|
onPress?: TouchableOpacityProps['onPress'];
|
|
19
21
|
style?: StyleProp<ViewStyle>;
|
|
20
22
|
btnText?: string;
|
|
23
|
+
disabled?: boolean;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
const BtnTemplate: React.FC<BtnTemplateInterface> = (props) => {
|
|
27
|
+
const {disabled = false} = props;
|
|
24
28
|
const {styleProps} = useContext(PropsContext);
|
|
25
29
|
const {BtnTemplateStyles, theme} = styleProps || {};
|
|
26
30
|
|
|
31
|
+
const imageRef = React.useRef(null);
|
|
32
|
+
|
|
33
|
+
if (isSafariBrowser()) {
|
|
34
|
+
// This fixes the tint issue in safari browser
|
|
35
|
+
useImageDelay(imageRef, 10, '');
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
return (
|
|
28
|
-
<TouchableOpacity
|
|
39
|
+
<TouchableOpacity
|
|
40
|
+
style={{width: '100%', height: '100%'}}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
onPress={props.onPress}>
|
|
29
43
|
<View
|
|
30
|
-
style={
|
|
31
|
-
...styles.controlBtn,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}}>
|
|
44
|
+
style={[
|
|
45
|
+
{...styles.controlBtn, ...(BtnTemplateStyles as object)},
|
|
46
|
+
props.style as object,
|
|
47
|
+
]}>
|
|
35
48
|
<Image
|
|
49
|
+
ref={imageRef}
|
|
36
50
|
style={{
|
|
37
51
|
width: '100%',
|
|
38
52
|
height: '100%',
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
? theme || props.color || '#fff'
|
|
42
|
-
: '#FD0845',
|
|
53
|
+
opacity: disabled ? 0.4 : 1,
|
|
54
|
+
tintColor: disabled ? 'grey' : ( props.color || theme || '#fff')
|
|
43
55
|
}}
|
|
44
56
|
resizeMode={'contain'}
|
|
45
57
|
source={{uri: icons[props.name]}}
|
|
@@ -49,10 +61,8 @@ const BtnTemplate: React.FC<BtnTemplateInterface> = (props) => {
|
|
|
49
61
|
style={{
|
|
50
62
|
textAlign: 'center',
|
|
51
63
|
marginTop: 5,
|
|
52
|
-
color:
|
|
53
|
-
|
|
54
|
-
? theme || props.color || '#fff'
|
|
55
|
-
: '#FD0845',
|
|
64
|
+
color: disabled ? 'grey' : (props.color || theme || '#fff'),
|
|
65
|
+
opacity: disabled ? 0.4 : 1
|
|
56
66
|
}}>
|
|
57
67
|
{props.btnText}
|
|
58
68
|
</Text>
|