@stream-io/video-react-native-sdk 0.1.5 → 0.1.6

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 (77) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/commonjs/components/Call/CallContent/CallContent.js +2 -2
  3. package/dist/commonjs/components/Call/CallContent/CallContent.js.map +1 -1
  4. package/dist/commonjs/components/Call/CallControls/CallControls.js +2 -2
  5. package/dist/commonjs/components/Call/CallControls/CallControls.js.map +1 -1
  6. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js +2 -2
  7. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  8. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js +2 -2
  9. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  10. package/dist/commonjs/components/Call/Lobby/Lobby.js +22 -6
  11. package/dist/commonjs/components/Call/Lobby/Lobby.js.map +1 -1
  12. package/dist/commonjs/components/Call/RingingCallContent/IncomingCall.js +23 -11
  13. package/dist/commonjs/components/Call/RingingCallContent/IncomingCall.js.map +1 -1
  14. package/dist/commonjs/components/Call/RingingCallContent/OutgoingCall.js +21 -8
  15. package/dist/commonjs/components/Call/RingingCallContent/OutgoingCall.js.map +1 -1
  16. package/dist/commonjs/components/Call/RingingCallContent/RingingCallContent.js +5 -3
  17. package/dist/commonjs/components/Call/RingingCallContent/RingingCallContent.js.map +1 -1
  18. package/dist/commonjs/components/Call/RingingCallContent/UserInfo.js +1 -1
  19. package/dist/commonjs/components/Participant/FloatingParticipantView/FloatingView/ReanimatedFloatingView.js +11 -10
  20. package/dist/commonjs/components/Participant/FloatingParticipantView/FloatingView/ReanimatedFloatingView.js.map +1 -1
  21. package/dist/commonjs/constants/index.js +1 -1
  22. package/dist/commonjs/theme/theme.js +10 -4
  23. package/dist/commonjs/theme/theme.js.map +1 -1
  24. package/dist/commonjs/version.js +1 -1
  25. package/dist/module/components/Call/CallContent/CallContent.js +2 -2
  26. package/dist/module/components/Call/CallContent/CallContent.js.map +1 -1
  27. package/dist/module/components/Call/CallControls/CallControls.js +2 -2
  28. package/dist/module/components/Call/CallControls/CallControls.js.map +1 -1
  29. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js +2 -2
  30. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  31. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js +2 -2
  32. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  33. package/dist/module/components/Call/Lobby/Lobby.js +22 -6
  34. package/dist/module/components/Call/Lobby/Lobby.js.map +1 -1
  35. package/dist/module/components/Call/RingingCallContent/IncomingCall.js +23 -11
  36. package/dist/module/components/Call/RingingCallContent/IncomingCall.js.map +1 -1
  37. package/dist/module/components/Call/RingingCallContent/OutgoingCall.js +21 -8
  38. package/dist/module/components/Call/RingingCallContent/OutgoingCall.js.map +1 -1
  39. package/dist/module/components/Call/RingingCallContent/RingingCallContent.js +5 -3
  40. package/dist/module/components/Call/RingingCallContent/RingingCallContent.js.map +1 -1
  41. package/dist/module/components/Call/RingingCallContent/UserInfo.js +1 -1
  42. package/dist/module/components/Participant/FloatingParticipantView/FloatingView/ReanimatedFloatingView.js +12 -11
  43. package/dist/module/components/Participant/FloatingParticipantView/FloatingView/ReanimatedFloatingView.js.map +1 -1
  44. package/dist/module/constants/index.js +1 -1
  45. package/dist/module/theme/theme.js +10 -4
  46. package/dist/module/theme/theme.js.map +1 -1
  47. package/dist/module/version.js +1 -1
  48. package/dist/typescript/components/Call/Lobby/Lobby.d.ts +6 -1
  49. package/dist/typescript/components/Call/Lobby/Lobby.d.ts.map +1 -1
  50. package/dist/typescript/components/Call/RingingCallContent/IncomingCall.d.ts +15 -6
  51. package/dist/typescript/components/Call/RingingCallContent/IncomingCall.d.ts.map +1 -1
  52. package/dist/typescript/components/Call/RingingCallContent/OutgoingCall.d.ts +6 -1
  53. package/dist/typescript/components/Call/RingingCallContent/OutgoingCall.d.ts.map +1 -1
  54. package/dist/typescript/components/Call/RingingCallContent/RingingCallContent.d.ts.map +1 -1
  55. package/dist/typescript/components/Participant/FloatingParticipantView/FloatingView/ReanimatedFloatingView.d.ts.map +1 -1
  56. package/dist/typescript/constants/index.d.ts +1 -1
  57. package/dist/typescript/theme/theme.d.ts +6 -0
  58. package/dist/typescript/theme/theme.d.ts.map +1 -1
  59. package/dist/typescript/version.d.ts +1 -1
  60. package/expo-config-plugin/dist/common/addNewLinesToAppDelegate.d.ts +1 -0
  61. package/expo-config-plugin/dist/common/addNewLinesToAppDelegate.js +17 -0
  62. package/expo-config-plugin/dist/common/types.d.ts +8 -0
  63. package/expo-config-plugin/dist/common/types.js +2 -0
  64. package/package.json +5 -5
  65. package/src/components/Call/CallContent/CallContent.tsx +2 -2
  66. package/src/components/Call/CallControls/CallControls.tsx +2 -2
  67. package/src/components/Call/CallLayout/CallParticipantsGrid.tsx +2 -2
  68. package/src/components/Call/CallLayout/CallParticipantsSpotlight.tsx +2 -2
  69. package/src/components/Call/Lobby/Lobby.tsx +32 -11
  70. package/src/components/Call/RingingCallContent/IncomingCall.tsx +54 -32
  71. package/src/components/Call/RingingCallContent/OutgoingCall.tsx +40 -24
  72. package/src/components/Call/RingingCallContent/RingingCallContent.tsx +7 -3
  73. package/src/components/Call/RingingCallContent/UserInfo.tsx +1 -1
  74. package/src/components/Participant/FloatingParticipantView/FloatingView/ReanimatedFloatingView.tsx +43 -51
  75. package/src/constants/index.ts +1 -1
  76. package/src/theme/theme.ts +16 -4
  77. package/src/version.ts +1 -1
