@100mslive/react-native-room-kit 1.1.1 → 1.1.2
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 +1 -1
- package/lib/commonjs/HMSRoomSetup.js +3 -5
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/Check/assets/check-in-circle.png +0 -0
- package/lib/commonjs/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/lib/commonjs/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/lib/commonjs/Icons/Check/index.js +2 -1
- package/lib/commonjs/Icons/Check/index.js.map +1 -1
- package/lib/commonjs/Icons/CheckBox/index.js +8 -1
- package/lib/commonjs/Icons/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CreatePoll.js +98 -52
- package/lib/commonjs/components/CreatePoll.js.map +1 -1
- package/lib/commonjs/components/GridView.js +4 -8
- package/lib/commonjs/components/GridView.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/PollAndQuizQuestionResponseCard.js +80 -32
- package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js.map +1 -1
- package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js +53 -0
- package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js.map +1 -0
- package/lib/commonjs/components/PollAndQuizVoting.js +14 -15
- package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -1
- package/lib/commonjs/components/PollQuestion.js +70 -14
- package/lib/commonjs/components/PollQuestion.js.map +1 -1
- package/lib/commonjs/components/PollQuestions.js +22 -8
- package/lib/commonjs/components/PollQuestions.js.map +1 -1
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js +1 -1
- package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -1
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +2 -2
- package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -1
- package/lib/commonjs/components/QuizEndOptionsView.js +63 -0
- package/lib/commonjs/components/QuizEndOptionsView.js.map +1 -0
- package/lib/commonjs/components/RadioInput.js +9 -2
- package/lib/commonjs/components/RadioInput.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/TilesContainer.js +3 -4
- package/lib/commonjs/components/TilesContainer.js.map +1 -1
- package/lib/commonjs/hooks-util.js +1 -1
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/redux/actionTypes.js +2 -0
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +14 -1
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/polls.js +30 -3
- package/lib/commonjs/redux/reducers/polls.js.map +1 -1
- package/lib/commonjs/utils/functions.js +48 -3
- package/lib/commonjs/utils/functions.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +4 -6
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/Check/assets/check-in-circle.png +0 -0
- package/lib/module/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/lib/module/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/lib/module/Icons/Check/index.js +2 -1
- package/lib/module/Icons/Check/index.js.map +1 -1
- package/lib/module/Icons/CheckBox/index.js +9 -2
- package/lib/module/Icons/CheckBox/index.js.map +1 -1
- package/lib/module/components/CreatePoll.js +99 -54
- package/lib/module/components/CreatePoll.js.map +1 -1
- package/lib/module/components/GridView.js +5 -9
- package/lib/module/components/GridView.js.map +1 -1
- package/lib/module/components/HMSPollsQuizzesNotification.js +1 -1
- package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -1
- package/lib/module/components/PollAndQuizQuestionResponseCard.js +81 -33
- package/lib/module/components/PollAndQuizQuestionResponseCard.js.map +1 -1
- package/lib/module/components/PollAndQuizQuestionResponseCards.js +44 -0
- package/lib/module/components/PollAndQuizQuestionResponseCards.js.map +1 -0
- package/lib/module/components/PollAndQuizVoting.js +16 -17
- package/lib/module/components/PollAndQuizVoting.js.map +1 -1
- package/lib/module/components/PollQuestion.js +73 -17
- package/lib/module/components/PollQuestion.js.map +1 -1
- package/lib/module/components/PollQuestions.js +23 -9
- package/lib/module/components/PollQuestions.js.map +1 -1
- package/lib/module/components/PollsAndQuizzesModalContent.js +1 -1
- package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -1
- package/lib/module/components/PreviousPollsAndQuizzesList.js +2 -2
- package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -1
- package/lib/module/components/QuizEndOptionsView.js +54 -0
- package/lib/module/components/QuizEndOptionsView.js.map +1 -0
- package/lib/module/components/RadioInput.js +10 -3
- package/lib/module/components/RadioInput.js.map +1 -1
- package/lib/module/components/RoomSettingsModalContent.js +1 -1
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/TilesContainer.js +5 -6
- package/lib/module/components/TilesContainer.js.map +1 -1
- package/lib/module/hooks-util.js +2 -4
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/redux/actionTypes.js +2 -0
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +11 -0
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/polls.js +31 -4
- package/lib/module/redux/reducers/polls.js.map +1 -1
- package/lib/module/utils/functions.js +43 -3
- package/lib/module/utils/functions.js.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/Check/index.d.ts +1 -0
- package/lib/typescript/Icons/Check/index.d.ts.map +1 -1
- package/lib/typescript/Icons/CheckBox/index.d.ts +1 -0
- package/lib/typescript/Icons/CheckBox/index.d.ts.map +1 -1
- package/lib/typescript/components/CreatePoll.d.ts.map +1 -1
- package/lib/typescript/components/GridView.d.ts.map +1 -1
- package/lib/typescript/components/PollAndQuizQuestionResponseCard.d.ts.map +1 -1
- package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts +9 -0
- package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts.map +1 -0
- package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -1
- package/lib/typescript/components/PollQuestion.d.ts +1 -0
- package/lib/typescript/components/PollQuestion.d.ts.map +1 -1
- package/lib/typescript/components/PollQuestions.d.ts.map +1 -1
- package/lib/typescript/components/QuizEndOptionsView.d.ts +10 -0
- package/lib/typescript/components/QuizEndOptionsView.d.ts.map +1 -0
- package/lib/typescript/components/RadioInput.d.ts +1 -0
- package/lib/typescript/components/RadioInput.d.ts.map +1 -1
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/redux/actionTypes.d.ts +18 -3
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +3 -1
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/polls.d.ts.map +1 -1
- package/lib/typescript/utils/functions.d.ts +6 -2
- package/lib/typescript/utils/functions.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/HMSRoomSetup.tsx +7 -6
- package/src/Icons/Check/assets/check-in-circle.png +0 -0
- package/src/Icons/Check/assets/check-in-circle@2x.png +0 -0
- package/src/Icons/Check/assets/check-in-circle@3x.png +0 -0
- package/src/Icons/Check/index.tsx +9 -2
- package/src/Icons/CheckBox/index.tsx +16 -2
- package/src/components/CreatePoll.tsx +143 -70
- package/src/components/GridView.tsx +4 -14
- package/src/components/HMSPollsQuizzesNotification.tsx +1 -1
- package/src/components/PollAndQuizQuestionResponseCard.tsx +151 -48
- package/src/components/PollAndQuizQuestionResponseCards.tsx +62 -0
- package/src/components/PollAndQuizVoting.tsx +29 -25
- package/src/components/PollQuestion.tsx +140 -25
- package/src/components/PollQuestions.tsx +47 -29
- package/src/components/PollsAndQuizzesModalContent.tsx +1 -1
- package/src/components/PreviousPollsAndQuizzesList.tsx +2 -2
- package/src/components/QuizEndOptionsView.tsx +71 -0
- package/src/components/RadioInput.tsx +14 -2
- package/src/components/RoomSettingsModalContent.tsx +1 -1
- package/src/components/TilesContainer.tsx +4 -4
- package/src/hooks-util.ts +1 -3
- package/src/redux/actionTypes.ts +21 -1
- package/src/redux/actions/index.ts +22 -0
- package/src/redux/reducers/polls.ts +55 -5
- package/src/utils/functions.ts +90 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HMSPeer, HMSTrack, HMSVideoTrack, HMSRole } from '@100mslive/react-native-hms';
|
|
2
|
-
import type { HMSPoll } from '@100mslive/react-native-hms';
|
|
1
|
+
import { HMSPeer, HMSTrack, HMSVideoTrack, HMSRole, HMSPollQuestionType } from '@100mslive/react-native-hms';
|
|
2
|
+
import type { HMSPoll, HMSPollQuestionAnswer, HMSPollQuestionResponse, HMSPollQuestion, HMSPollQuestionOption } from '@100mslive/react-native-hms';
|
|
3
3
|
import type { PeerTrackNode } from './types';
|
|
4
4
|
export declare const getMeetingUrl: () => string;
|
|
5
5
|
export declare const getMeetingCode: () => string;
|
|
@@ -58,4 +58,8 @@ export declare function groupIntoPairs(totalNumber: number): number[][];
|
|
|
58
58
|
export declare function groupIntoTriplets<T>(list: T[], fill?: boolean): (T | undefined)[][];
|
|
59
59
|
export declare const isParticipantHostOrBroadcaster: (role: HMSRole) => boolean;
|
|
60
60
|
export declare const visiblePollsSelector: (polls: HMSPoll[], isHLSViewer: boolean, hlsCuedPollIds: HMSPoll['pollId'][]) => HMSPoll[];
|
|
61
|
+
export declare function checkIsSelected(pollQuestion: HMSPollQuestion, option: HMSPollQuestionOption, selectedOptions: number | number[] | null): boolean;
|
|
62
|
+
export declare function checkIsCorrectAnswer(questionType: HMSPollQuestionType, myResponses: HMSPollQuestionResponse[] | undefined, answer: HMSPollQuestionAnswer | undefined): boolean;
|
|
63
|
+
export declare function checkIsCorrectOption(questionType: HMSPollQuestionType, option: HMSPollQuestionOption, answer: HMSPollQuestionAnswer | undefined): boolean;
|
|
64
|
+
export declare function getLabelFromPollQuestionType(type: HMSPollQuestionType): string;
|
|
61
65
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/utils/functions.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,OAAO,EACP,QAAQ,EAGR,aAAa,EACb,OAAO,
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/utils/functions.ts"],"names":[],"mappings":"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"}
|
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.2",
|
|
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",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"typescript": "^5.0.2"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@100mslive/react-native-hms": "1.9.
|
|
82
|
+
"@100mslive/react-native-hms": "1.9.12",
|
|
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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HMSException,
|
|
3
|
-
HMSPollType,
|
|
4
3
|
HMSPollUpdateType,
|
|
5
4
|
HMSRoom,
|
|
6
5
|
HMSTrack,
|
|
@@ -404,15 +403,18 @@ export const HMSRoomSetup = () => {
|
|
|
404
403
|
useEffect(() => {
|
|
405
404
|
const subscription = hmsInstance.interactivityCenter.addPollUpdateListener(
|
|
406
405
|
(poll, pollUpdateType) => {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
const reduxState = reduxStore.getState();
|
|
407
|
+
const pollsData = reduxState.polls.polls;
|
|
408
|
+
|
|
410
409
|
batch(() => {
|
|
411
410
|
// Update poll object in store
|
|
412
411
|
dispatch(addPoll(poll));
|
|
413
412
|
|
|
414
413
|
// when poll is started, show notification to user
|
|
415
|
-
if (
|
|
414
|
+
if (
|
|
415
|
+
pollUpdateType === HMSPollUpdateType.started &&
|
|
416
|
+
!pollsData[poll.pollId]
|
|
417
|
+
) {
|
|
416
418
|
// if user is a viewer
|
|
417
419
|
if (isHLSViewer) {
|
|
418
420
|
// Show notification only if poll is started 20 or more seconds ago
|
|
@@ -432,7 +434,6 @@ export const HMSRoomSetup = () => {
|
|
|
432
434
|
}
|
|
433
435
|
// if user is not a viewer, show notification
|
|
434
436
|
else {
|
|
435
|
-
// TODO: Dont show notification if already voted
|
|
436
437
|
dispatch(
|
|
437
438
|
addNotification({
|
|
438
439
|
id: `${poll.pollId}--${pollUpdateType}`,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,9 +4,12 @@ import type { ImageProps } from 'react-native';
|
|
|
4
4
|
|
|
5
5
|
import { useHMSRoomStyle } from '../../hooks-util';
|
|
6
6
|
|
|
7
|
-
interface CheckIconProps extends Omit<ImageProps, 'source'> {
|
|
7
|
+
interface CheckIconProps extends Omit<ImageProps, 'source'> {
|
|
8
|
+
type?: 'normal' | 'in-circle';
|
|
9
|
+
}
|
|
8
10
|
|
|
9
11
|
export const CheckIcon: React.FC<CheckIconProps> = ({
|
|
12
|
+
type = 'normal',
|
|
10
13
|
style,
|
|
11
14
|
...restProps
|
|
12
15
|
}) => {
|
|
@@ -16,7 +19,11 @@ export const CheckIcon: React.FC<CheckIconProps> = ({
|
|
|
16
19
|
|
|
17
20
|
return (
|
|
18
21
|
<Image
|
|
19
|
-
source={
|
|
22
|
+
source={
|
|
23
|
+
type === 'in-circle'
|
|
24
|
+
? require('./assets/check-in-circle.png')
|
|
25
|
+
: require('./assets/check.png')
|
|
26
|
+
}
|
|
20
27
|
style={[styles.icon, iconStyles, style]}
|
|
21
28
|
{...restProps}
|
|
22
29
|
/>
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Image, StyleSheet } from 'react-native';
|
|
2
|
+
import { Image, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
3
|
import type { ImageProps } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { useHMSRoomStyle } from '../../hooks-util';
|
|
6
6
|
|
|
7
7
|
interface CheckBoxIconProps extends Omit<ImageProps, 'source'> {
|
|
8
8
|
type?: 'checked' | 'unchecked';
|
|
9
|
+
onChange?: (type: 'checked' | 'unchecked') => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const CheckBoxIcon: React.FC<CheckBoxIconProps> = ({
|
|
12
13
|
style,
|
|
13
14
|
type = 'unchecked',
|
|
15
|
+
onChange,
|
|
14
16
|
...restProps
|
|
15
17
|
}) => {
|
|
16
18
|
const iconStyles = useHMSRoomStyle((theme) => ({
|
|
17
19
|
tintColor: theme.palette.on_surface_high,
|
|
18
20
|
}));
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
const checkbox = (
|
|
21
23
|
<Image
|
|
22
24
|
source={
|
|
23
25
|
type === 'unchecked'
|
|
@@ -28,6 +30,18 @@ export const CheckBoxIcon: React.FC<CheckBoxIconProps> = ({
|
|
|
28
30
|
{...restProps}
|
|
29
31
|
/>
|
|
30
32
|
);
|
|
33
|
+
|
|
34
|
+
if (typeof onChange !== 'function') {
|
|
35
|
+
return checkbox;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<TouchableOpacity
|
|
40
|
+
onPress={() => onChange(type === 'unchecked' ? 'checked' : 'unchecked')}
|
|
41
|
+
>
|
|
42
|
+
{checkbox}
|
|
43
|
+
</TouchableOpacity>
|
|
44
|
+
);
|
|
31
45
|
};
|
|
32
46
|
|
|
33
47
|
const styles = StyleSheet.create({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { View, Text, StyleSheet, Switch } from 'react-native';
|
|
2
|
+
import { View, Text, StyleSheet, Switch, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
+
import { HMSPollType } from '@100mslive/react-native-hms';
|
|
4
5
|
|
|
5
6
|
import { useHMSRoomStyleSheet } from '../hooks-util';
|
|
6
7
|
import { BottomSheet } from './BottomSheet';
|
|
@@ -11,6 +12,7 @@ import type { RootState } from '../redux';
|
|
|
11
12
|
import { setPollConfig, setPollName, setPollStage } from '../redux/actions';
|
|
12
13
|
import { CreatePollStages } from '../redux/actionTypes';
|
|
13
14
|
import type { PollConfig } from '../redux/actionTypes';
|
|
15
|
+
import { PollIcon, QuizIcon } from '../Icons';
|
|
14
16
|
|
|
15
17
|
export interface CreatePollProps {}
|
|
16
18
|
|
|
@@ -31,10 +33,17 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
|
|
|
31
33
|
typeLabelContainer: {
|
|
32
34
|
borderColor: theme.palette.border_bright,
|
|
33
35
|
},
|
|
36
|
+
activeTypeLabelContainer: {
|
|
37
|
+
borderColor: theme.palette.primary_default,
|
|
38
|
+
},
|
|
34
39
|
typeLabelIconContainer: {
|
|
35
40
|
borderColor: theme.palette.border_bright,
|
|
36
41
|
backgroundColor: theme.palette.surface_bright,
|
|
37
42
|
},
|
|
43
|
+
activeTypeLabelIconContainer: {
|
|
44
|
+
borderColor: theme.palette.primary_default,
|
|
45
|
+
backgroundColor: theme.palette.surface_bright,
|
|
46
|
+
},
|
|
38
47
|
pollNameLabel: {
|
|
39
48
|
color: theme.palette.on_surface_high,
|
|
40
49
|
fontFamily: `${typography.font_family}-Regular`,
|
|
@@ -52,6 +61,10 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
|
|
|
52
61
|
dispatch(setPollConfig({ [configKey]: configValue }));
|
|
53
62
|
};
|
|
54
63
|
|
|
64
|
+
const handlePollTypeChange = (configValue: PollConfig['type']) => {
|
|
65
|
+
dispatch(setPollConfig({ type: configValue }));
|
|
66
|
+
};
|
|
67
|
+
|
|
55
68
|
const addQuestions = () => {
|
|
56
69
|
if (pollName.trim().length > 0) {
|
|
57
70
|
dispatch(setPollStage(CreatePollStages.POLL_QUESTION_CONFIG));
|
|
@@ -60,8 +73,69 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
|
|
|
60
73
|
|
|
61
74
|
return (
|
|
62
75
|
<View style={styles.contentContainer}>
|
|
76
|
+
<Text
|
|
77
|
+
style={[styles.typeSelectionLabel, hmsRoomStyles.typeSelectionLabel]}
|
|
78
|
+
>
|
|
79
|
+
Select the type you want to continue with
|
|
80
|
+
</Text>
|
|
81
|
+
|
|
82
|
+
<View style={styles.typeContainer}>
|
|
83
|
+
{[
|
|
84
|
+
{
|
|
85
|
+
id: 'poll',
|
|
86
|
+
label: 'Poll',
|
|
87
|
+
icon: <PollIcon />,
|
|
88
|
+
pressHandler: () => handlePollTypeChange(HMSPollType.poll),
|
|
89
|
+
active: pollConfig.type === HMSPollType.poll,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'quiz',
|
|
93
|
+
label: 'Quiz',
|
|
94
|
+
icon: <QuizIcon />,
|
|
95
|
+
pressHandler: () => handlePollTypeChange(HMSPollType.quiz),
|
|
96
|
+
active: pollConfig.type === HMSPollType.quiz,
|
|
97
|
+
},
|
|
98
|
+
].map((item, idx) => {
|
|
99
|
+
const isFirst = idx === 0;
|
|
100
|
+
const isActive = item.active;
|
|
101
|
+
return (
|
|
102
|
+
<React.Fragment key={item.id}>
|
|
103
|
+
{isFirst ? null : <View style={{ width: 16 }} />}
|
|
104
|
+
|
|
105
|
+
<View style={{ flexGrow: 1 }}>
|
|
106
|
+
<TouchableOpacity
|
|
107
|
+
activeOpacity={0.7}
|
|
108
|
+
disabled={isActive}
|
|
109
|
+
onPress={item.pressHandler}
|
|
110
|
+
style={[
|
|
111
|
+
styles.typeLabelContainer,
|
|
112
|
+
isActive
|
|
113
|
+
? hmsRoomStyles.activeTypeLabelContainer
|
|
114
|
+
: hmsRoomStyles.typeLabelContainer,
|
|
115
|
+
]}
|
|
116
|
+
>
|
|
117
|
+
<View
|
|
118
|
+
style={[
|
|
119
|
+
styles.typeLabelIconContainer,
|
|
120
|
+
isActive
|
|
121
|
+
? hmsRoomStyles.activeTypeLabelIconContainer
|
|
122
|
+
: hmsRoomStyles.typeLabelIconContainer,
|
|
123
|
+
]}
|
|
124
|
+
>
|
|
125
|
+
{item.icon}
|
|
126
|
+
</View>
|
|
127
|
+
<Text style={[styles.typeLabel, hmsRoomStyles.typeLabel]}>
|
|
128
|
+
{item.label}
|
|
129
|
+
</Text>
|
|
130
|
+
</TouchableOpacity>
|
|
131
|
+
</View>
|
|
132
|
+
</React.Fragment>
|
|
133
|
+
);
|
|
134
|
+
})}
|
|
135
|
+
</View>
|
|
136
|
+
|
|
63
137
|
<Text style={[styles.pollNameLabel, hmsRoomStyles.pollNameLabel]}>
|
|
64
|
-
Poll Name
|
|
138
|
+
{pollConfig.type === HMSPollType.quiz ? 'Quiz' : 'Poll'} Name
|
|
65
139
|
</Text>
|
|
66
140
|
|
|
67
141
|
<HMSTextInput
|
|
@@ -69,7 +143,7 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
|
|
|
69
143
|
value={pollName}
|
|
70
144
|
autoFocus={false}
|
|
71
145
|
onChangeText={handlePollNameChange}
|
|
72
|
-
placeholder={
|
|
146
|
+
placeholder={`My ${pollConfig.type === HMSPollType.quiz ? 'Quiz' : 'Poll'}`}
|
|
73
147
|
/>
|
|
74
148
|
|
|
75
149
|
<BottomSheet.Divider style={{ marginVertical: 24 }} />
|
|
@@ -79,85 +153,84 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
|
|
|
79
153
|
id: 'voteCountHidden' as const,
|
|
80
154
|
label: 'Hide vote count',
|
|
81
155
|
enabled: pollConfig.voteCountHidden,
|
|
156
|
+
visible: pollConfig.type === HMSPollType.poll,
|
|
82
157
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
158
|
+
// {
|
|
159
|
+
// id: 'resultsAnonymous' as const,
|
|
160
|
+
// label: 'Make results anonymous',
|
|
161
|
+
// enabled: pollConfig.resultsAnonymous,
|
|
162
|
+
// visible: true
|
|
163
|
+
// },
|
|
164
|
+
]
|
|
165
|
+
.filter((item) => item.visible)
|
|
166
|
+
.map((item) => {
|
|
167
|
+
return (
|
|
168
|
+
<View key={item.id} style={styles.switchWrapper}>
|
|
169
|
+
<Text
|
|
170
|
+
style={[
|
|
171
|
+
styles.pollNameLabel,
|
|
172
|
+
hmsRoomStyles.typeSelectionLabel,
|
|
173
|
+
{ flexGrow: 1 },
|
|
174
|
+
]}
|
|
175
|
+
>
|
|
176
|
+
{item.label}
|
|
177
|
+
</Text>
|
|
178
|
+
|
|
179
|
+
<Switch
|
|
180
|
+
value={item.enabled}
|
|
181
|
+
thumbColor={COLORS.WHITE}
|
|
182
|
+
trackColor={{
|
|
183
|
+
true: COLORS.PRIMARY.DEFAULT,
|
|
184
|
+
false: COLORS.SECONDARY.DISABLED,
|
|
185
|
+
}}
|
|
186
|
+
onValueChange={(value) => handleConfigChange(item.id, value)}
|
|
187
|
+
/>
|
|
188
|
+
</View>
|
|
189
|
+
);
|
|
190
|
+
})}
|
|
108
191
|
|
|
109
192
|
<HMSPrimaryButton
|
|
110
193
|
disabled={!pollName.trim()}
|
|
111
|
-
title=
|
|
194
|
+
title={`Create ${pollConfig.type === HMSPollType.quiz ? 'Quiz' : 'Poll'}`}
|
|
112
195
|
onPress={addQuestions}
|
|
113
196
|
loading={false}
|
|
114
|
-
style={
|
|
197
|
+
style={styles.createPollBtn}
|
|
115
198
|
/>
|
|
116
199
|
</View>
|
|
117
200
|
);
|
|
118
201
|
};
|
|
119
202
|
|
|
120
|
-
// {/* <Text style={[styles.typeSelectionLabel, hmsRoomStyles.typeSelectionLabel]}>
|
|
121
|
-
// Select the type you want to continue with
|
|
122
|
-
// </Text>
|
|
123
|
-
// <View style={{ flexDirection: 'row', marginTop: 8, marginBottom: 24, }}>
|
|
124
|
-
// {[
|
|
125
|
-
// {
|
|
126
|
-
// id: 'poll',
|
|
127
|
-
// label: 'Poll',
|
|
128
|
-
// icon: <PollIcon />,
|
|
129
|
-
// pressHandler: undefined,
|
|
130
|
-
// active: true,
|
|
131
|
-
// },
|
|
132
|
-
// {
|
|
133
|
-
// id: 'quiz',
|
|
134
|
-
// label: 'Quiz',
|
|
135
|
-
// icon: <QuizIcon />,
|
|
136
|
-
// pressHandler: undefined,
|
|
137
|
-
// active: false,
|
|
138
|
-
// },
|
|
139
|
-
// ].map((item, idx) => {
|
|
140
|
-
// const isFirst = idx === 0;
|
|
141
|
-
// const isActive = item.active;
|
|
142
|
-
// return (
|
|
143
|
-
// <React.Fragment key={item.id}>
|
|
144
|
-
// {isFirst ? null : <View style={{ width: 16 }} />}
|
|
145
|
-
|
|
146
|
-
// <View style={{ flexGrow: 1 }}>
|
|
147
|
-
// <TouchableOpacity
|
|
148
|
-
// onPress={item.pressHandler}
|
|
149
|
-
// style={[{ flexDirection: 'row', padding: 8, borderRadius: 8, borderWidth: 1, alignItems: 'center', }, hmsRoomStyles.typeLabelContainer]}
|
|
150
|
-
// >
|
|
151
|
-
// <View style={[{ padding: 8, borderRadius: 4, borderWidth: 1, marginRight: 16 }, hmsRoomStyles.typeLabelIconContainer]}>{item.icon}</View>
|
|
152
|
-
// <Text style={[{ fontSize: 16, lineHeight: 24, letterSpacing: 0.15 }, hmsRoomStyles.typeLabel]}>{item.label}</Text>
|
|
153
|
-
// </TouchableOpacity>
|
|
154
|
-
// </View>
|
|
155
|
-
// </React.Fragment>
|
|
156
|
-
// )
|
|
157
|
-
// })}
|
|
158
|
-
// </View> */}
|
|
159
|
-
|
|
160
203
|
const styles = StyleSheet.create({
|
|
204
|
+
typeContainer: {
|
|
205
|
+
flexDirection: 'row',
|
|
206
|
+
marginTop: 8,
|
|
207
|
+
marginBottom: 24,
|
|
208
|
+
},
|
|
209
|
+
typeLabelContainer: {
|
|
210
|
+
flexDirection: 'row',
|
|
211
|
+
padding: 8,
|
|
212
|
+
borderRadius: 8,
|
|
213
|
+
borderWidth: 1,
|
|
214
|
+
alignItems: 'center',
|
|
215
|
+
},
|
|
216
|
+
typeLabelIconContainer: {
|
|
217
|
+
padding: 8,
|
|
218
|
+
borderRadius: 4,
|
|
219
|
+
borderWidth: 1,
|
|
220
|
+
marginRight: 16,
|
|
221
|
+
},
|
|
222
|
+
typeLabel: {
|
|
223
|
+
fontSize: 16,
|
|
224
|
+
lineHeight: 24,
|
|
225
|
+
letterSpacing: 0.15,
|
|
226
|
+
},
|
|
227
|
+
switchWrapper: {
|
|
228
|
+
marginTop: 4,
|
|
229
|
+
flexDirection: 'row',
|
|
230
|
+
},
|
|
231
|
+
createPollBtn: {
|
|
232
|
+
marginTop: 24,
|
|
233
|
+
},
|
|
161
234
|
contentContainer: {
|
|
162
235
|
marginHorizontal: 24,
|
|
163
236
|
},
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import React, { useRef, useState, useImperativeHandle } from 'react';
|
|
2
2
|
import type { ElementRef } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
View,
|
|
5
|
-
FlatList,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
useWindowDimensions,
|
|
8
|
-
Platform,
|
|
9
|
-
} from 'react-native';
|
|
3
|
+
import { View, FlatList, StyleSheet, Platform } from 'react-native';
|
|
10
4
|
import { useDispatch, useSelector } from 'react-redux';
|
|
11
5
|
import type { LayoutChangeEvent, ViewToken } from 'react-native';
|
|
12
6
|
import type { HMSView, HMSPeer } from '@100mslive/react-native-hms';
|
|
7
|
+
import { useSafeAreaFrame } from 'react-native-safe-area-context';
|
|
13
8
|
|
|
14
9
|
import { DefaultModal } from './DefaultModal';
|
|
15
10
|
import { SaveScreenshot } from './Modals';
|
|
@@ -21,10 +16,6 @@ import { PaginationDots } from './PaginationDots';
|
|
|
21
16
|
import { setGridViewActivePage } from '../redux/actions';
|
|
22
17
|
import { Tile } from './Tile';
|
|
23
18
|
import { useIsLandscapeOrientation } from '../utils/dimension';
|
|
24
|
-
import {
|
|
25
|
-
useSafeAreaFrame,
|
|
26
|
-
useSafeAreaInsets,
|
|
27
|
-
} from 'react-native-safe-area-context';
|
|
28
19
|
|
|
29
20
|
export type GridViewProps = {
|
|
30
21
|
onPeerTileMorePress(peerTrackNode: PeerTrackNode): void;
|
|
@@ -303,8 +294,7 @@ const ScreenshareTiles = React.forwardRef<
|
|
|
303
294
|
FlatList<PeerTrackNode>,
|
|
304
295
|
ScreenshareTilesProps
|
|
305
296
|
>(({ onPeerTileMorePress, setHmsViewRefs }, flatlistRef) => {
|
|
306
|
-
const { width } =
|
|
307
|
-
const { left, right } = useSafeAreaInsets();
|
|
297
|
+
const { width: safeWidth } = useSafeAreaFrame();
|
|
308
298
|
const isLandscapeOrientation = useIsLandscapeOrientation();
|
|
309
299
|
const [activePage, setActivePage] = useState(0);
|
|
310
300
|
const screensharePeerTrackNodes = useSelector(
|
|
@@ -326,7 +316,7 @@ const ScreenshareTiles = React.forwardRef<
|
|
|
326
316
|
},
|
|
327
317
|
[]
|
|
328
318
|
);
|
|
329
|
-
const tileWidth =
|
|
319
|
+
const tileWidth = safeWidth;
|
|
330
320
|
|
|
331
321
|
const _renderItem = React.useCallback(
|
|
332
322
|
({ item }) => {
|
|
@@ -85,7 +85,7 @@ export const HMSPollsQuizzesNotification: React.FC<
|
|
|
85
85
|
onPress={handleVotePress}
|
|
86
86
|
>
|
|
87
87
|
<Text style={[styles.buttonText, hmsRoomStyles.buttonText]}>
|
|
88
|
-
Vote
|
|
88
|
+
{poll.type === HMSPollType.quiz ? 'Answer' : 'Vote'}
|
|
89
89
|
</Text>
|
|
90
90
|
</TouchableHighlight>
|
|
91
91
|
</GestureDetector>
|