@100mslive/react-native-room-kit 1.1.1 → 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.
Files changed (255) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/HMSRoomSetup.js +15 -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/Icons/Clock/assets/clock-vector.png +0 -0
  12. package/lib/commonjs/Icons/Clock/assets/clock-vector@2x.png +0 -0
  13. package/lib/commonjs/Icons/Clock/assets/clock-vector@3x.png +0 -0
  14. package/lib/commonjs/Icons/Clock/assets/clock.png +0 -0
  15. package/lib/commonjs/Icons/Clock/assets/clock@2x.png +0 -0
  16. package/lib/commonjs/Icons/Clock/assets/clock@3x.png +0 -0
  17. package/lib/commonjs/Icons/Clock/index.js +7 -2
  18. package/lib/commonjs/Icons/Clock/index.js.map +1 -1
  19. package/lib/commonjs/components/CreatePoll.js +100 -53
  20. package/lib/commonjs/components/CreatePoll.js.map +1 -1
  21. package/lib/commonjs/components/GridView.js +4 -8
  22. package/lib/commonjs/components/GridView.js.map +1 -1
  23. package/lib/commonjs/components/HLSView.js +15 -1
  24. package/lib/commonjs/components/HLSView.js.map +1 -1
  25. package/lib/commonjs/components/HMSPollsQuizzesNotification.js +2 -2
  26. package/lib/commonjs/components/HMSPollsQuizzesNotification.js.map +1 -1
  27. package/lib/commonjs/components/LeaderboardEntry.js +135 -0
  28. package/lib/commonjs/components/LeaderboardEntry.js.map +1 -0
  29. package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js +80 -32
  30. package/lib/commonjs/components/PollAndQuizQuestionResponseCard.js.map +1 -1
  31. package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js +53 -0
  32. package/lib/commonjs/components/PollAndQuizQuestionResponseCards.js.map +1 -0
  33. package/lib/commonjs/components/PollAndQuizSheetScreen.js +69 -0
  34. package/lib/commonjs/components/PollAndQuizSheetScreen.js.map +1 -0
  35. package/lib/commonjs/components/PollAndQuizVoting.js +145 -17
  36. package/lib/commonjs/components/PollAndQuizVoting.js.map +1 -1
  37. package/lib/commonjs/components/PollQuestion.js +70 -14
  38. package/lib/commonjs/components/PollQuestion.js.map +1 -1
  39. package/lib/commonjs/components/PollQuestions.js +126 -12
  40. package/lib/commonjs/components/PollQuestions.js.map +1 -1
  41. package/lib/commonjs/components/PollsAndQuizBottomSheet.js +9 -11
  42. package/lib/commonjs/components/PollsAndQuizBottomSheet.js.map +1 -1
  43. package/lib/commonjs/components/PollsAndQuizzesCard.js +1 -1
  44. package/lib/commonjs/components/PollsAndQuizzesCard.js.map +1 -1
  45. package/lib/commonjs/components/PollsAndQuizzesModalContent.js +26 -120
  46. package/lib/commonjs/components/PollsAndQuizzesModalContent.js.map +1 -1
  47. package/lib/commonjs/components/PollsConfigAndList.js +81 -4
  48. package/lib/commonjs/components/PollsConfigAndList.js.map +1 -1
  49. package/lib/commonjs/components/PreviousPollsAndQuizzesList.js +7 -15
  50. package/lib/commonjs/components/PreviousPollsAndQuizzesList.js.map +1 -1
  51. package/lib/commonjs/components/QuizEndOptionsView.js +63 -0
  52. package/lib/commonjs/components/QuizEndOptionsView.js.map +1 -0
  53. package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js +284 -0
  54. package/lib/commonjs/components/QuizLeaderboardEntriesScreen.js.map +1 -0
  55. package/lib/commonjs/components/QuizLeaderboardScreen.js +279 -0
  56. package/lib/commonjs/components/QuizLeaderboardScreen.js.map +1 -0
  57. package/lib/commonjs/components/QuizLeaderboardSummary.js +195 -0
  58. package/lib/commonjs/components/QuizLeaderboardSummary.js.map +1 -0
  59. package/lib/commonjs/components/RadioInput.js +9 -2
  60. package/lib/commonjs/components/RadioInput.js.map +1 -1
  61. package/lib/commonjs/components/RoomSettingsModalContent.js +1 -1
  62. package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
  63. package/lib/commonjs/components/TilesContainer.js +3 -4
  64. package/lib/commonjs/components/TilesContainer.js.map +1 -1
  65. package/lib/commonjs/components/VoterParticipationSummary.js +46 -0
  66. package/lib/commonjs/components/VoterParticipationSummary.js.map +1 -0
  67. package/lib/commonjs/hooks-util.js +1 -1
  68. package/lib/commonjs/hooks-util.js.map +1 -1
  69. package/lib/commonjs/redux/actionTypes.js +9 -1
  70. package/lib/commonjs/redux/actionTypes.js.map +1 -1
  71. package/lib/commonjs/redux/actions/index.js +38 -5
  72. package/lib/commonjs/redux/actions/index.js.map +1 -1
  73. package/lib/commonjs/redux/reducers/polls.js +95 -8
  74. package/lib/commonjs/redux/reducers/polls.js.map +1 -1
  75. package/lib/commonjs/utils/functions.js +48 -3
  76. package/lib/commonjs/utils/functions.js.map +1 -1
  77. package/lib/commonjs/utils/hooks.js +107 -2
  78. package/lib/commonjs/utils/hooks.js.map +1 -1
  79. package/lib/module/HMSRoomSetup.js +16 -6
  80. package/lib/module/HMSRoomSetup.js.map +1 -1
  81. package/lib/module/Icons/Check/assets/check-in-circle.png +0 -0
  82. package/lib/module/Icons/Check/assets/check-in-circle@2x.png +0 -0
  83. package/lib/module/Icons/Check/assets/check-in-circle@3x.png +0 -0
  84. package/lib/module/Icons/Check/index.js +2 -1
  85. package/lib/module/Icons/Check/index.js.map +1 -1
  86. package/lib/module/Icons/CheckBox/index.js +9 -2
  87. package/lib/module/Icons/CheckBox/index.js.map +1 -1
  88. package/lib/module/Icons/Clock/assets/clock-vector.png +0 -0
  89. package/lib/module/Icons/Clock/assets/clock-vector@2x.png +0 -0
  90. package/lib/module/Icons/Clock/assets/clock-vector@3x.png +0 -0
  91. package/lib/module/Icons/Clock/assets/clock.png +0 -0
  92. package/lib/module/Icons/Clock/assets/clock@2x.png +0 -0
  93. package/lib/module/Icons/Clock/assets/clock@3x.png +0 -0
  94. package/lib/module/Icons/Clock/index.js +7 -2
  95. package/lib/module/Icons/Clock/index.js.map +1 -1
  96. package/lib/module/components/CreatePoll.js +102 -56
  97. package/lib/module/components/CreatePoll.js.map +1 -1
  98. package/lib/module/components/GridView.js +5 -9
  99. package/lib/module/components/GridView.js.map +1 -1
  100. package/lib/module/components/HLSView.js +17 -3
  101. package/lib/module/components/HLSView.js.map +1 -1
  102. package/lib/module/components/HMSPollsQuizzesNotification.js +3 -3
  103. package/lib/module/components/HMSPollsQuizzesNotification.js.map +1 -1
  104. package/lib/module/components/LeaderboardEntry.js +126 -0
  105. package/lib/module/components/LeaderboardEntry.js.map +1 -0
  106. package/lib/module/components/PollAndQuizQuestionResponseCard.js +81 -33
  107. package/lib/module/components/PollAndQuizQuestionResponseCard.js.map +1 -1
  108. package/lib/module/components/PollAndQuizQuestionResponseCards.js +44 -0
  109. package/lib/module/components/PollAndQuizQuestionResponseCards.js.map +1 -0
  110. package/lib/module/components/PollAndQuizSheetScreen.js +60 -0
  111. package/lib/module/components/PollAndQuizSheetScreen.js.map +1 -0
  112. package/lib/module/components/PollAndQuizVoting.js +148 -20
  113. package/lib/module/components/PollAndQuizVoting.js.map +1 -1
  114. package/lib/module/components/PollQuestion.js +73 -17
  115. package/lib/module/components/PollQuestion.js.map +1 -1
  116. package/lib/module/components/PollQuestions.js +129 -15
  117. package/lib/module/components/PollQuestions.js.map +1 -1
  118. package/lib/module/components/PollsAndQuizBottomSheet.js +11 -13
  119. package/lib/module/components/PollsAndQuizBottomSheet.js.map +1 -1
  120. package/lib/module/components/PollsAndQuizzesCard.js +2 -2
  121. package/lib/module/components/PollsAndQuizzesCard.js.map +1 -1
  122. package/lib/module/components/PollsAndQuizzesModalContent.js +28 -122
  123. package/lib/module/components/PollsAndQuizzesModalContent.js.map +1 -1
  124. package/lib/module/components/PollsConfigAndList.js +82 -5
  125. package/lib/module/components/PollsConfigAndList.js.map +1 -1
  126. package/lib/module/components/PreviousPollsAndQuizzesList.js +7 -15
  127. package/lib/module/components/PreviousPollsAndQuizzesList.js.map +1 -1
  128. package/lib/module/components/QuizEndOptionsView.js +54 -0
  129. package/lib/module/components/QuizEndOptionsView.js.map +1 -0
  130. package/lib/module/components/QuizLeaderboardEntriesScreen.js +275 -0
  131. package/lib/module/components/QuizLeaderboardEntriesScreen.js.map +1 -0
  132. package/lib/module/components/QuizLeaderboardScreen.js +270 -0
  133. package/lib/module/components/QuizLeaderboardScreen.js.map +1 -0
  134. package/lib/module/components/QuizLeaderboardSummary.js +186 -0
  135. package/lib/module/components/QuizLeaderboardSummary.js.map +1 -0
  136. package/lib/module/components/RadioInput.js +10 -3
  137. package/lib/module/components/RadioInput.js.map +1 -1
  138. package/lib/module/components/RoomSettingsModalContent.js +1 -1
  139. package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
  140. package/lib/module/components/TilesContainer.js +5 -6
  141. package/lib/module/components/TilesContainer.js.map +1 -1
  142. package/lib/module/components/VoterParticipationSummary.js +37 -0
  143. package/lib/module/components/VoterParticipationSummary.js.map +1 -0
  144. package/lib/module/hooks-util.js +2 -4
  145. package/lib/module/hooks-util.js.map +1 -1
  146. package/lib/module/redux/actionTypes.js +9 -1
  147. package/lib/module/redux/actionTypes.js.map +1 -1
  148. package/lib/module/redux/actions/index.js +29 -3
  149. package/lib/module/redux/actions/index.js.map +1 -1
  150. package/lib/module/redux/reducers/polls.js +96 -9
  151. package/lib/module/redux/reducers/polls.js.map +1 -1
  152. package/lib/module/utils/functions.js +43 -3
  153. package/lib/module/utils/functions.js.map +1 -1
  154. package/lib/module/utils/hooks.js +105 -2
  155. package/lib/module/utils/hooks.js.map +1 -1
  156. package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
  157. package/lib/typescript/Icons/Check/index.d.ts +1 -0
  158. package/lib/typescript/Icons/Check/index.d.ts.map +1 -1
  159. package/lib/typescript/Icons/CheckBox/index.d.ts +1 -0
  160. package/lib/typescript/Icons/CheckBox/index.d.ts.map +1 -1
  161. package/lib/typescript/Icons/Clock/index.d.ts +1 -0
  162. package/lib/typescript/Icons/Clock/index.d.ts.map +1 -1
  163. package/lib/typescript/components/CreatePoll.d.ts.map +1 -1
  164. package/lib/typescript/components/GridView.d.ts.map +1 -1
  165. package/lib/typescript/components/HLSView.d.ts.map +1 -1
  166. package/lib/typescript/components/LeaderboardEntry.d.ts +11 -0
  167. package/lib/typescript/components/LeaderboardEntry.d.ts.map +1 -0
  168. package/lib/typescript/components/PollAndQuizQuestionResponseCard.d.ts.map +1 -1
  169. package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts +9 -0
  170. package/lib/typescript/components/PollAndQuizQuestionResponseCards.d.ts.map +1 -0
  171. package/lib/typescript/components/PollAndQuizSheetScreen.d.ts +8 -0
  172. package/lib/typescript/components/PollAndQuizSheetScreen.d.ts.map +1 -0
  173. package/lib/typescript/components/PollAndQuizVoting.d.ts +2 -0
  174. package/lib/typescript/components/PollAndQuizVoting.d.ts.map +1 -1
  175. package/lib/typescript/components/PollQuestion.d.ts +1 -0
  176. package/lib/typescript/components/PollQuestion.d.ts.map +1 -1
  177. package/lib/typescript/components/PollQuestions.d.ts +2 -0
  178. package/lib/typescript/components/PollQuestions.d.ts.map +1 -1
  179. package/lib/typescript/components/PollsAndQuizBottomSheet.d.ts.map +1 -1
  180. package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts +0 -1
  181. package/lib/typescript/components/PollsAndQuizzesModalContent.d.ts.map +1 -1
  182. package/lib/typescript/components/PollsConfigAndList.d.ts +1 -0
  183. package/lib/typescript/components/PollsConfigAndList.d.ts.map +1 -1
  184. package/lib/typescript/components/PreviousPollsAndQuizzesList.d.ts.map +1 -1
  185. package/lib/typescript/components/QuizEndOptionsView.d.ts +10 -0
  186. package/lib/typescript/components/QuizEndOptionsView.d.ts.map +1 -0
  187. package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts +8 -0
  188. package/lib/typescript/components/QuizLeaderboardEntriesScreen.d.ts.map +1 -0
  189. package/lib/typescript/components/QuizLeaderboardScreen.d.ts +8 -0
  190. package/lib/typescript/components/QuizLeaderboardScreen.d.ts.map +1 -0
  191. package/lib/typescript/components/QuizLeaderboardSummary.d.ts +9 -0
  192. package/lib/typescript/components/QuizLeaderboardSummary.d.ts.map +1 -0
  193. package/lib/typescript/components/RadioInput.d.ts +1 -0
  194. package/lib/typescript/components/RadioInput.d.ts.map +1 -1
  195. package/lib/typescript/components/VoterParticipationSummary.d.ts +7 -0
  196. package/lib/typescript/components/VoterParticipationSummary.d.ts.map +1 -0
  197. package/lib/typescript/hooks-util.d.ts.map +1 -1
  198. package/lib/typescript/redux/actionTypes.d.ts +45 -9
  199. package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
  200. package/lib/typescript/redux/actions/index.d.ts +8 -2
  201. package/lib/typescript/redux/actions/index.d.ts.map +1 -1
  202. package/lib/typescript/redux/index.d.ts +2 -1
  203. package/lib/typescript/redux/index.d.ts.map +1 -1
  204. package/lib/typescript/redux/reducers/index.d.ts +2 -1
  205. package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
  206. package/lib/typescript/redux/reducers/polls.d.ts +3 -2
  207. package/lib/typescript/redux/reducers/polls.d.ts.map +1 -1
  208. package/lib/typescript/utils/functions.d.ts +6 -2
  209. package/lib/typescript/utils/functions.d.ts.map +1 -1
  210. package/lib/typescript/utils/hooks.d.ts +6 -0
  211. package/lib/typescript/utils/hooks.d.ts.map +1 -1
  212. package/package.json +3 -3
  213. package/src/HMSRoomSetup.tsx +25 -6
  214. package/src/Icons/Check/assets/check-in-circle.png +0 -0
  215. package/src/Icons/Check/assets/check-in-circle@2x.png +0 -0
  216. package/src/Icons/Check/assets/check-in-circle@3x.png +0 -0
  217. package/src/Icons/Check/index.tsx +9 -2
  218. package/src/Icons/CheckBox/index.tsx +16 -2
  219. package/src/Icons/Clock/assets/clock-vector.png +0 -0
  220. package/src/Icons/Clock/assets/clock-vector@2x.png +0 -0
  221. package/src/Icons/Clock/assets/clock-vector@3x.png +0 -0
  222. package/src/Icons/Clock/assets/clock.png +0 -0
  223. package/src/Icons/Clock/assets/clock@2x.png +0 -0
  224. package/src/Icons/Clock/assets/clock@3x.png +0 -0
  225. package/src/Icons/Clock/index.tsx +16 -3
  226. package/src/components/CreatePoll.tsx +150 -72
  227. package/src/components/GridView.tsx +4 -14
  228. package/src/components/HLSView.tsx +27 -1
  229. package/src/components/HMSPollsQuizzesNotification.tsx +3 -3
  230. package/src/components/LeaderboardEntry.tsx +172 -0
  231. package/src/components/PollAndQuizQuestionResponseCard.tsx +151 -48
  232. package/src/components/PollAndQuizQuestionResponseCards.tsx +62 -0
  233. package/src/components/PollAndQuizSheetScreen.tsx +85 -0
  234. package/src/components/PollAndQuizVoting.tsx +206 -28
  235. package/src/components/PollQuestion.tsx +140 -25
  236. package/src/components/PollQuestions.tsx +214 -74
  237. package/src/components/PollsAndQuizBottomSheet.tsx +20 -42
  238. package/src/components/PollsAndQuizzesCard.tsx +2 -2
  239. package/src/components/PollsAndQuizzesModalContent.tsx +40 -163
  240. package/src/components/PollsConfigAndList.tsx +107 -11
  241. package/src/components/PreviousPollsAndQuizzesList.tsx +33 -40
  242. package/src/components/QuizEndOptionsView.tsx +71 -0
  243. package/src/components/QuizLeaderboardEntriesScreen.tsx +323 -0
  244. package/src/components/QuizLeaderboardScreen.tsx +342 -0
  245. package/src/components/QuizLeaderboardSummary.tsx +207 -0
  246. package/src/components/RadioInput.tsx +14 -2
  247. package/src/components/RoomSettingsModalContent.tsx +1 -1
  248. package/src/components/TilesContainer.tsx +4 -4
  249. package/src/components/VoterParticipationSummary.tsx +67 -0
  250. package/src/hooks-util.ts +1 -3
  251. package/src/redux/actionTypes.ts +56 -6
  252. package/src/redux/actions/index.ts +56 -6
  253. package/src/redux/reducers/polls.ts +139 -11
  254. package/src/utils/functions.ts +90 -6
  255. package/src/utils/hooks.ts +190 -3