@@ -174,12 +174,12 @@ export const CallContent = ({
174
174
  supportedReactions,
175
175
  };
176
176
 
177
- const landScapeStyles: ViewStyle = {
177
+ const landscapeStyles: ViewStyle = {
178
178
  flexDirection: landscape ? 'row' : 'column',
179
179
  };
180
180
 
181
181
  return (
182
- <View style={[styles.container, callContent.container, landScapeStyles]}>
182
+ <View style={[styles.container, callContent.container, landscapeStyles]}>
183
183
  <View style={[styles.container, callContent.callParticipantsContainer]}>
184
184
  <View
185
185
  style={[styles.view, callContent.topContainer]}
@@ -31,7 +31,7 @@ export const CallControls = ({
31
31
  const {
32
32
  theme: { colors, callControls },
33
33
  } = useTheme();
34
- const landScapeStyles: ViewStyle = {
34
+ const landscapeStyles: ViewStyle = {
35
35
  flexDirection: landscape ? 'column-reverse' : 'row',
36
36
  paddingHorizontal: landscape ? 12 : 0,
37
37
  paddingVertical: landscape ? 0 : 12,
@@ -42,7 +42,7 @@ export const CallControls = ({
42
42
  styles.container,
43
43
  { backgroundColor: colors.static_grey },
44
44
  callControls.container,
45
- landScapeStyles,
45
+ landscapeStyles,
46
46
  style,
47
47
  ]}
48
48
  >
@@ -54,7 +54,7 @@ export const CallParticipantsGrid = ({
54
54
  // we debounce the participants arrays to avoid unnecessary rerenders that happen when participant tracks are all subscribed simultaneously
55
55
  const remoteParticipants = useDebouncedValue(_remoteParticipants, 300);
56
56
  const allParticipants = useDebouncedValue(_allParticipants, 300);
57
- const landScapeStyles: ViewStyle = {
57
+ const landscapeStyles: ViewStyle = {
58
58
  flexDirection: landscape ? 'row' : 'column',
59
59
  };
60
60
 
@@ -80,7 +80,7 @@ export const CallParticipantsGrid = ({
80
80
  <View
81
81
  style={[
82
82
  styles.container,
83
- landScapeStyles,
83
+ landscapeStyles,
84
84
  { backgroundColor: colors.dark_gray },
85
85
  callParticipantsGrid.container,
86
86
  ]}
@@ -75,7 +75,7 @@ export const CallParticipantsSpotlight = ({
75
75
  ParticipantView,
76
76
  };
77
77
 
78
- const landScapeStyles: ViewStyle = {
78
+ const landscapeStyles: ViewStyle = {
79
79
  flexDirection: landscape ? 'row' : 'column',
80
80
  };
81
81
 
@@ -88,7 +88,7 @@ export const CallParticipantsSpotlight = ({
88
88
  testID={ComponentTestIds.CALL_PARTICIPANTS_SPOTLIGHT}
89
89
  style={[
90
90
  styles.container,
91
- landScapeStyles,
91
+ landscapeStyles,
92
92
  {
93
93
  backgroundColor: colors.dark_gray,
94
94
  },
@@ -1,5 +1,5 @@
1
1
  import React, { ComponentType } from 'react';
2
- import { StyleSheet, Text, View } from 'react-native';
2
+ import { StyleSheet, Text, View, ViewStyle } from 'react-native';
3
3
  import { MicOff } from '../../../icons';
4
4
  import {
5
5
  useCall,
@@ -40,6 +40,11 @@ export type LobbyProps = {
40
40
  * Component to customize the Join Call Button in the Lobby component.
41
41
  */
42
42
  JoinCallButton?: ComponentType<JoinCallButtonProps> | null;
43
+ /**
44
+ * Check if device is in landscape mode.
45
+ * This will apply the landscape mode styles to the component.
46
+ */
47
+ landscape?: boolean;
43
48
  /**
44
49
  * Component to customize the Lobby Footer in the Lobby component.
45
50
  */
@@ -53,6 +58,7 @@ export const Lobby = ({
53
58
  onJoinCallHandler,
54
59
  LobbyControls = DefaultLobbyControls,
55
60
  JoinCallButton = DefaultJoinCallButton,
61
+ landscape = false,
56
62
  LobbyFooter = DefaultLobbyFooter,
57
63
  }: LobbyProps) => {
58
64
  const {
@@ -75,16 +81,21 @@ export const Lobby = ({
75
81
  name: connectedUser?.name,
76
82
  } as StreamVideoParticipant;
77
83
 
84
+ const landscapeStyles: ViewStyle = {
85
+ flexDirection: landscape ? 'row' : 'column',
86
+ };
87
+
78
88
  return (
79
89
  <View
80
90
  style={[
81
91
  styles.container,
92
+ landscapeStyles,
82
93
  { backgroundColor: colors.static_grey },
83
94
  lobby.container,
84
95
  ]}
85
96
  >
86
97
  {connectedUser && (
87
- <>
98
+ <View style={[styles.topContainer, lobby.topContainer]}>
88
99
  <Text
89
100
  style={[
90
101
  styles.heading,
@@ -126,15 +137,17 @@ export const Lobby = ({
126
137
  )}
127
138
  <ParticipantStatus />
128
139
  </View>
129
- {LobbyControls && <LobbyControls />}
130
- </>
131
- )}
132
- {LobbyFooter && (
133
- <LobbyFooter
134
- JoinCallButton={JoinCallButton}
135
- onJoinCallHandler={onJoinCallHandler}
136
- />
140
+ </View>
137
141
  )}
142
+ <View style={[styles.bottomContainer, lobby.bottomContainer]}>
143
+ {LobbyControls && <LobbyControls />}
144
+ {LobbyFooter && (
145
+ <LobbyFooter
146
+ JoinCallButton={JoinCallButton}
147
+ onJoinCallHandler={onJoinCallHandler}
148
+ />
149
+ )}
150
+ </View>
138
151
  </View>
139
152
  );
140
153
  };
@@ -195,13 +208,16 @@ const styles = StyleSheet.create({
195
208
  container: {
196
209
  flex: 1,
197
210
  justifyContent: 'center',
211
+ },
212
+ topContainer: {
213
+ flex: 2,
214
+ justifyContent: 'space-evenly',
198
215
  paddingHorizontal: 12,
199
216
  },
200
217
  heading: {
201
218
  textAlign: 'center',
202
219
  },
203
220
  subHeading: {
204
- marginBottom: 16,
205
221
  textAlign: 'center',
206
222
  },
207
223
  videoContainer: {
@@ -213,6 +229,11 @@ const styles = StyleSheet.create({
213
229
  padding: 8,
214
230
  },
215
231
  topView: {},
232
+ bottomContainer: {
233
+ flex: 1,
234
+ justifyContent: 'space-evenly',
235
+ paddingHorizontal: 12,
236
+ },
216
237
  participantStatusContainer: {
217
238
  alignSelf: 'flex-start',
218
239
  flexDirection: 'row',
@@ -1,5 +1,11 @@
1
1
  import React from 'react';
2
- import { ImageBackground, StyleSheet, Text, View } from 'react-native';
2
+ import {
3
+ ImageBackground,
4
+ StyleSheet,
5
+ Text,
6
+ View,
7
+ ViewStyle,
8
+ } from 'react-native';
3
9
  import {
4
10
  useCallStateHooks,
5
11
  useConnectedUser,
@@ -28,6 +34,11 @@ export type IncomingCallProps = IncomingCallControlsProps & {
28
34
  * Prop to customize the IncomingCall controls.
29
35
  */
30
36
  IncomingCallControls?: React.ComponentType<IncomingCallControlsProps> | null;
37
+ /**
38
+ * Check if device is in landscape mode.
39
+ * This will apply the landscape mode styles to the component.
40
+ */
41
+ landscape?: boolean;
31
42
  };
32
43
 
33
44
  /**
@@ -39,45 +50,59 @@ export const IncomingCall = ({
39
50
  onRejectCallHandler,
40
51
  CallTopView = DefaultCallTopView,
41
52
  IncomingCallControls = DefaultIncomingCallControls,
53
+ landscape,
42
54
  }: IncomingCallProps) => {
43
55
  const { t } = useI18n();
44
56
  const {
45
57
  theme: { colors, incomingCall, typefaces },
46
58
  } = useTheme();
47
59
 
60
+ const landscapeContentStyles: ViewStyle = {
61
+ flexDirection: landscape ? 'row' : 'column',
62
+ };
63
+
48
64
  return (
49
65
  <Background>
50
66
  {CallTopView && <CallTopView />}
51
- <View style={[styles.content, incomingCall.content]}>
52
- <UserInfo />
53
- <Text
54
- style={[
55
- styles.incomingCallText,
56
- { color: colors.static_white },
57
- typefaces.heading6,
58
- incomingCall.incomingCallText,
59
- ]}
60
- >
61
- {t('Incoming Call...')}
62
- </Text>
63
- </View>
64
67
  <View
65
- style={[styles.incomingCallControls, incomingCall.incomingCallControls]}
68
+ style={[styles.content, landscapeContentStyles, incomingCall.content]}
66
69
  >
67
- {IncomingCallControls && (
68
- <IncomingCallControls
69
- onAcceptCallHandler={onAcceptCallHandler}
70
- onRejectCallHandler={onRejectCallHandler}
71
- />
72
- )}
70
+ <View style={[styles.topContainer, incomingCall.topContainer]}>
71
+ <UserInfo />
72
+ <Text
73
+ style={[
74
+ styles.incomingCallText,
75
+ { color: colors.static_white },
76
+ typefaces.heading6,
77
+ incomingCall.incomingCallText,
78
+ ]}
79
+ >
80
+ {t('Incoming Call...')}
81
+ </Text>
82
+ </View>
83
+ <View style={[styles.bottomContainer, incomingCall.bottomContainer]}>
84
+ <View
85
+ style={[
86
+ styles.incomingCallControls,
87
+ incomingCall.incomingCallControls,
88
+ ]}
89
+ >
90
+ {IncomingCallControls && (
91
+ <IncomingCallControls
92
+ onAcceptCallHandler={onAcceptCallHandler}
93
+ onRejectCallHandler={onRejectCallHandler}
94
+ />
95
+ )}
96
+ </View>
97
+ </View>
73
98
  </View>
74
99
  </Background>
75
100
  );
76
101
  };
77
102
 
78
- const Background: React.FunctionComponent<{ children: React.ReactNode }> = ({
79
- children,
80
- }) => {
103
+ const Background: React.FunctionComponent<{
104
+ children: React.ReactNode;
105
+ }> = ({ children }) => {
81
106
  const {
82
107
  theme: { colors, incomingCall },
83
108
  } = useTheme();
@@ -99,7 +124,6 @@ const Background: React.FunctionComponent<{ children: React.ReactNode }> = ({
99
124
  uri: avatarsToShow[0],
100
125
  }}
101
126
  style={[
102
- StyleSheet.absoluteFill,
103
127
  styles.background,
104
128
  { backgroundColor: colors.static_grey },
105
129
  incomingCall.background,
@@ -112,7 +136,6 @@ const Background: React.FunctionComponent<{ children: React.ReactNode }> = ({
112
136
  return (
113
137
  <View
114
138
  style={[
115
- StyleSheet.absoluteFill,
116
139
  styles.background,
117
140
  { backgroundColor: colors.static_grey },
118
141
  incomingCall.background,
@@ -128,16 +151,15 @@ export const styles = StyleSheet.create({
128
151
  flex: 1,
129
152
  },
130
153
  content: {
131
- paddingTop: 8,
154
+ flex: 1,
132
155
  },
156
+ topContainer: { flex: 1 },
133
157
  incomingCallText: {
134
- marginTop: 16,
158
+ marginTop: 8,
135
159
  textAlign: 'center',
136
160
  },
161
+ bottomContainer: { flex: 1, justifyContent: 'center' },
137
162
  incomingCallControls: {
138
- position: 'absolute',
139
- bottom: 64,
140
- left: 0,
141
- right: 0,
163
+ justifyContent: 'center',
142
164
  },
143
165
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { StyleSheet, Text, View } from 'react-native';
2
+ import { StyleSheet, Text, View, ViewStyle } from 'react-native';
3
3
  import { UserInfo } from './UserInfo';
4
4
  import { Z_INDEX } from '../../../constants';
5
5
  import {
@@ -31,6 +31,11 @@ export type OutgoingCallProps = OutgoingCallControlsProps & {
31
31
  * Prop to customize the OutgoingCall controls.
32
32
  */
33
33
  OutgoingCallControls?: React.ComponentType<OutgoingCallControlsProps> | null;
34
+ /**
35
+ * Check if device is in landscape mode.
36
+ * This will apply the landscape mode styles to the component.
37
+ */
38
+ landscape?: boolean;
34
39
  };
35
40
 
36
41
  /**
@@ -40,12 +45,17 @@ export type OutgoingCallProps = OutgoingCallControlsProps & {
40
45
  export const OutgoingCall = ({
41
46
  CallTopView = DefaultCallTopView,
42
47
  OutgoingCallControls = DefaultOutgoingCallControls,
48
+ landscape,
43
49
  }: OutgoingCallProps) => {
44
50
  const {
45
51
  theme: { colors, typefaces, outgoingCall },
46
52
  } = useTheme();
47
53
  const { t } = useI18n();
48
54
 
55
+ const landscapeContentStyles: ViewStyle = {
56
+ flexDirection: landscape ? 'row' : 'column',
57
+ };
58
+
49
59
  return (
50
60
  <>
51
61
  <View
@@ -56,28 +66,35 @@ export const OutgoingCall = ({
56
66
  ]}
57
67
  >
58
68
  {CallTopView && <CallTopView />}
59
- <View style={[styles.content, outgoingCall.content]}>
60
- <UserInfo />
61
- <Text
62
- style={[
63
- styles.callingText,
64
- { color: colors.static_white },
65
- typefaces.heading6,
66
- outgoingCall.callingText,
67
- ]}
68
- >
69
- {t('Calling...')}
70
- </Text>
71
- </View>
72
69
  <View
73
- style={[
74
- styles.outgoingCallControls,
75
- outgoingCall.outgoingCallControls,
76
- ]}
70
+ style={[styles.content, landscapeContentStyles, outgoingCall.content]}
77
71
  >
78
- {OutgoingCallControls && <OutgoingCallControls />}
72
+ <View style={[styles.topContainer, outgoingCall.topContainer]}>
73
+ <UserInfo />
74
+ <Text
75
+ style={[
76
+ styles.callingText,
77
+ { color: colors.static_white },
78
+ typefaces.heading6,
79
+ outgoingCall.callingText,
80
+ ]}
81
+ >
82
+ {t('Calling...')}
83
+ </Text>
84
+ </View>
85
+ <View style={[styles.bottomContainer, outgoingCall.bottomContainer]}>
86
+ <View
87
+ style={[
88
+ styles.outgoingCallControls,
89
+ outgoingCall.outgoingCallControls,
90
+ ]}
91
+ >
92
+ {OutgoingCallControls && <OutgoingCallControls />}
93
+ </View>
94
+ </View>
79
95
  </View>
80
96
  </View>
97
+
81
98
  <Background />
82
99
  </>
83
100
  );
@@ -133,17 +150,16 @@ const styles = StyleSheet.create({
133
150
  container: {
134
151
  zIndex: Z_INDEX.IN_MIDDLE,
135
152
  },
153
+ topContainer: { flex: 1 },
136
154
  content: {
137
- paddingTop: 8,
155
+ flex: 1,
138
156
  },
139
157
  callingText: {
140
158
  marginTop: 16,
141
159
  textAlign: 'center',
142
160
  },
161
+ bottomContainer: { flex: 1, alignSelf: 'center', justifyContent: 'center' },
143
162
  outgoingCallControls: {
144
- position: 'absolute',
145
- bottom: 64,
146
- left: 0,
147
- right: 0,
163
+ justifyContent: 'center',
148
164
  },
149
165
  });
@@ -55,7 +55,7 @@ const RingingCallPanel = ({
55
55
  CallContent = DefaultCallContent,
56
56
  JoiningCallIndicator = DefaultJoiningCallIndicator,
57
57
  CallTopView,
58
- landscape,
58
+ landscape = false,
59
59
  }: RingingCallContentProps) => {
60
60
  const call = useCall();
61
61
  const isCallCreatedByMe = call?.isCreatedByMe;
@@ -66,8 +66,12 @@ const RingingCallPanel = ({
66
66
  switch (callingState) {
67
67
  case CallingState.RINGING:
68
68
  return isCallCreatedByMe
69
- ? OutgoingCall && <OutgoingCall CallTopView={CallTopView} />
70
- : IncomingCall && <IncomingCall CallTopView={CallTopView} />;
69
+ ? OutgoingCall && (
70
+ <OutgoingCall CallTopView={CallTopView} landscape={landscape} />
71
+ )
72
+ : IncomingCall && (
73
+ <IncomingCall CallTopView={CallTopView} landscape={landscape} />
74
+ );
71
75
  case CallingState.JOINED:
72
76
  return (
73
77
  CallContent && (
@@ -134,6 +134,6 @@ const styles = StyleSheet.create({
134
134
  },
135
135
  name: {
136
136
  textAlign: 'center',
137
- marginTop: 32,
137
+ marginTop: 16,
138
138
  },
139
139
  });
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useEffect, useRef, MutableRefObject } from 'react';
1
+ import React, { useMemo, useEffect } from 'react';
2
2
  import { LayoutRectangle, View } from 'react-native';
3
3
  import {
4
4
  FloatingViewAlignment,
@@ -46,13 +46,8 @@ try {
46
46
  children,
47
47
  }: FloatingViewProps) => {
48
48
  // to store the starting position of the gesture
49
- const startRef: MutableRefObject<{ x: number; y: number } | null> = useRef<{
50
- x: number;
51
- y: number;
52
- }>({
53
- x: 0,
54
- y: 0,
55
- });
49
+ // NOTE: note be used for deriving styling
50
+ const start = useSharedValue({ x: 0, y: 0 });
56
51
  // to store the necessary translate x, y position
57
52
  const translationX = useSharedValue(0);
58
53
  const translationY = useSharedValue(0);
@@ -82,55 +77,51 @@ try {
82
77
  });
83
78
  }, [rectangle, containerWidth, containerHeight]);
84
79
 
85
- const dragGesture = useMemo(
86
- () =>
87
- Gesture.Pan()
88
- .onStart((_e) => {
89
- // store the starting position of the gesture
90
- startRef.current = {
91
- x: translationX.value,
92
- y: translationY.value,
93
- };
94
- })
95
- .onUpdate((e) => {
96
- // update the translation with the distance of the gesture + starting position
97
- translationX.value = Math.max(
98
- 0,
99
- Math.min(
100
- e.translationX + (startRef.current?.x ?? 0),
101
- snapAlignments[FloatingViewAlignment.bottomRight].x,
102
- ),
103
- );
104
- translationY.value = Math.max(
105
- 0,
106
- Math.min(
107
- e.translationY + (startRef.current?.y ?? 0),
108
- snapAlignments[FloatingViewAlignment.bottomRight].y,
109
- ),
110
- );
111
- })
112
- .onEnd(() => {
113
- // snap to the closest alignment with a spring animation
114
- const position = {
115
- x: translationX.value,
116
- y: translationY.value,
117
- };
118
- const closestAlignment = getClosestSnapAlignment({
119
- position,
120
- snapAlignments,
121
- });
122
- translationX.value = withTiming(closestAlignment.x);
123
- translationY.value = withTiming(closestAlignment.y);
124
- }),
125
- [snapAlignments, translationX, translationY],
126
- );
80
+ const dragGesture = Gesture.Pan()
81
+ .onStart((_e) => {
82
+ start.value = {
83
+ x: translationX.value,
84
+ y: translationY.value,
85
+ };
86
+ })
87
+ .onUpdate((e) => {
88
+ // update the translation with the distance of the gesture + starting position
89
+ translationX.value = Math.max(
90
+ 0,
91
+ Math.min(
92
+ e.translationX + (start.value.x ?? 0),
93
+ snapAlignments[FloatingViewAlignment.bottomRight].x,
94
+ ),
95
+ );
96
+ translationY.value = Math.max(
97
+ 0,
98
+ Math.min(
99
+ e.translationY + (start.value.y ?? 0),
100
+ snapAlignments[FloatingViewAlignment.bottomRight].y,
101
+ ),
102
+ );
103
+ })
104
+ .onEnd(() => {
105
+ // snap to the closest alignment with a spring animation
106
+ const position = {
107
+ x: translationX.value,
108
+ y: translationY.value,
109
+ };
110
+ const closestAlignment = getClosestSnapAlignment({
111
+ position,
112
+ snapAlignments,
113
+ });
114
+ translationX.value = withTiming(closestAlignment.x);
115
+ translationY.value = withTiming(closestAlignment.y);
116
+ });
127
117
 
118
+ /* Move to the initial position */
128
119
  useEffect(() => {
129
120
  if (!rectangle) {
130
121
  return;
131
122
  }
132
123
  const alignment = snapAlignments[initialAlignment];
133
- startRef.current = alignment;
124
+ start.value = alignment;
134
125
 
135
126
  translationX.value = alignment.x;
136
127
  translationY.value = alignment.y;
@@ -145,6 +136,7 @@ try {
145
136
  opacity,
146
137
  translationX,
147
138
  translationY,
139
+ start,
148
140
  ]);
149
141
 
150
142
  const animatedStyle = useAnimatedStyle(() => {
@@ -6,7 +6,7 @@ export const FLOATING_VIDEO_VIEW_STYLE = {
6
6
  borderRadius: 10,
7
7
  };
8
8
 
9
- export const LOBBY_VIDEO_VIEW_HEIGHT = 280;
9
+ export const LOBBY_VIDEO_VIEW_HEIGHT = 240;
10
10
 
11
11
  export const defaultEmojiReactions: StreamReactionType[] = [
12
12
  {
@@ -101,9 +101,11 @@ export type Theme = {
101
101
  };
102
102
  lobby: {
103
103
  container: ViewStyle;
104
+ topContainer: ViewStyle;
104
105
  heading: TextStyle;
105
106
  subHeading: TextStyle;
106
107
  videoContainer: ViewStyle;
108
+ bottomContainer: ViewStyle;
107
109
  infoContainer: ViewStyle;
108
110
  infoText: TextStyle;
109
111
  participantStatusContainer: ViewStyle;
@@ -148,8 +150,10 @@ export type Theme = {
148
150
  incomingCall: {
149
151
  background: ViewStyle;
150
152
  content: ViewStyle;
153
+ topContainer: ViewStyle;
151
154
  incomingCallText: TextStyle;
152
155
  incomingCallControls: ViewStyle;
156
+ bottomContainer: ViewStyle;
153
157
  buttonGroup: ViewStyle;
154
158
  };
155
159
  joiningCallIndicator: {
@@ -159,8 +163,10 @@ export type Theme = {
159
163
  container: ViewStyle;
160
164
  background: ViewStyle;
161
165
  content: ViewStyle;
166
+ topContainer: ViewStyle;
162
167
  callingText: TextStyle;
163
168
  outgoingCallControls: ViewStyle;
169
+ bottomContainer: ViewStyle;
164
170
  buttonGroup: ViewStyle;
165
171
  deviceControlButtons: ViewStyle;
166
172
  };
@@ -213,10 +219,10 @@ export const defaultTheme: Theme = {
213
219
  },
214
220
  avatarSizes: {
215
221
  xs: 50,
216
- sm: 100,
217
- md: 120,
218
- lg: 180,
219
- xl: 80,
222
+ sm: 90,
223
+ md: 100,
224
+ lg: 160,
225
+ xl: 180,
220
226
  },
221
227
  },
222
228
  typefaces: {
@@ -318,8 +324,10 @@ export const defaultTheme: Theme = {
318
324
  },
319
325
  lobby: {
320
326
  container: {},
327
+ topContainer: {},
321
328
  heading: {},
322
329
  subHeading: {},
330
+ bottomContainer: {},
323
331
  videoContainer: {},
324
332
  infoContainer: {},
325
333
  infoText: {},
@@ -373,16 +381,20 @@ export const defaultTheme: Theme = {
373
381
  incomingCall: {
374
382
  background: {},
375
383
  content: {},
384
+ topContainer: {},
376
385
  incomingCallText: {},
377
386
  incomingCallControls: {},
387
+ bottomContainer: {},
378
388
  buttonGroup: {},
379
389
  },
380
390
  outgoingCall: {
381
391
  container: {},
382
392
  background: {},
383
393
  content: {},
394
+ topContainer: {},
384
395
  callingText: {},
385
396
  outgoingCallControls: {},
397
+ bottomContainer: {},
386
398
  buttonGroup: {},
387
399
  deviceControlButtons: {},
388
400
  },
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '0.1.5';
1
+ export const version = '0.1.6';