@100mslive/react-native-room-kit 1.1.2 → 1.1.3
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/lib/commonjs/HMSRoomSetup.js +13 -1
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/Clock/assets/clock-vector.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock-vector@2x.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock-vector@3x.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock@2x.png +0 -0
- package/lib/commonjs/Icons/Clock/assets/clock@3x.png +0 -0
- package/lib/commonjs/Icons/Clock/index.js +7 -2
- package/lib/commonjs/Icons/Clock/index.js.map +1 -1
- package/lib/commonjs/components/CreatePoll.js +3 -2
- package/lib/commonjs/components/CreatePoll.js.map +1 -1
- package/lib/commonjs/components/HLSView.js +15 -1
- package/lib/commonjs/components/HLSView.js.map +1 -1
- package/lib/commonjs/components/HMSPollsQuizzesNotification.js +1 -1
- package/lib/commonjs/components/HMSPollsQuizzesNotification.js.map +1 -1
- package/lib/commonjs/components/LeaderboardEntry.js +135 -0
- package/lib/commonjs/components/LeaderboardEntry.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizSheetScreen.js +69 -0
- package/lib/commonjs/components/PollAndQuizSheetScreen.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizVoting.js +133 -4
- package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -1
- package/lib/commonjs/components/PollQuestions.js +104 -4
- package/lib/commonjs/components/PollQuestions.js.map +1 -1
- package/lib/commonjs/components/PollsAndQuizBottomSheet.js +9 -11
- package/lib/commonjs/components/PollsAndQuizBottomSheet.js.map +1 -1
- package/lib/commonjs/components/PollsAndQuizzesCard.js +1 -1
- package/lib/commonjs/components/PollsAndQuizzesCard.js.map +1 -1
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js +26 -120
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -1
- package/lib/commonjs/components/PollsConfigAndList.js +81 -4
- package/lib/commonjs/components/PollsConfigAndList.js.map +1 -1
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +7 -15
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -1
- package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js +284 -0
- package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js.map +1 -0
- package/lib/commonjs/components/QuizLeaderboardScreen.js +279 -0
- package/lib/commonjs/components/QuizLeaderboardScreen.js.map +1 -0
- package/lib/commonjs/components/QuizLeaderboardSummary.js +195 -0
- package/lib/commonjs/components/QuizLeaderboardSummary.js.map +1 -0
- package/lib/commonjs/components/VoterParticipationSummary.js +46 -0
- package/lib/commonjs/components/VoterParticipationSummary.js.map +1 -0
- package/lib/commonjs/redux/actionTypes.js +7 -1
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +25 -5
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/polls.js +65 -5
- package/lib/commonjs/redux/reducers/polls.js.map +1 -1
- package/lib/commonjs/utils/hooks.js +107 -2
- package/lib/commonjs/utils/hooks.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +13 -1
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/Clock/assets/clock-vector.png +0 -0
- package/lib/module/Icons/Clock/assets/clock-vector@2x.png +0 -0
- package/lib/module/Icons/Clock/assets/clock-vector@3x.png +0 -0
- package/lib/module/Icons/Clock/assets/clock.png +0 -0
- package/lib/module/Icons/Clock/assets/clock@2x.png +0 -0
- package/lib/module/Icons/Clock/assets/clock@3x.png +0 -0
- package/lib/module/Icons/Clock/index.js +7 -2
- package/lib/module/Icons/Clock/index.js.map +1 -1
- package/lib/module/components/CreatePoll.js +4 -3
- package/lib/module/components/CreatePoll.js.map +1 -1
- package/lib/module/components/HLSView.js +17 -3
- package/lib/module/components/HLSView.js.map +1 -1
- package/lib/module/components/HMSPollsQuizzesNotification.js +2 -2
- package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -1
- package/lib/module/components/LeaderboardEntry.js +126 -0
- package/lib/module/components/LeaderboardEntry.js.map +1 -0
- package/lib/module/components/PollAndQuizSheetScreen.js +60 -0
- package/lib/module/components/PollAndQuizSheetScreen.js.map +1 -0
- package/lib/module/components/PollAndQuizVoting.js +135 -6
- package/lib/module/components/PollAndQuizVoting.js.map +1 -1
- package/lib/module/components/PollQuestions.js +107 -7
- package/lib/module/components/PollQuestions.js.map +1 -1
- package/lib/module/components/PollsAndQuizBottomSheet.js +11 -13
- package/lib/module/components/PollsAndQuizBottomSheet.js.map +1 -1
- package/lib/module/components/PollsAndQuizzesCard.js +2 -2
- package/lib/module/components/PollsAndQuizzesCard.js.map +1 -1
- package/lib/module/components/PollsAndQuizzesModalContent.js +28 -122
- package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -1
- package/lib/module/components/PollsConfigAndList.js +82 -5
- package/lib/module/components/PollsConfigAndList.js.map +1 -1
- package/lib/module/components/PreviousPollsAndQuizzesList.js +7 -15
- package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -1
- package/lib/module/components/QuizLeaderboardEntriesScreen.js +275 -0
- package/lib/module/components/QuizLeaderboardEntriesScreen.js.map +1 -0
- package/lib/module/components/QuizLeaderboardScreen.js +270 -0
- package/lib/module/components/QuizLeaderboardScreen.js.map +1 -0
- package/lib/module/components/QuizLeaderboardSummary.js +186 -0
- package/lib/module/components/QuizLeaderboardSummary.js.map +1 -0
- package/lib/module/components/VoterParticipationSummary.js +37 -0
- package/lib/module/components/VoterParticipationSummary.js.map +1 -0
- package/lib/module/redux/actionTypes.js +7 -1
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +18 -3
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/polls.js +65 -5
- package/lib/module/redux/reducers/polls.js.map +1 -1
- package/lib/module/utils/hooks.js +105 -2
- package/lib/module/utils/hooks.js.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/Clock/index.d.ts +1 -0
- package/lib/typescript/Icons/Clock/index.d.ts.map +1 -1
- package/lib/typescript/components/CreatePoll.d.ts.map +1 -1
- package/lib/typescript/components/HLSView.d.ts.map +1 -1
- package/lib/typescript/components/LeaderboardEntry.d.ts +11 -0
- package/lib/typescript/components/LeaderboardEntry.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizSheetScreen.d.ts +8 -0
- package/lib/typescript/components/PollAndQuizSheetScreen.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizVoting.d.ts +2 -0
- package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -1
- package/lib/typescript/components/PollQuestions.d.ts +2 -0
- package/lib/typescript/components/PollQuestions.d.ts.map +1 -1
- package/lib/typescript/components/PollsAndQuizBottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts +0 -1
- package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts.map +1 -1
- package/lib/typescript/components/PollsConfigAndList.d.ts +1 -0
- package/lib/typescript/components/PollsConfigAndList.d.ts.map +1 -1
- package/lib/typescript/components/PreviousPollsAndQuizzesList.d.ts.map +1 -1
- package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts +8 -0
- package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts.map +1 -0
- package/lib/typescript/components/QuizLeaderboardScreen.d.ts +8 -0
- package/lib/typescript/components/QuizLeaderboardScreen.d.ts.map +1 -0
- package/lib/typescript/components/QuizLeaderboardSummary.d.ts +9 -0
- package/lib/typescript/components/QuizLeaderboardSummary.d.ts.map +1 -0
- package/lib/typescript/components/VoterParticipationSummary.d.ts +7 -0
- package/lib/typescript/components/VoterParticipationSummary.d.ts.map +1 -0
- package/lib/typescript/redux/actionTypes.d.ts +29 -8
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +6 -2
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +2 -1
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +2 -1
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/polls.d.ts +3 -2
- package/lib/typescript/redux/reducers/polls.d.ts.map +1 -1
- package/lib/typescript/utils/hooks.d.ts +6 -0
- package/lib/typescript/utils/hooks.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/HMSRoomSetup.tsx +19 -1
- package/src/Icons/Clock/assets/clock-vector.png +0 -0
- package/src/Icons/Clock/assets/clock-vector@2x.png +0 -0
- package/src/Icons/Clock/assets/clock-vector@3x.png +0 -0
- package/src/Icons/Clock/assets/clock.png +0 -0
- package/src/Icons/Clock/assets/clock@2x.png +0 -0
- package/src/Icons/Clock/assets/clock@3x.png +0 -0
- package/src/Icons/Clock/index.tsx +16 -3
- package/src/components/CreatePoll.tsx +7 -2
- package/src/components/HLSView.tsx +27 -1
- package/src/components/HMSPollsQuizzesNotification.tsx +2 -2
- package/src/components/LeaderboardEntry.tsx +172 -0
- package/src/components/PollAndQuizSheetScreen.tsx +85 -0
- package/src/components/PollAndQuizVoting.tsx +181 -7
- package/src/components/PollQuestions.tsx +171 -49
- package/src/components/PollsAndQuizBottomSheet.tsx +20 -42
- package/src/components/PollsAndQuizzesCard.tsx +2 -2
- package/src/components/PollsAndQuizzesModalContent.tsx +40 -163
- package/src/components/PollsConfigAndList.tsx +107 -11
- package/src/components/PreviousPollsAndQuizzesList.tsx +33 -40
- package/src/components/QuizLeaderboardEntriesScreen.tsx +323 -0
- package/src/components/QuizLeaderboardScreen.tsx +342 -0
- package/src/components/QuizLeaderboardSummary.tsx +207 -0
- package/src/components/VoterParticipationSummary.tsx +67 -0
- package/src/redux/actionTypes.ts +35 -5
- package/src/redux/actions/index.ts +34 -6
- package/src/redux/reducers/polls.ts +84 -6
- package/src/utils/hooks.ts +190 -3
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
import type { HMSPoll } from '@100mslive/react-native-hms';
|
|
1
2
|
export declare const useRTCStatsListeners: () => void;
|
|
3
|
+
export declare const useFetchLeaderboardResponse: (pollId: HMSPoll['pollId'] | undefined) => import("@100mslive/react-native-hms").PollLeaderboardResponse | null;
|
|
4
|
+
export declare const useLeaderboardSummaryData: (pollId: HMSPoll['pollId'] | undefined) => {
|
|
5
|
+
label: string;
|
|
6
|
+
value: any;
|
|
7
|
+
}[][] | null;
|
|
2
8
|
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAO3D,eAAO,MAAM,oBAAoB,YAmFhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,WAC9B,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,yEA2CtC,CAAC;AAEF,eAAO,MAAM,yBAAyB,WAC5B,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,KACpC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,EAAE,EAAE,GAAG,IAuItC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@100mslive/react-native-room-kit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "100ms Room Kit provides simple & easy to use UI components to build Live Streaming & Video Conferencing experiences in your apps.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"registry": "https://registry.npmjs.org/"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@100mslive/types-prebuilt": "^0.12.
|
|
54
|
+
"@100mslive/types-prebuilt": "^0.12.7",
|
|
55
55
|
"@react-navigation/native": "^6.0.8",
|
|
56
56
|
"react-redux": "^7.2.4",
|
|
57
57
|
"redux": "^4.1.0"
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"typescript": "^5.0.2"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@100mslive/react-native-hms": "1.
|
|
82
|
+
"@100mslive/react-native-hms": "1.10.0",
|
|
83
83
|
"@react-native-community/blur": "^4.3.2",
|
|
84
84
|
"@react-native-masked-view/masked-view": "^0.2.9",
|
|
85
85
|
"@shopify/flash-list": "^1.4.3",
|
package/src/HMSRoomSetup.tsx
CHANGED
|
@@ -402,10 +402,28 @@ export const HMSRoomSetup = () => {
|
|
|
402
402
|
|
|
403
403
|
useEffect(() => {
|
|
404
404
|
const subscription = hmsInstance.interactivityCenter.addPollUpdateListener(
|
|
405
|
-
(poll, pollUpdateType) => {
|
|
405
|
+
async (poll, pollUpdateType) => {
|
|
406
406
|
const reduxState = reduxStore.getState();
|
|
407
407
|
const pollsData = reduxState.polls.polls;
|
|
408
408
|
|
|
409
|
+
// Send HLS Timed Metadata for poll if it is started by local peer
|
|
410
|
+
if (
|
|
411
|
+
poll.createdBy &&
|
|
412
|
+
reduxState.hmsStates.localPeer &&
|
|
413
|
+
poll.createdBy.peerID === reduxState.hmsStates.localPeer.peerID
|
|
414
|
+
) {
|
|
415
|
+
hmsInstance
|
|
416
|
+
.sendHLSTimedMetadata([
|
|
417
|
+
{ duration: 20, payload: `poll:${poll.pollId}` },
|
|
418
|
+
])
|
|
419
|
+
.then((result) => {
|
|
420
|
+
console.log('sendHLSTimedMetadata result: ', result);
|
|
421
|
+
})
|
|
422
|
+
.catch((error: any) => {
|
|
423
|
+
console.log('sendHLSTimedMetadata error: ', error);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
|
|
409
427
|
batch(() => {
|
|
410
428
|
// Update poll object in store
|
|
411
429
|
dispatch(addPoll(poll));
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,16 +2,29 @@ import React from 'react';
|
|
|
2
2
|
import { Image, StyleSheet } from 'react-native';
|
|
3
3
|
import type { ImageProps } from 'react-native';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { useHMSRoomStyle } from '../../hooks-util';
|
|
6
|
+
|
|
7
|
+
interface ClockIconProps extends Omit<ImageProps, 'source'> {
|
|
8
|
+
type?: 'vector' | 'normal';
|
|
9
|
+
}
|
|
6
10
|
|
|
7
11
|
export const ClockIcon: React.FC<ClockIconProps> = ({
|
|
8
12
|
style,
|
|
13
|
+
type = 'vector',
|
|
9
14
|
...restProps
|
|
10
15
|
}) => {
|
|
16
|
+
const iconStyles = useHMSRoomStyle((theme) => ({
|
|
17
|
+
tintColor: theme.palette.on_surface_high,
|
|
18
|
+
}));
|
|
19
|
+
|
|
11
20
|
return (
|
|
12
21
|
<Image
|
|
13
|
-
source={
|
|
14
|
-
|
|
22
|
+
source={
|
|
23
|
+
type === 'vector'
|
|
24
|
+
? require('./assets/clock-vector.png')
|
|
25
|
+
: require('./assets/clock.png')
|
|
26
|
+
}
|
|
27
|
+
style={[styles.icon, style, type === 'vector' ? undefined : iconStyles]}
|
|
15
28
|
{...restProps}
|
|
16
29
|
/>
|
|
17
30
|
);
|
|
@@ -9,7 +9,11 @@ import { HMSTextInput } from './HMSTextInput';
|
|
|
9
9
|
import { HMSPrimaryButton } from './HMSPrimaryButton';
|
|
10
10
|
import { COLORS } from '../utils/theme';
|
|
11
11
|
import type { RootState } from '../redux';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
pushToNavigationStack,
|
|
14
|
+
setPollConfig,
|
|
15
|
+
setPollName,
|
|
16
|
+
} from '../redux/actions';
|
|
13
17
|
import { CreatePollStages } from '../redux/actionTypes';
|
|
14
18
|
import type { PollConfig } from '../redux/actionTypes';
|
|
15
19
|
import { PollIcon, QuizIcon } from '../Icons';
|
|
@@ -67,7 +71,7 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
|
|
|
67
71
|
|
|
68
72
|
const addQuestions = () => {
|
|
69
73
|
if (pollName.trim().length > 0) {
|
|
70
|
-
dispatch(
|
|
74
|
+
dispatch(pushToNavigationStack(CreatePollStages.POLL_QUESTION_CONFIG));
|
|
71
75
|
}
|
|
72
76
|
};
|
|
73
77
|
|
|
@@ -230,6 +234,7 @@ const styles = StyleSheet.create({
|
|
|
230
234
|
},
|
|
231
235
|
createPollBtn: {
|
|
232
236
|
marginTop: 24,
|
|
237
|
+
marginBottom: 16,
|
|
233
238
|
},
|
|
234
239
|
contentContainer: {
|
|
235
240
|
marginHorizontal: 24,
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import type { ComponentRef } from 'react';
|
|
3
3
|
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
View,
|
|
6
|
+
Text,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
Platform,
|
|
9
|
+
useWindowDimensions,
|
|
10
|
+
} from 'react-native';
|
|
5
11
|
import {
|
|
6
12
|
HMSHLSPlayer,
|
|
7
13
|
HMSHLSPlayerPlaybackState,
|
|
8
14
|
useHMSHLSPlayerPlaybackState,
|
|
15
|
+
useHMSHLSPlayerResolution,
|
|
9
16
|
} from '@100mslive/react-native-hms';
|
|
10
17
|
|
|
11
18
|
import type { RootState } from '../redux';
|
|
@@ -18,6 +25,7 @@ import { HMSHLSNotStarted } from './HMSHLSNotStarted';
|
|
|
18
25
|
import { CrossCircleIcon } from '../Icons';
|
|
19
26
|
import { useHMSRoomStyleSheet } from '../hooks-util';
|
|
20
27
|
import { useIsHLSStreamingOn } from '../hooks-sdk';
|
|
28
|
+
import { useIsLandscapeOrientation } from '../utils/dimension';
|
|
21
29
|
|
|
22
30
|
export const _HLSView: React.FC = () => {
|
|
23
31
|
const dispatch = useDispatch();
|
|
@@ -26,6 +34,7 @@ export const _HLSView: React.FC = () => {
|
|
|
26
34
|
(state: RootState) =>
|
|
27
35
|
!!state.hmsStates.room?.hlsStreamingState.variants?.[0]?.hlsStreamUrl
|
|
28
36
|
);
|
|
37
|
+
const { width, height } = useWindowDimensions();
|
|
29
38
|
const hmsHlsPlayerRef = useRef<ComponentRef<typeof HMSHLSPlayer>>(null);
|
|
30
39
|
const showHLSStats = useSelector(
|
|
31
40
|
(state: RootState) => state.app.joinConfig.showHLSStats
|
|
@@ -99,6 +108,8 @@ export const _HLSView: React.FC = () => {
|
|
|
99
108
|
);
|
|
100
109
|
|
|
101
110
|
const hlsPlayerPlaybackState = useHMSHLSPlayerPlaybackState();
|
|
111
|
+
const resolution = useHMSHLSPlayerResolution();
|
|
112
|
+
const isLandscapeOrientation = useIsLandscapeOrientation();
|
|
102
113
|
|
|
103
114
|
const isPlaybackFailed =
|
|
104
115
|
hlsPlayerPlaybackState === HMSHLSPlayerPlaybackState.FAILED;
|
|
@@ -141,6 +152,21 @@ export const _HLSView: React.FC = () => {
|
|
|
141
152
|
ref={hmsHlsPlayerRef}
|
|
142
153
|
enableStats={showHLSStats}
|
|
143
154
|
enableControls={enableHLSPlayerControls}
|
|
155
|
+
style={
|
|
156
|
+
isLandscapeOrientation
|
|
157
|
+
? {
|
|
158
|
+
height,
|
|
159
|
+
width: resolution
|
|
160
|
+
? height * (resolution.width / resolution.height)
|
|
161
|
+
: width,
|
|
162
|
+
}
|
|
163
|
+
: {
|
|
164
|
+
width,
|
|
165
|
+
height: resolution
|
|
166
|
+
? width / (resolution.width / resolution.height)
|
|
167
|
+
: height,
|
|
168
|
+
}
|
|
169
|
+
}
|
|
144
170
|
/>
|
|
145
171
|
|
|
146
172
|
<HLSPlayerEmoticons />
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
import { HMSNotification } from './HMSNotification';
|
|
15
15
|
import { ModalTypes } from '../utils/types';
|
|
16
16
|
import {
|
|
17
|
+
pushToNavigationStack,
|
|
17
18
|
removeNotification,
|
|
18
|
-
setPollStage,
|
|
19
19
|
setSelectedPollId,
|
|
20
20
|
} from '../redux/actions';
|
|
21
21
|
import { CreatePollStages } from '../redux/actionTypes';
|
|
@@ -56,7 +56,7 @@ export const HMSPollsQuizzesNotification: React.FC<
|
|
|
56
56
|
// return;
|
|
57
57
|
// }
|
|
58
58
|
batch(() => {
|
|
59
|
-
dispatch(
|
|
59
|
+
dispatch(pushToNavigationStack(CreatePollStages.POLL_VOTING));
|
|
60
60
|
dispatch(setSelectedPollId(poll.pollId));
|
|
61
61
|
handleModalVisibleType(ModalTypes.POLLS_AND_QUIZZES);
|
|
62
62
|
dispatch(removeNotification(id));
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Text, StyleSheet, View } from 'react-native';
|
|
3
|
+
import type { ViewStyle, StyleProp } from 'react-native';
|
|
4
|
+
import type { HMSPollLeaderboardEntry } from '@100mslive/react-native-hms';
|
|
5
|
+
|
|
6
|
+
import { useHMSRoomStyleSheet } from '../hooks-util';
|
|
7
|
+
import { CheckIcon, ClockIcon } from '../Icons';
|
|
8
|
+
|
|
9
|
+
export interface LeaderboardEntryProps {
|
|
10
|
+
entry: HMSPollLeaderboardEntry;
|
|
11
|
+
totalPoints: number;
|
|
12
|
+
totalQuestions: number;
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const LeaderboardEntry: React.FC<LeaderboardEntryProps> = ({
|
|
17
|
+
entry,
|
|
18
|
+
style,
|
|
19
|
+
totalPoints,
|
|
20
|
+
totalQuestions,
|
|
21
|
+
}) => {
|
|
22
|
+
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
23
|
+
regularHighText: {
|
|
24
|
+
color: theme.palette.on_surface_high,
|
|
25
|
+
fontFamily: `${typography.font_family}-Regular`,
|
|
26
|
+
},
|
|
27
|
+
regularMediumText: {
|
|
28
|
+
color: theme.palette.on_surface_medium,
|
|
29
|
+
fontFamily: `${typography.font_family}-Regular`,
|
|
30
|
+
},
|
|
31
|
+
semiBoldHighText: {
|
|
32
|
+
color: theme.palette.on_surface_high,
|
|
33
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
34
|
+
},
|
|
35
|
+
semiBoldWhiteText: {
|
|
36
|
+
color: '#ffffff',
|
|
37
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
38
|
+
},
|
|
39
|
+
icon: {
|
|
40
|
+
tintColor: theme.palette.on_surface_medium,
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View style={[styles.container, style]}>
|
|
46
|
+
<View style={styles.namePositionWrapper}>
|
|
47
|
+
<Text
|
|
48
|
+
style={[
|
|
49
|
+
styles.smallerText,
|
|
50
|
+
hmsRoomStyles.semiBoldWhiteText,
|
|
51
|
+
styles.position,
|
|
52
|
+
entry.position === 1
|
|
53
|
+
? styles.firstPosition
|
|
54
|
+
: entry.position === 2
|
|
55
|
+
? styles.secondPosition
|
|
56
|
+
: entry.position === 3
|
|
57
|
+
? styles.thirdPosition
|
|
58
|
+
: null,
|
|
59
|
+
]}
|
|
60
|
+
>
|
|
61
|
+
{entry.position}
|
|
62
|
+
</Text>
|
|
63
|
+
|
|
64
|
+
<View style={styles.flexShrink}>
|
|
65
|
+
<Text
|
|
66
|
+
numberOfLines={2}
|
|
67
|
+
style={[styles.smallText, hmsRoomStyles.semiBoldHighText]}
|
|
68
|
+
>
|
|
69
|
+
{entry.peer?.userName}
|
|
70
|
+
</Text>
|
|
71
|
+
<Text style={[styles.smallerText, hmsRoomStyles.regularMediumText]}>
|
|
72
|
+
{entry.score}/{totalPoints} points
|
|
73
|
+
</Text>
|
|
74
|
+
</View>
|
|
75
|
+
</View>
|
|
76
|
+
|
|
77
|
+
<View style={styles.scoreDurationWrapper}>
|
|
78
|
+
{entry.position === 1 &&
|
|
79
|
+
entry.correctResponses &&
|
|
80
|
+
entry.correctResponses > 0 ? (
|
|
81
|
+
<Text
|
|
82
|
+
style={[
|
|
83
|
+
styles.normalText,
|
|
84
|
+
{ marginLeft: 12 },
|
|
85
|
+
hmsRoomStyles.semiBoldHighText,
|
|
86
|
+
]}
|
|
87
|
+
>
|
|
88
|
+
🏆
|
|
89
|
+
</Text>
|
|
90
|
+
) : null}
|
|
91
|
+
|
|
92
|
+
<View style={styles.iconWrapper}>
|
|
93
|
+
<CheckIcon
|
|
94
|
+
type="in-circle"
|
|
95
|
+
style={[styles.icon, hmsRoomStyles.icon]}
|
|
96
|
+
/>
|
|
97
|
+
<Text style={[styles.smallerText, hmsRoomStyles.regularHighText]}>
|
|
98
|
+
{entry.correctResponses}/{totalQuestions}
|
|
99
|
+
</Text>
|
|
100
|
+
</View>
|
|
101
|
+
|
|
102
|
+
{entry.duration ? (
|
|
103
|
+
<View style={styles.iconWrapper}>
|
|
104
|
+
<ClockIcon
|
|
105
|
+
type="normal"
|
|
106
|
+
style={[styles.icon, hmsRoomStyles.icon]}
|
|
107
|
+
/>
|
|
108
|
+
<Text style={[styles.smallerText, hmsRoomStyles.regularHighText]}>
|
|
109
|
+
{(entry.duration / 1000).toFixed(2)}s
|
|
110
|
+
</Text>
|
|
111
|
+
</View>
|
|
112
|
+
) : null}
|
|
113
|
+
</View>
|
|
114
|
+
</View>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const styles = StyleSheet.create({
|
|
119
|
+
container: {
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
justifyContent: 'space-between',
|
|
123
|
+
},
|
|
124
|
+
namePositionWrapper: {
|
|
125
|
+
flexDirection: 'row',
|
|
126
|
+
alignItems: 'center',
|
|
127
|
+
flexShrink: 1,
|
|
128
|
+
},
|
|
129
|
+
scoreDurationWrapper: { flexDirection: 'row', alignItems: 'center' },
|
|
130
|
+
flexShrink: {
|
|
131
|
+
flexShrink: 1,
|
|
132
|
+
},
|
|
133
|
+
smallerText: {
|
|
134
|
+
fontSize: 12,
|
|
135
|
+
lineHeight: 16,
|
|
136
|
+
},
|
|
137
|
+
smallText: {
|
|
138
|
+
fontSize: 14,
|
|
139
|
+
lineHeight: 20,
|
|
140
|
+
},
|
|
141
|
+
normalText: {
|
|
142
|
+
fontSize: 16,
|
|
143
|
+
lineHeight: 24,
|
|
144
|
+
},
|
|
145
|
+
position: {
|
|
146
|
+
width: 24,
|
|
147
|
+
height: 24,
|
|
148
|
+
borderRadius: 12,
|
|
149
|
+
textAlign: 'center',
|
|
150
|
+
textAlignVertical: 'center',
|
|
151
|
+
marginRight: 12,
|
|
152
|
+
},
|
|
153
|
+
firstPosition: {
|
|
154
|
+
backgroundColor: '#D69516', // '#FFD700'
|
|
155
|
+
},
|
|
156
|
+
secondPosition: {
|
|
157
|
+
backgroundColor: '#3E3E3E', // '#C0C0C0'
|
|
158
|
+
},
|
|
159
|
+
thirdPosition: {
|
|
160
|
+
backgroundColor: '#583B0F', // '#CD7F32'
|
|
161
|
+
},
|
|
162
|
+
iconWrapper: {
|
|
163
|
+
flexDirection: 'row',
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
marginLeft: 12,
|
|
166
|
+
},
|
|
167
|
+
icon: {
|
|
168
|
+
width: 16,
|
|
169
|
+
height: 16,
|
|
170
|
+
marginRight: 4,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import Animated, {
|
|
4
|
+
interpolate,
|
|
5
|
+
useAnimatedStyle,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
withTiming,
|
|
8
|
+
runOnJS,
|
|
9
|
+
} from 'react-native-reanimated';
|
|
10
|
+
import { useSafeAreaFrame } from 'react-native-safe-area-context';
|
|
11
|
+
|
|
12
|
+
import { useIsLandscapeOrientation } from '../utils/dimension';
|
|
13
|
+
|
|
14
|
+
export interface PollAndQuizSheetScreenProps {
|
|
15
|
+
children: React.ReactElement | null;
|
|
16
|
+
zIndex: number;
|
|
17
|
+
disableAnimation?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const PollAndQuizSheetScreen: React.FC<PollAndQuizSheetScreenProps> = ({
|
|
21
|
+
children,
|
|
22
|
+
zIndex,
|
|
23
|
+
disableAnimation,
|
|
24
|
+
}) => {
|
|
25
|
+
const isLandscapeOrientation = useIsLandscapeOrientation();
|
|
26
|
+
const { width } = useSafeAreaFrame();
|
|
27
|
+
const xPosition = useSharedValue(disableAnimation ? 0 : 1);
|
|
28
|
+
|
|
29
|
+
const animatedStyle = useAnimatedStyle(
|
|
30
|
+
() => ({
|
|
31
|
+
opacity: interpolate(xPosition.value, [0, 1], [1, 0]),
|
|
32
|
+
transform: [
|
|
33
|
+
{
|
|
34
|
+
translateX: interpolate(
|
|
35
|
+
xPosition.value,
|
|
36
|
+
[0, 1],
|
|
37
|
+
[0, isLandscapeOrientation ? width * 0.6 : width],
|
|
38
|
+
'clamp'
|
|
39
|
+
),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
[isLandscapeOrientation]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
if (disableAnimation) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
xPosition.value = withTiming(0, { duration: 150 });
|
|
51
|
+
return () => {
|
|
52
|
+
cancelAnimationFrame(xPosition.value);
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
const unmountScreenWithAnimation = React.useCallback(
|
|
57
|
+
(cb: () => void) => {
|
|
58
|
+
if (disableAnimation) {
|
|
59
|
+
cb();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
xPosition.value = withTiming(1, { duration: 150 }, () => {
|
|
63
|
+
runOnJS(cb)();
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
[disableAnimation]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Animated.View style={[styles.absolute, { zIndex }, animatedStyle]}>
|
|
71
|
+
{children
|
|
72
|
+
? React.cloneElement(children, { unmountScreenWithAnimation })
|
|
73
|
+
: null}
|
|
74
|
+
</Animated.View>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
absolute: {
|
|
80
|
+
width: '100%',
|
|
81
|
+
height: '100%',
|
|
82
|
+
position: 'absolute',
|
|
83
|
+
overflow: 'hidden',
|
|
84
|
+
},
|
|
85
|
+
});
|