@@ -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';
@@ -8,9 +9,14 @@ import { HMSTextInput } from './HMSTextInput';
8
9
  import { HMSPrimaryButton } from './HMSPrimaryButton';
9
10
  import { COLORS } from '../utils/theme';
10
11
  import type { RootState } from '../redux';
11
- import { setPollConfig, setPollName, setPollStage } from '../redux/actions';
12
+ import {
13
+ pushToNavigationStack,
14
+ setPollConfig,
15
+ setPollName,
16
+ } from '../redux/actions';
12
17
  import { CreatePollStages } from '../redux/actionTypes';
13
18
  import type { PollConfig } from '../redux/actionTypes';
19
+ import { PollIcon, QuizIcon } from '../Icons';
14
20
 
15
21
  export interface CreatePollProps {}
16
22
 
@@ -31,10 +37,17 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
31
37
  typeLabelContainer: {
32
38
  borderColor: theme.palette.border_bright,
33
39
  },
40
+ activeTypeLabelContainer: {
41
+ borderColor: theme.palette.primary_default,
42
+ },
34
43
  typeLabelIconContainer: {
35
44
  borderColor: theme.palette.border_bright,
36
45
  backgroundColor: theme.palette.surface_bright,
37
46
  },
47
+ activeTypeLabelIconContainer: {
48
+ borderColor: theme.palette.primary_default,
49
+ backgroundColor: theme.palette.surface_bright,
50
+ },
38
51
  pollNameLabel: {
39
52
  color: theme.palette.on_surface_high,
40
53
  fontFamily: `${typography.font_family}-Regular`,
@@ -52,16 +65,81 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
52
65
  dispatch(setPollConfig({ [configKey]: configValue }));
53
66
  };
