@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.
Files changed (147) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/HMSRoomSetup.js +3 -5
  3. package/lib/commonjs/HMSRoomSetup.js.map +1 -1
  4. package/lib/commonjs/Icons/Check/assets/check-in-circle.png +0 -0
  5. package/lib/commonjs/Icons/Check/assets/check-in-circle@2x.png +0 -0
  6. package/lib/commonjs/Icons/Check/assets/check-in-circle@3x.png +0 -0
  7. package/lib/commonjs/Icons/Check/index.js +2 -1
  8. package/lib/commonjs/Icons/Check/index.js.map +1 -1
  9. package/lib/commonjs/Icons/CheckBox/index.js +8 -1
  10. package/lib/commonjs/Icons/CheckBox/index.js.map +1 -1
  11. package/lib/commonjs/components/CreatePoll.js +98 -52
  12. package/lib/commonjs/components/CreatePoll.js.map +1 -1
  13. package/lib/commonjs/components/GridView.js +4 -8
  14. package/lib/commonjs/components/GridView.js.map +1 -1
  15. package/lib/commonjs/components/HMSPollsQuizzesNotification.js +1 -1
  16. package/lib/commonjs/components/HMSPollsQuizzesNotification.js.map +1 -1
  17. package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js +80 -32
  18. package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js.map +1 -1
  19. package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js +53 -0
  20. package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js.map +1 -0
  21. package/lib/commonjs/components/PollAndQuizVoting.js +14 -15
  22. package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -1
  23. package/lib/commonjs/components/PollQuestion.js +70 -14
  24. package/lib/commonjs/components/PollQuestion.js.map +1 -1
  25. package/lib/commonjs/components/PollQuestions.js +22 -8
  26. package/lib/commonjs/components/PollQuestions.js.map +1 -1
  27. package/lib/commonjs/components/PollsAndQuizzesModalContent.js +1 -1
  28. package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -1
  29. package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +2 -2
  30. package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -1
  31. package/lib/commonjs/components/QuizEndOptionsView.js +63 -0
  32. package/lib/commonjs/components/QuizEndOptionsView.js.map +1 -0
  33. package/lib/commonjs/components/RadioInput.js +9 -2
  34. package/lib/commonjs/components/RadioInput.js.map +1 -1
  35. package/lib/commonjs/components/RoomSettingsModalContent.js +1 -1
  36. package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
  37. package/lib/commonjs/components/TilesContainer.js +3 -4
  38. package/lib/commonjs/components/TilesContainer.js.map +1 -1
  39. package/lib/commonjs/hooks-util.js +1 -1
  40. package/lib/commonjs/hooks-util.js.map +1 -1
  41. package/lib/commonjs/redux/actionTypes.js +2 -0
  42. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  43. package/lib/commonjs/redux/actions/index.js +14 -1
  44. package/lib/commonjs/redux/actions/index.js.map +1 -1
  45. package/lib/commonjs/redux/reducers/polls.js +30 -3
  46. package/lib/commonjs/redux/reducers/polls.js.map +1 -1
  47. package/lib/commonjs/utils/functions.js +48 -3
  48. package/lib/commonjs/utils/functions.js.map +1 -1
  49. package/lib/module/HMSRoomSetup.js +4 -6
  50. package/lib/module/HMSRoomSetup.js.map +1 -1
  51. package/lib/module/Icons/Check/assets/check-in-circle.png +0 -0
  52. package/lib/module/Icons/Check/assets/check-in-circle@2x.png +0 -0
  53. package/lib/module/Icons/Check/assets/check-in-circle@3x.png +0 -0
  54. package/lib/module/Icons/Check/index.js +2 -1
  55. package/lib/module/Icons/Check/index.js.map +1 -1
  56. package/lib/module/Icons/CheckBox/index.js +9 -2
  57. package/lib/module/Icons/CheckBox/index.js.map +1 -1
  58. package/lib/module/components/CreatePoll.js +99 -54
  59. package/lib/module/components/CreatePoll.js.map +1 -1
  60. package/lib/module/components/GridView.js +5 -9
  61. package/lib/module/components/GridView.js.map +1 -1
  62. package/lib/module/components/HMSPollsQuizzesNotification.js +1 -1
  63. package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -1
  64. package/lib/module/components/PollAndQuizQuestionResponseCard.js +81 -33
  65. package/lib/module/components/PollAndQuizQuestionResponseCard.js.map +1 -1
  66. package/lib/module/components/PollAndQuizQuestionResponseCards.js +44 -0
  67. package/lib/module/components/PollAndQuizQuestionResponseCards.js.map +1 -0
  68. package/lib/module/components/PollAndQuizVoting.js +16 -17
  69. package/lib/module/components/PollAndQuizVoting.js.map +1 -1
  70. package/lib/module/components/PollQuestion.js +73 -17
  71. package/lib/module/components/PollQuestion.js.map +1 -1
  72. package/lib/module/components/PollQuestions.js +23 -9
  73. package/lib/module/components/PollQuestions.js.map +1 -1
  74. package/lib/module/components/PollsAndQuizzesModalContent.js +1 -1
  75. package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -1
  76. package/lib/module/components/PreviousPollsAndQuizzesList.js +2 -2
  77. package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -1
  78. package/lib/module/components/QuizEndOptionsView.js +54 -0
  79. package/lib/module/components/QuizEndOptionsView.js.map +1 -0
  80. package/lib/module/components/RadioInput.js +10 -3
  81. package/lib/module/components/RadioInput.js.map +1 -1
  82. package/lib/module/components/RoomSettingsModalContent.js +1 -1
  83. package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
  84. package/lib/module/components/TilesContainer.js +5 -6
  85. package/lib/module/components/TilesContainer.js.map +1 -1
  86. package/lib/module/hooks-util.js +2 -4
  87. package/lib/module/hooks-util.js.map +1 -1
  88. package/lib/module/redux/actionTypes.js +2 -0
  89. package/lib/module/redux/actionTypes.js.map +1 -1
  90. package/lib/module/redux/actions/index.js +11 -0
  91. package/lib/module/redux/actions/index.js.map +1 -1
  92. package/lib/module/redux/reducers/polls.js +31 -4
  93. package/lib/module/redux/reducers/polls.js.map +1 -1
  94. package/lib/module/utils/functions.js +43 -3
  95. package/lib/module/utils/functions.js.map +1 -1
  96. package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
  97. package/lib/typescript/Icons/Check/index.d.ts +1 -0
  98. package/lib/typescript/Icons/Check/index.d.ts.map +1 -1
  99. package/lib/typescript/Icons/CheckBox/index.d.ts +1 -0
  100. package/lib/typescript/Icons/CheckBox/index.d.ts.map +1 -1
  101. package/lib/typescript/components/CreatePoll.d.ts.map +1 -1
  102. package/lib/typescript/components/GridView.d.ts.map +1 -1
  103. package/lib/typescript/components/PollAndQuizQuestionResponseCard.d.ts.map +1 -1
  104. package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts +9 -0
  105. package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts.map +1 -0
  106. package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -1
  107. package/lib/typescript/components/PollQuestion.d.ts +1 -0
  108. package/lib/typescript/components/PollQuestion.d.ts.map +1 -1
  109. package/lib/typescript/components/PollQuestions.d.ts.map +1 -1
  110. package/lib/typescript/components/QuizEndOptionsView.d.ts +10 -0
  111. package/lib/typescript/components/QuizEndOptionsView.d.ts.map +1 -0
  112. package/lib/typescript/components/RadioInput.d.ts +1 -0
  113. package/lib/typescript/components/RadioInput.d.ts.map +1 -1
  114. package/lib/typescript/hooks-util.d.ts.map +1 -1
  115. package/lib/typescript/redux/actionTypes.d.ts +18 -3
  116. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  117. package/lib/typescript/redux/actions/index.d.ts +3 -1
  118. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  119. package/lib/typescript/redux/reducers/polls.d.ts.map +1 -1
  120. package/lib/typescript/utils/functions.d.ts +6 -2
  121. package/lib/typescript/utils/functions.d.ts.map +1 -1
  122. package/package.json +2 -2
  123. package/src/HMSRoomSetup.tsx +7 -6
  124. package/src/Icons/Check/assets/check-in-circle.png +0 -0
  125. package/src/Icons/Check/assets/check-in-circle@2x.png +0 -0
  126. package/src/Icons/Check/assets/check-in-circle@3x.png +0 -0
  127. package/src/Icons/Check/index.tsx +9 -2
  128. package/src/Icons/CheckBox/index.tsx +16 -2
  129. package/src/components/CreatePoll.tsx +143 -70
  130. package/src/components/GridView.tsx +4 -14
  131. package/src/components/HMSPollsQuizzesNotification.tsx +1 -1
  132. package/src/components/PollAndQuizQuestionResponseCard.tsx +151 -48
  133. package/src/components/PollAndQuizQuestionResponseCards.tsx +62 -0
  134. package/src/components/PollAndQuizVoting.tsx +29 -25
  135. package/src/components/PollQuestion.tsx +140 -25
  136. package/src/components/PollQuestions.tsx +47 -29
  137. package/src/components/PollsAndQuizzesModalContent.tsx +1 -1
  138. package/src/components/PreviousPollsAndQuizzesList.tsx +2 -2
  139. package/src/components/QuizEndOptionsView.tsx +71 -0
  140. package/src/components/RadioInput.tsx +14 -2
  141. package/src/components/RoomSettingsModalContent.tsx +1 -1
  142. package/src/components/TilesContainer.tsx +4 -4
  143. package/src/hooks-util.ts +1 -3
  144. package/src/redux/actionTypes.ts +21 -1
  145. package/src/redux/actions/index.ts +22 -0
  146. package/src/redux/reducers/polls.ts +55 -5
  147. 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,EAER,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,aAAa,cACmC,CAAC;AAG9D,eAAO,MAAM,cAAc,cAAsB,CAAC;AAElD,eAAO,MAAM,WAAW,UAAW,MAAM,KAAG,MAkB3C,CAAC;AAEF,eAAO,MAAM,aAAa,cACb,MAAM,KAChB;IACD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAWnB,CAAC;AAEF,eAAO,MAAM,gCAAgC,QAAa,QAAQ,OAAO,CAkCxE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAS,MAAM,OAAO,MAAM,WAE9D,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,MAAM,WAM7C,CAAC;AAEF,eAAO,MAAM,YAAY,mBACP,aAAa,EAAE,UACvB,MAAM,KACb,aAAa,EAQf,CAAC;AAEF,eAAO,MAAM,iBAAiB,mBAC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,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,uBAsB7D;AAED,eAAO,MAAM,8BAA8B,SAAU,OAAO,KAAG,OAK9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,UACxB,OAAO,EAAE,eACH,OAAO,kBACJ,OAAO,CAAC,QAAQ,CAAC,EAAE,cAKpC,CAAC;AAEF,wBAAgB,eAAe,CAC7B,YAAY,EAAE,eAAe,EAC7B,MAAM,EAAE,qBAAqB,EAC7B,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,WAW1C;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,mBAAmB,EACjC,WAAW,EAAE,uBAAuB,EAAE,GAAG,SAAS,EAClD,MAAM,EAAE,qBAAqB,GAAG,SAAS,WAsB1C;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAAG,SAAS,WAiB1C;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,mBAAmB,GACxB,MAAM,CAWR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@100mslive/react-native-room-kit",
