Skip to content

Commit f8e5c6e

Browse files
authored
chore: removed SafeAreaView legacy package usage (#1985)
### 💡 Overview Removing `SafeAreaView` deprecated usages. ### 📝 Implementation notes * Replaced `SafeAreaView` usages with the version from `react-native-safe-area-context` package. * Fixed an issue for `ParticipantsInfoList` component: when there is a big list of users action buttons where moved outside of the viewport. 🎫 Ticket: [RN-301](https://linear.app/stream/issue/RN-301/replace-old-safeareaview-usages)
1 parent 1d93f72 commit f8e5c6e

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed

sample-apps/react-native/dogfood/src/components/AndroidAudioRoutePickerDrawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
Image,
1414
Modal,
1515
PanResponder,
16-
SafeAreaView,
1716
StyleSheet,
1817
Text,
1918
TouchableOpacity,
@@ -22,6 +21,7 @@ import {
2221
View,
2322
} from 'react-native';
2423
import { BOTTOM_CONTROLS_HEIGHT } from '../constants';
24+
import { SafeAreaView } from 'react-native-safe-area-context';
2525

2626
type DrawerProps = {
2727
isVisible: boolean;

sample-apps/react-native/dogfood/src/components/AuthenticatingProgress.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React, { useMemo } from 'react';
2-
import { ActivityIndicator, SafeAreaView, StyleSheet } from 'react-native';
2+
import { ActivityIndicator, StyleSheet, View } from 'react-native';
33
import { useTheme } from '@stream-io/video-react-native-sdk';
44

55
export const AuthenticationProgress = () => {
66
const styles = useStyles();
77
return (
8-
<SafeAreaView style={styles.container}>
8+
<View style={styles.container}>
99
<ActivityIndicator size={'large'} style={StyleSheet.absoluteFill} />
10-
</SafeAreaView>
10+
</View>
1111
);
1212
};
1313

sample-apps/react-native/dogfood/src/components/BottomControlsDrawer.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
FlatList,
1414
Modal,
1515
PanResponder,
16-
SafeAreaView,
1716
StyleSheet,
1817
Text,
1918
TouchableOpacity,
@@ -24,6 +23,7 @@ import { BOTTOM_CONTROLS_HEIGHT } from '../constants';
2423
import RaiseHand from '../assets/RaiseHand';
2524
import { CallStats } from './CallStats';
2625
import { VideoFilters } from './VideoEffects';
26+
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
2727

2828
export type DrawerOption = {
2929
id: string;
@@ -207,8 +207,8 @@ export const BottomControlsDrawer: React.FC<DrawerProps> = ({
207207
supportedOrientations={['portrait', 'landscape']}
208208
>
209209
<TouchableWithoutFeedback onPress={onClose}>
210-
<View style={styles.overlay}>
211-
<SafeAreaView style={styles.safeArea}>
210+
<SafeAreaProvider>
211+
<SafeAreaView style={styles.overlay} edges={['bottom']}>
212212
<Animated.View
213213
style={[styles.container, { transform: [{ translateY }] }]}
214214
>
@@ -217,7 +217,7 @@ export const BottomControlsDrawer: React.FC<DrawerProps> = ({
217217
{showCallStats && <CallStats showCodecInfo />}
218218
</Animated.View>
219219
</SafeAreaView>
220-
</View>
220+
</SafeAreaProvider>
221221
</TouchableWithoutFeedback>
222222
</Modal>
223223
);
@@ -234,10 +234,6 @@ const useStyles = () => {
234234
flex: 1,
235235
justifyContent: 'flex-end',
236236
},
237-
safeArea: {
238-
flex: 1,
239-
justifyContent: 'flex-end',
240-
},
241237
container: {
242238
backgroundColor: colors.sheetPrimary,
243239
borderTopLeftRadius: variants.borderRadiusSizes.lg,

sample-apps/react-native/dogfood/src/components/ParticipantsInfoList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
FlatList,
1919
Modal,
2020
Pressable,
21-
SafeAreaView,
2221
Share,
2322
StyleSheet,
2423
Text,
@@ -34,6 +33,7 @@ import { generateParticipantTitle } from '../utils';
3433
import { Z_INDEX } from '../constants';
3534
import { ButtonTestIds } from '../constants/TestIds';
3635
import { useAppGlobalStoreValue } from '../contexts/AppContext';
36+
import { SafeAreaView } from 'react-native-safe-area-context';
3737

3838
export interface ParticipantsInfoListProps {
3939
/**
@@ -272,6 +272,7 @@ const useStyles = () => {
272272
borderRadius: 15,
273273
marginHorizontal: 16,
274274
marginTop: 65,
275+
flexShrink: 1,
275276
},
276277
header: {
277278
flexDirection: 'row',

sample-apps/react-native/dogfood/src/screens/Meeting/ChatScreen.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import React, { useEffect, useMemo, useState } from 'react';
2-
import {
3-
Pressable,
4-
SafeAreaView,
5-
StatusBar,
6-
StyleSheet,
7-
Text,
8-
View,
9-
} from 'react-native';
2+
import { Pressable, StatusBar, StyleSheet, Text, View } from 'react-native';
103
import {
114
Channel,
125
MessageInput,
@@ -60,6 +53,7 @@ const ChannelHeader = () => {
6053
};
6154

6255
export const ChatScreen = ({ route }: ChatScreenProps) => {
56+
const styles = useStyles();
6357
const [channel, setChannel] = useState<ChannelType>();
6458
const { client } = useChatContext();
6559
const {
@@ -77,14 +71,14 @@ export const ChatScreen = ({ route }: ChatScreenProps) => {
7771
}
7872

7973
return (
80-
<SafeAreaView>
74+
<View style={styles.container}>
8175
<StatusBar barStyle="default" />
8276
<Channel channel={channel} keyboardVerticalOffset={120}>
8377
<ChannelHeader />
8478
<MessageList />
8579
<MessageInput />
8680
</Channel>
87-
</SafeAreaView>
81+
</View>
8882
);
8983
};
9084

@@ -93,6 +87,10 @@ const useStyles = () => {
9387
return useMemo(
9488
() =>
9589
StyleSheet.create({
90+
container: {
91+
flex: 1,
92+
backgroundColor: theme.colors.sheetSecondary,
93+
},
9694
header: {
9795
padding: 10,
9896
flexDirection: 'row',

0 commit comments

Comments
 (0)