54
67
 
68
+ const handlePollTypeChange = (configValue: PollConfig['type']) => {
69
+ dispatch(setPollConfig({ type: configValue }));
70
+ };
71
+
55
72
  const addQuestions = () => {
56
73
  if (pollName.trim().length > 0) {
57
- dispatch(setPollStage(CreatePollStages.POLL_QUESTION_CONFIG));
74
+ dispatch(pushToNavigationStack(CreatePollStages.POLL_QUESTION_CONFIG));
58
75
  }
59
76
  };
60
77
 
61
78
  return (
62
79
  <View style={styles.contentContainer}>
80
+ <Text
81
+ style={[styles.typeSelectionLabel, hmsRoomStyles.typeSelectionLabel]}
82
+ >
83
+ Select the type you want to continue with
84
+ </Text>
85
+
86
+ <View style={styles.typeContainer}>
87
+ {[
88
+ {
89
+ id: 'poll',
90
+ label: 'Poll',
91
+ icon: <PollIcon />,
92
+ pressHandler: () => handlePollTypeChange(HMSPollType.poll),
93
+ active: pollConfig.type === HMSPollType.poll,
94
+ },
95
+ {
96
+ id: 'quiz',
97
+ label: 'Quiz',
98
+ icon: <QuizIcon />,
99
+ pressHandler: () => handlePollTypeChange(HMSPollType.quiz),
100
+ active: pollConfig.type === HMSPollType.quiz,
101
+ },
102
+ ].map((item, idx) => {
103
+ const isFirst = idx === 0;
104
+ const isActive = item.active;
105
+ return (
106
+ <React.Fragment key={item.id}>
107
+ {isFirst ? null : <View style={{ width: 16 }} />}
108
+
109
+ <View style={{ flexGrow: 1 }}>
110
+ <TouchableOpacity
111
+ activeOpacity={0.7}
112
+ disabled={isActive}
113
+ onPress={item.pressHandler}
114
+ style={[
115
+ styles.typeLabelContainer,
116
+ isActive
117
+ ? hmsRoomStyles.activeTypeLabelContainer
118
+ : hmsRoomStyles.typeLabelContainer,
119
+ ]}
120
+ >
121
+ <View
122
+ style={[
123
+ styles.typeLabelIconContainer,
124
+ isActive
125
+ ? hmsRoomStyles.activeTypeLabelIconContainer
126
+ : hmsRoomStyles.typeLabelIconContainer,
127
+ ]}
128
+ >
129
+ {item.icon}
130
+ </View>
131
+ <Text style={[styles.typeLabel, hmsRoomStyles.typeLabel]}>
132
+ {item.label}
133
+ </Text>
134
+ </TouchableOpacity>
135
+ </View>
136
+ </React.Fragment>
137
+ );
138
+ })}
139
+ </View>
140
+
63
141
  <Text style={[styles.pollNameLabel, hmsRoomStyles.pollNameLabel]}>
64
- Poll Name
142
+ {pollConfig.type === HMSPollType.quiz ? 'Quiz' : 'Poll'} Name
65
143
  </Text>
66
144
 
67
145
  <HMSTextInput
@@ -69,7 +147,7 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
69
147
  value={pollName}
70
148
  autoFocus={false}
71
149
  onChangeText={handlePollNameChange}
72
- placeholder={'My Poll'}
150
+ placeholder={`My ${pollConfig.type === HMSPollType.quiz ? 'Quiz' : 'Poll'}`}
73
151
  />
74
152
 
75
153
  <BottomSheet.Divider style={{ marginVertical: 24 }} />
@@ -79,85 +157,85 @@ export const CreatePoll: React.FC<CreatePollProps> = ({}) => {
79
157
  id: 'voteCountHidden' as const,
80
158
  label: 'Hide vote count',
81
159
  enabled: pollConfig.voteCountHidden,
160
+ visible: pollConfig.type === HMSPollType.poll,
82
161
  },
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
- })}
162
+ // {
163
+ // id: 'resultsAnonymous' as const,
164
+ // label: 'Make results anonymous',
165
+ // enabled: pollConfig.resultsAnonymous,
166
+ // visible: true
167
+ // },
168
+ ]
169
+ .filter((item) => item.visible)
170
+ .map((item) => {
171
+ return (
172
+ <View key={item.id} style={styles.switchWrapper}>
173
+ <Text
174
+ style={[
175
+ styles.pollNameLabel,
176
+ hmsRoomStyles.typeSelectionLabel,
177
+ { flexGrow: 1 },
178
+ ]}
179
+ >
180
+ {item.label}
181
+ </Text>
182
+
183
+ <Switch
184
+ value={item.enabled}
185
+ thumbColor={COLORS.WHITE}
186
+ trackColor={{
187
+ true: COLORS.PRIMARY.DEFAULT,
188
+ false: COLORS.SECONDARY.DISABLED,
189
+ }}
190
+ onValueChange={(value) => handleConfigChange(item.id, value)}
191
+ />
192
+ </View>
193
+ );
194
+ })}
108
195
 
