Skip to content

Commit 480a359

Browse files
kristian-mkdsanthoshvaioliverlaz
authored
feat(design-v2): sdk and dogfood app design-v2 changes (#1549)
## Overview Design v2 changes of the SDK components and dogfood application. [RELEASE NOTES](https://github.com/GetStream/docs-content/blob/745f82b3f9e97bbcf9035785eedf319aba7f43ff/video/react-native/CHANGELOG.md) [PR: Docs update](GetStream/docs-content#16) ### Summary We're excited to announce version 1.4.0 of our react-native library, bringing significant improvements and features. This update includes breaking changes, so please review the migration guide before upgrading. ### ✨ New Features - **Theme System Overhaul** - Added comprehensive theme support for: - Button sizes - Icon sizes - Avatar sizes - Font sizes - Spacing sizes - Border radius sizes - Insets - Introduced new color system (see Migration Guide) - **New Component** - Speech Indicator: Visual feedback for active speaker states - **Updated icons** - Mic, MicOff, Video, VideoSlash, CameraSwitch, Phone, PhoneDown, ScreenShare, StopScreenShare - **New default emojis** - 🤣 Rolling on the floor laughing - 👍 Like - 🚀 Rocket - 👎 Dislike - 🎉 Fireworks - 🙌 Raised hands - ✋ Raised hand - **Safe Area Improvements** - Added theme-based inset support for better safe area handling - See our [Safe Area Guide](/video/docs/react-native/ui-cookbook/safe-area/) for implementation details ### 🔨 Enhancements - Design updates for most of the components ### 🚨 Breaking Changes - The following SDK components have been deprecated and removed: - CallTopView.tsx - ChatButton.tsx - ParticipantsInfoBadge.tsx #### CallTopView Removal The `CallTopView` prop in `CallContent` component has been removed. Instead, you can now render your custom top view component as a sibling to `CallContent`. This provides more flexibility and better composition of UI elements. **Before:** ```tsx <StreamCall call={call}> <CallContent CallTopView={CustomCallTopView} /> {/* Removed */} </StreamCall> ``` **After:** ```tsx <StreamCall call={call}> <CustomCallTopView /> {/* Render as separate component */} <CallContent /> </StreamCall> ``` #### Colors migration guide | Old | New | | ------------------ | ------------------------------------------------ | | primary | primary or buttonPrimary or iconPrimary | | error | iconWarning or buttonWarning | | info | iconSuccess | | static_black | sheetPrimary or iconPrimary | | static_white | textPrimary or iconPrimary | | static_grey | sheetPrimary or sheetSecondary or sheetTertiary | | static_overlay | sheetOverlay | | overlay | sheetOverlay | | darkGray | sheetPrimary or sheetTertiary or buttonSecondary | | disabled | sheetTertiary or buttonDisabled | | bars | textPrimary | | text_high_emphasis | textPrimary | | text_low_emphasis | textSecondary | | controls_bg | textPrimary | | borders | primary or secondary | | overlay_dark | sheetOverlay | | content_bg | sheetPrimary | | dark_gray | sheetPrimary | --------- Co-authored-by: Santhosh Vaiyapuri <[email protected]> Co-authored-by: GitHub Actions Bot <> Co-authored-by: Oliver Lazoroski <[email protected]>
1 parent fc4490e commit 480a359

File tree

161 files changed

+4285
-2188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+4285
-2188
lines changed

packages/react-bindings/src/hooks/callUtilHooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useCallback, useEffect, useState } from 'react';
22
import { useCall } from '../contexts';
33
import { useIsCallRecordingInProgress } from './callStateHooks';
4+
45
/**
56
* Custom hook for toggling call recording in a video call.
67
*

packages/react-native-sdk/__tests__/components/CallControls.test.tsx

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import { mockClientWithUser } from '../mocks/client';
33
import mockParticipant from '../mocks/participant';
44
import { ButtonTestIds, ComponentTestIds } from '../../src/constants/TestIds';
55
import { mockCall } from '../mocks/call';
6-
import { fireEvent, render, screen, waitFor } from '../utils/RNTLTools';
6+
import { fireEvent, render, screen } from '../utils/RNTLTools';
77
import { OwnCapability } from '@stream-io/video-client';
88
import { defaultEmojiReactions } from '../../src/constants';
9-
import { CallControls } from '../../src/components/Call/CallControls/CallControls';
10-
import { ChatButton } from '../../src/components/Call/CallControls/ChatButton';
9+
import { CallControls } from '../../src';
1110
import { HangUpCallButton } from '../../src/components/Call/CallControls/HangupCallButton';
1211
import { ReactionsButton } from '../../src/components/Call/CallControls/ReactionsButton';
1312

@@ -18,48 +17,6 @@ enum P_IDS {
1817
LOCAL_1 = 'local-1',
1918
}
2019

21-
describe('ChatButton', () => {
22-
it('should render an unread badge indicator when the value is defined in the chatButton prop', async () => {
23-
const call = mockCall(mockClientWithUser(), [
24-
mockParticipant({
25-
isLocalParticipant: true,
26-
sessionId: P_IDS.LOCAL_1,
27-
userId: P_IDS.LOCAL_1,
28-
}),
29-
]);
30-
31-
render(<ChatButton onPressHandler={jest.fn()} unreadBadgeCount={1} />, {
32-
call,
33-
});
34-
35-
const indicator = await screen.findByText('1');
36-
37-
expect(indicator).toBeVisible();
38-
});
39-
40-
it('should not render an unread badge indicator when the value is 0 in the chatButton prop', async () => {
41-
const call = mockCall(mockClientWithUser(), [
42-
mockParticipant({
43-
isLocalParticipant: true,
44-
sessionId: P_IDS.LOCAL_1,
45-
userId: P_IDS.LOCAL_1,
46-
}),
47-
]);
48-
49-
render(<ChatButton onPressHandler={jest.fn()} unreadBadgeCount={0} />, {
50-
call,
51-
});
52-
53-
await waitFor(() =>
54-
expect(() =>
55-
screen.getByTestId(ComponentTestIds.CHAT_UNREAD_BADGE_COUNT_INDICATOR)
56-
).toThrow(
57-
/Unable to find an element with testID: chat-unread-badge-count-indicator/i
58-
)
59-
);
60-
});
61-
});
62-
6320
describe('ReactionsButton', () => {
6421
it('render reaction button in call controls component', async () => {
6522
const call = mockCall(

packages/react-native-sdk/__tests__/components/ParticipantView.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ describe('ParticipantView', () => {
4343
expect(
4444
await screen.findByTestId(ComponentTestIds.PARTICIPANT_AVATAR)
4545
).toBeOnTheScreen();
46-
expect(screen.getByTestId(IconTestIds.MUTED_VIDEO)).toBeOnTheScreen();
4746
expect(screen.getByText(testParticipant.name)).toBeOnTheScreen();
4847
// reaction is visible and then disappears after 5500 ms
4948
expect(screen.getByText('🎉')).toBeOnTheScreen();

packages/react-native-sdk/docusaurus/docs/reactnative/04-ui-components/call/call-content.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import CallContentSpotlight from '../../assets/04-ui-components/call/call-conten
1010

1111
import CallTopView from '../../common-content/ui-components/call/call-content/call-top-view.mdx';
1212
import CallControls from '../../common-content/ui-components/call/call-content/call-controls.mdx';
13-
import ParticipantsInfoBadge from '../../common-content/ui-components/call/call-content/participants-info-badge.mdx';
1413
import Landscape from '../../common-content/ui-components/call/call-content/landscape.mdx';
1514
import OnBackPressed from '../../common-content/ui-components/call/call-content/on-back-pressed.mdx';
1615
import OnParticipantInfoPress from '../../common-content/ui-components/call/call-content/on-participant-info-press.mdx';

packages/react-native-sdk/docusaurus/docs/reactnative/04-ui-components/call/call-top-view.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ id: call-top-view
33
title: CallTopView
44
---
55

6-
import ParticipantsInfoBadge from '../../common-content/ui-components/call/call-content/participants-info-badge.mdx';
76
import OnBackPressed from '../../common-content/ui-components/call/call-content/on-back-pressed.mdx';
87
import OnParticipantInfoPress from '../../common-content/ui-components/call/call-content/on-participant-info-press.mdx';
98

@@ -60,10 +59,6 @@ Style to override the container of the `CallTopView`.
6059
| ---------------------------------------------------------- |
6160
| [ViewStyle](https://reactnative.dev/docs/view-style-props) |
6261

63-
### `ParticipantsInfoBadge`
64-
65-
<ParticipantsInfoBadge />
66-
6762
## Customization
6863

6964
You can create your own custom `CallTopView` using the [Call Top View UI Cookbook guide](../../../ui-cookbook/replacing-call-top-view/).

packages/react-native-sdk/docusaurus/docs/reactnative/05-ui-cookbook/19-call-quality-rating.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const FeedbackModal: = () => {
6969
<TouchableOpacity onPress={onClose} style={[styles.closeButton]}>
7070
<IconWrapper>
7171
<Close
72-
color={colors.typeSecondary}
72+
color={colors.iconPrimary}
7373
size={variants.roundButtonSizes.sm}
7474
/>
7575
</IconWrapper>
@@ -93,8 +93,8 @@ const FeedbackModal: = () => {
9393
<Star
9494
color={
9595
selectedRating && selectedRating >= rating
96-
? colors.iconAlertSuccess
97-
: colors.typeSecondary
96+
? colors.iconSuccess
97+
: colors.iconPrimary
9898
}
9999
/>
100100
</TouchableOpacity>

packages/react-native-sdk/docusaurus/docs/reactnative/common-content/ui-components/call/call-content/participants-info-badge.mdx

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/react-native-sdk/src/components/Call/CallContent/CallContent.tsx

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, { useEffect, useState, useMemo } from 'react';
22
import { StyleSheet, View, ViewStyle } from 'react-native';
33
import InCallManager from 'react-native-incall-manager';
4-
5-
import {
6-
CallTopView as DefaultCallTopView,
7-
CallTopViewProps,
8-
} from '../CallTopView';
94
import {
105
CallParticipantsGrid,
116
CallParticipantsGridProps,
@@ -45,10 +40,6 @@ export type StreamReactionType = StreamReaction & {
4540

4641
type CallContentComponentProps = ParticipantViewComponentProps &
4742
Pick<CallParticipantsListComponentProps, 'ParticipantView'> & {
48-
/**
49-
* Component to customize the CallTopView component.
50-
*/
51-
CallTopView?: React.ComponentType<CallTopViewProps> | null;
5243
/**
5344
* Component to customize the CallControls component.
5445
*/
@@ -71,10 +62,6 @@ export type CallContentProps = Pick<
7162
HangUpCallButtonProps,
7263
'onHangupCallHandler'
7364
> &
74-
Pick<
75-
CallTopViewProps,
76-
'onBackPressed' | 'onParticipantInfoPress' | 'ParticipantsInfoBadge'
77-
> &
7865
CallContentComponentProps & {
7966
/**
8067
* This switches the participant's layout between the grid and the spotlight mode.
@@ -100,11 +87,8 @@ export type CallContentProps = Pick<
10087
};
10188

10289
export const CallContent = ({
103-
onBackPressed,
104-
onParticipantInfoPress,
10590
onHangupCallHandler,
10691
CallParticipantsList,
107-
CallTopView = DefaultCallTopView,
10892
CallControls = DefaultCallControls,
10993
FloatingParticipantView = DefaultFloatingParticipantView,
11094
ScreenShareOverlay = DefaultScreenShareOverlay,
@@ -113,7 +97,6 @@ export const CallContent = ({
11397
ParticipantReaction,
11498
ParticipantVideoFallback,
11599
ParticipantView,
116-
ParticipantsInfoBadge,
117100
VideoRenderer,
118101
layout = 'grid',
119102
landscape = false,
@@ -125,6 +108,7 @@ export const CallContent = ({
125108
showRemoteParticipantInFloatingView,
126109
setShowRemoteParticipantInFloatingView,
127110
] = useState<boolean>(false);
111+
const styles = useStyles();
128112
const {
129113
theme: { callContent },
130114
} = useTheme();
@@ -213,20 +197,13 @@ export const CallContent = ({
213197
/>
214198
)}
215199
<View style={[styles.container, landscapeStyles, callContent.container]}>
216-
<View style={[styles.container, callContent.callParticipantsContainer]}>
200+
<View style={[styles.content, callContent.callParticipantsContainer]}>
217201
<View
218202
style={[styles.view, callContent.topContainer]}
219203
// "box-none" disallows the container view to be not take up touches
220204
// and allows only the top and floating view (its child views) to take up the touches
221205
pointerEvents="box-none"
222206
>
223-
{!isInPiPMode && CallTopView && (
224-
<CallTopView
225-
onBackPressed={onBackPressed}
226-
onParticipantInfoPress={onParticipantInfoPress}
227-
ParticipantsInfoBadge={ParticipantsInfoBadge}
228-
/>
229-
)}
230207
{showFloatingView && FloatingParticipantView && (
231208
<FloatingParticipantView
232209
participant={
@@ -258,10 +235,25 @@ export const CallContent = ({
258235
);
259236
};
260237

261-
const styles = StyleSheet.create({
262-
container: { flex: 1 },
263-
view: {
264-
...StyleSheet.absoluteFillObject,
265-
zIndex: Z_INDEX.IN_FRONT,
266-
},
267-
});
238+
const useStyles = () => {
239+
const { theme } = useTheme();
240+
return useMemo(
241+
() =>
242+
StyleSheet.create({
243+
container: {
244+
flex: 1,
245+
paddingBottom: theme.variants.insets.bottom,
246+
paddingLeft: theme.variants.insets.left,
247+
paddingRight: theme.variants.insets.right,
248+
paddingTop: theme.variants.insets.top,
249+
backgroundColor: theme.colors.sheetPrimary,
250+
},
251+
content: { flex: 1 },
252+
view: {
253+
...StyleSheet.absoluteFillObject,
254+
zIndex: Z_INDEX.IN_FRONT,
255+
},
256+
}),
257+
[theme]
258+
);
259+
};

packages/react-native-sdk/src/components/Call/CallControls/AcceptCallButton.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useCall } from '@stream-io/video-react-bindings';
22
import { getLogger } from '@stream-io/video-client';
33
import React from 'react';
44
import { CallControlsButton } from './CallControlsButton';
5-
import { Phone } from '../../../icons';
5+
import { IconWrapper, Phone } from '../../../icons';
66
import { useTheme } from '../../../contexts/ThemeContext';
77

88
/**
@@ -34,7 +34,7 @@ export const AcceptCallButton = ({
3434
const {
3535
theme: {
3636
colors,
37-
variants: { buttonSizes },
37+
variants: { buttonSizes, iconSizes },
3838
acceptCallButton,
3939
},
4040
} = useTheme();
@@ -57,11 +57,13 @@ export const AcceptCallButton = ({
5757
return (
5858
<CallControlsButton
5959
onPress={acceptCallHandler}
60-
color={colors.info}
61-
size={buttonSizes.lg}
60+
color={colors.buttonSuccess}
61+
size={buttonSizes.md}
6262
style={acceptCallButton}
6363
>
64-
<Phone color={colors.static_white} />
64+
<IconWrapper>
65+
<Phone color={colors.iconPrimary} size={iconSizes.lg} />
66+
</IconWrapper>
6567
</CallControlsButton>
6668
);
6769
};

packages/react-native-sdk/src/components/Call/CallControls/CallControls.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const CallControls = ({
4040
<View
4141
style={[
4242
styles.container,
43-
{ backgroundColor: colors.static_grey },
43+
{ backgroundColor: colors.sheetPrimary },
4444
callControls.container,
4545
landscapeStyles,
4646
style,
@@ -49,7 +49,7 @@ export const CallControls = ({
4949
<ToggleVideoPublishingButton />
5050
<ToggleAudioPublishingButton />
5151
<ToggleCameraFaceButton />
52-
<HangUpCallButton onHangupCallHandler={onHangupCallHandler} />
52+
<HangUpCallButton onPressHandler={onHangupCallHandler} />
5353
</View>
5454
);
5555
};

0 commit comments

Comments
 (0)