3
- "version": "1.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.11",
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",
@@ -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
- if (poll.type !== HMSPollType.poll) {
408
- return;
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 (pollUpdateType === HMSPollUpdateType.started) {
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}`,
@@ -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={require('./assets/check.png')}
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
- return (
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={'My Poll'}
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
- ].map((item) => {
84
- return (
85
- <View key={item.id} style={{ marginTop: 4, flexDirection: 'row' }}>
86
- <Text
87
- style={[
88
- styles.pollNameLabel,
89
- hmsRoomStyles.typeSelectionLabel,
90
- { flexGrow: 1 },
91
- ]}
92
- >
93
- {item.label}
94
- </Text>
95
-
96
- <Switch
97
- value={item.enabled}
98
- thumbColor={COLORS.WHITE}
99
- trackColor={{
100
- true: COLORS.PRIMARY.DEFAULT,
101
- false: COLORS.SECONDARY.DISABLED,
102
- }}
103
- onValueChange={(value) => handleConfigChange(item.id, value)}
104
- />
105
- </View>
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="Create Poll"
194
+ title={`Create ${pollConfig.type === HMSPollType.quiz ? 'Quiz' : 'Poll'}`}
112
195
  onPress={addQuestions}
113
196
  loading={false}
114
- style={{ marginTop: 24 }}
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 } = useWindowDimensions();
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 = width + left + right;
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>