109
196
  <HMSPrimaryButton
110
197
  disabled={!pollName.trim()}
111
- title="Create Poll"
198
+ title={`Create ${pollConfig.type === HMSPollType.quiz ? 'Quiz' : 'Poll'}`}
112
199
  onPress={addQuestions}
113
200
  loading={false}
114
- style={{ marginTop: 24 }}
201
+ style={styles.createPollBtn}
115
202
  />
116
203
  </View>
117
204
  );
118
205
  };
119
206
 
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
207
  const styles = StyleSheet.create({
208
+ typeContainer: {
209
+ flexDirection: 'row',
210
+ marginTop: 8,
211
+ marginBottom: 24,
212
+ },
213
+ typeLabelContainer: {
214
+ flexDirection: 'row',
215
+ padding: 8,
216
+ borderRadius: 8,
217
+ borderWidth: 1,
218
+ alignItems: 'center',
219
+ },
220
+ typeLabelIconContainer: {
221
+ padding: 8,
222
+ borderRadius: 4,
223
+ borderWidth: 1,
224
+ marginRight: 16,
225
+ },
226
+ typeLabel: {
227
+ fontSize: 16,
228
+ lineHeight: 24,
229
+ letterSpacing: 0.15,
230
+ },
231
+ switchWrapper: {
232
+ marginTop: 4,
233
+ flexDirection: 'row',
234
+ },
235
+ createPollBtn: {
236
+ marginTop: 24,
237
+ marginBottom: 16,
238
+ },
161
239
  contentContainer: {
162
240
  marginHorizontal: 24,
163
241
  },
@@ -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 }) => {
@@ -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 { View, Text, StyleSheet, Platform } from 'react-native';
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(setPollStage(CreatePollStages.POLL_VOTING));
59
+ dispatch(pushToNavigationStack(CreatePollStages.POLL_VOTING));
60
60
  dispatch(setSelectedPollId(poll.pollId));
61
61
  handleModalVisibleType(ModalTypes.POLLS_AND_QUIZZES);
62
62
  dispatch(removeNotification(id));
@@ -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>
@@ -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
+ });