Skip to content

Commit fbf67a5

Browse files
authored
Merge pull request #539 from GetStream/review-fixes
App review and feedback fixes on SDK
2 parents 92f891e + 0b84e7b commit fbf67a5

File tree

24 files changed

+215
-88
lines changed

24 files changed

+215
-88
lines changed

examples/SampleApp/src/components/ChannelInfoOverlay.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,11 @@ import { useChannelInfoOverlayContext } from '../context/ChannelInfoOverlayConte
4545

4646
dayjs.extend(relativeTime);
4747

48-
const avatarPresenceIndicator = {
49-
cx: 6,
50-
cy: 6,
51-
r: 6,
52-
};
5348
const avatarSize = 64;
5449

5550
const styles = StyleSheet.create({
5651
avatarPresenceIndicator: {
57-
right: 4,
52+
right: 5,
5853
top: 1,
5954
},
6055
channelName: {
@@ -101,7 +96,7 @@ const styles = StyleSheet.create({
10196
userItemContainer: { marginHorizontal: 8, width: 64 },
10297
userName: {
10398
fontSize: 12,
104-
fontWeight: 'bold',
99+
fontWeight: '600',
105100
paddingTop: 4,
106101
textAlign: 'center',
107102
},
@@ -353,7 +348,6 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
353348
image={item.image}
354349
name={item.name || item.id}
355350
online={item.online}
356-
presenceIndicator={avatarPresenceIndicator}
357351
presenceIndicatorContainerStyle={
358352
styles.avatarPresenceIndicator
359353
}

examples/SampleApp/src/components/ChannelPreview.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from 'stream-chat-react-native';
1414

1515
import { useAppOverlayContext } from '../context/AppOverlayContext';
16+
import { useBottomSheetOverlayContext } from '../context/BottomSheetOverlayContext';
1617
import { useChannelInfoOverlayContext } from '../context/ChannelInfoOverlayContext';
1718

1819
import type { StackNavigationProp } from '@react-navigation/stack';
@@ -65,7 +66,9 @@ export const ChannelPreview: React.FC<
6566

6667
const { setOverlay } = useAppOverlayContext();
6768

68-
const { setData } = useChannelInfoOverlayContext();
69+
const { setData: setDataBottomSheet } = useBottomSheetOverlayContext();
70+
71+
const { setData, data } = useChannelInfoOverlayContext();
6972

7073
const { client } = useChatContext<
7174
LocalAttachmentType,
@@ -85,6 +88,12 @@ export const ChannelPreview: React.FC<
8588
},
8689
} = useTheme();
8790

91+
const otherMembers = channel
92+
? Object.values(channel.state.members).filter(
93+
(member) => member.user?.id !== data?.clientId,
94+
)
95+
: [];
96+
8897
return (
8998
<Swipeable
9099
overshootLeft={false}
@@ -103,7 +112,22 @@ export const ChannelPreview: React.FC<
103112
<MenuPointHorizontal />
104113
</RectButton>
105114
<RectButton
106-
onPress={() => channel.delete()}
115+
onPress={() => {
116+
setDataBottomSheet({
117+
confirmText: 'DELETE',
118+
onConfirm: () => {
119+
channel.delete();
120+
setOverlay('none');
121+
},
122+
subtext: `Are you sure you want to delete this ${
123+
otherMembers.length === 1 ? 'conversation' : 'group'
124+
}?`,
125+
title: `Delete ${
126+
otherMembers.length === 1 ? 'Conversation' : 'Group'
127+
}`,
128+
});
129+
setOverlay('confirmation');
130+
}}
107131
style={[styles.rightSwipeableButton]}
108132
>
109133
<Delete pathFill={accent_red} />

examples/SampleApp/src/components/ConfirmationBottomSheet.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,25 @@ const styles = StyleSheet.create({
2525
},
2626
container: {
2727
height: 224,
28+
borderTopLeftRadius: 16,
29+
borderTopRightRadius: 16,
2830
},
2931
description: {
3032
alignItems: 'center',
3133
flex: 1,
3234
justifyContent: 'center',
3335
},
3436
subtext: {
37+
fontSize: 14,
38+
fontWeight: '500',
3539
marginTop: 8,
40+
paddingHorizontal: 16,
3641
},
3742
title: {
38-
fontWeight: '600',
43+
fontSize: 16,
44+
fontWeight: '700',
3945
marginTop: 18,
46+
paddingHorizontal: 16,
4047
},
4148
});
4249

examples/SampleApp/src/components/RoundButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const styles = StyleSheet.create({
1515
},
1616
default: {
1717
shadowOffset: {
18-
height: 1,
18+
height: 2,
1919
width: 0,
2020
},
2121
shadowOpacity: 0.25,

examples/SampleApp/src/components/UserInfoOverlay.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,13 @@ import type {
5454

5555
dayjs.extend(relativeTime);
5656

57-
const avatarPresenceIndicator = {
58-
cx: 6,
59-
cy: 6,
60-
r: 6,
61-
};
6257
const avatarSize = 64;
6358

6459
const permissions = ['admin', 'moderator'];
6560

6661
const styles = StyleSheet.create({
6762
avatarPresenceIndicator: {
68-
right: 4,
63+
right: 5,
6964
top: 1,
7065
},
7166
channelName: {
@@ -327,7 +322,6 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
327322
image={member.user?.image}
328323
name={member.user?.name || member.user?.id}
329324
online={member.user?.online}
330-
presenceIndicator={avatarPresenceIndicator}
331325
presenceIndicatorContainerStyle={
332326
styles.avatarPresenceIndicator
333327
}

examples/SampleApp/src/screens/ChannelListScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const styles = StyleSheet.create({
4949
},
5050
searchContainer: {
5151
alignItems: 'center',
52-
borderRadius: 18,
52+
borderRadius: 30,
5353
borderWidth: 1,
5454
flexDirection: 'row',
5555
margin: 8,

examples/SampleApp/src/screens/UserSelectorScreen.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {
88
TouchableOpacity,
99
View,
1010
} from 'react-native';
11-
import { SafeAreaView } from 'react-native-safe-area-context';
11+
import {
12+
SafeAreaView,
13+
useSafeAreaInsets,
14+
} from 'react-native-safe-area-context';
1215
import { useTheme } from 'stream-chat-react-native';
1316

1417
import { USERS } from '../ChatUsers';
@@ -96,13 +99,17 @@ export const UserSelectorScreen: React.FC<Props> = ({ navigation }) => {
9699
},
97100
} = useTheme();
98101
const { switchUser } = useContext(AppContext);
102+
const { bottom } = useSafeAreaInsets();
99103

100104
useEffect(() => {
101105
AsyncStore.setItem('@stream-rn-sampleapp-user-id', '');
102106
}, []);
103107

104108
return (
105-
<SafeAreaView style={[styles.container, { backgroundColor: white_snow }]}>
109+
<SafeAreaView
110+
style={[styles.container, { backgroundColor: white_snow }]}
111+
edges={['right', 'top', 'left']}
112+
>
106113
<ScrollView
107114
contentContainerStyle={styles.contentContainer}
108115
style={styles.scrollContainer}
@@ -192,9 +199,19 @@ export const UserSelectorScreen: React.FC<Props> = ({ navigation }) => {
192199
</View>
193200
</TouchableOpacity>
194201
</ScrollView>
195-
<Text style={[styles.footerText, { color: grey_gainsboro }]}>
196-
Stream SDK v{version}
197-
</Text>
202+
<View
203+
style={[
204+
{
205+
paddingBottom: bottom ? bottom : 16,
206+
paddingTop: 16,
207+
backgroundColor: white_snow,
208+
},
209+
]}
210+
>
211+
<Text style={[styles.footerText, { color: grey_gainsboro }]}>
212+
Stream SDK v{version}
213+
</Text>
214+
</View>
198215
</SafeAreaView>
199216
);
200217
};

src/components/Attachment/Card.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ const styles = StyleSheet.create({
7070
},
7171
description: {
7272
fontSize: 12,
73+
marginHorizontal: 8,
7374
},
7475
title: {
7576
fontSize: 12,
77+
marginHorizontal: 8,
7678
},
7779
});
7880

src/components/Attachment/Gallery.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const styles = StyleSheet.create({
8888
moreImagesContainer: {
8989
alignItems: 'center',
9090
justifyContent: 'center',
91+
margin: 1,
9192
},
9293
moreImagesText: { color: '#FFFFFF', fontSize: 26, fontWeight: '700' },
9394
});
@@ -201,7 +202,7 @@ const GalleryWithContext = <
201202
return returnArray;
202203
}, [] as { height: number | string; url: string }[][]);
203204

204-
const groupStyle = `${alignment}_${groupStyles[0].toLowerCase()}`;
205+
const groupStyle = `${alignment}_${groupStyles?.[0]?.toLowerCase?.()}`;
205206

206207
return (
207208
<View
@@ -265,6 +266,7 @@ const GalleryWithContext = <
265266
{
266267
borderBottomLeftRadius:
267268
(images.length === 1 ||
269+
(images.length === 2 && rowIndex === 0) ||
268270
(images.length === 3 &&
269271
colIndex === 0 &&
270272
rowIndex === 0) ||
@@ -294,7 +296,8 @@ const GalleryWithContext = <
294296
rowIndex === 0) ||
295297
(images.length === 3 &&
296298
colIndex === 0 &&
297-
rowIndex === 1)
299+
rowIndex === 1) ||
300+
(images.length === 2 && rowIndex === 1)
298301
? 14
299302
: 0,
300303
},

src/components/AttachmentPicker/components/AttachmentSelectionBar.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ export const AttachmentSelectionBar: React.FC = () => {
7575
{ height: attachmentSelectionBarHeight ?? 52 },
7676
]}
7777
>
78-
<TouchableOpacity onPress={() => setPicker('images')}>
78+
<TouchableOpacity
79+
hitSlop={{ bottom: 15, top: 15 }}
80+
onPress={() => setPicker('images')}
81+
>
7982
<View style={[styles.icon, icon]}>
8083
<ImageSelectorIcon
8184
numberOfImageUploads={imageUploads.length}
@@ -86,6 +89,7 @@ export const AttachmentSelectionBar: React.FC = () => {
8689
{hasFilePicker && (
8790
<TouchableOpacity
8891
disabled={imageUploads.length > 0}
92+
hitSlop={{ bottom: 15, top: 15 }}
8993
onPress={openFilePicker}
9094
>
9195
<View style={[styles.icon, icon]}>
@@ -96,7 +100,10 @@ export const AttachmentSelectionBar: React.FC = () => {
96100
</View>
97101
</TouchableOpacity>
98102
)}
99-
<TouchableOpacity onPress={takeAndUploadImage}>
103+
<TouchableOpacity
104+
hitSlop={{ bottom: 15, top: 15 }}
105+
onPress={takeAndUploadImage}
106+
>
100107
<View style={[styles.icon, icon]}>
101108
<CameraSelectorIcon
102109
numberOfImageUploads={imageUploads.length}

0 commit comments

Comments
 (0)