Skip to content

Commit 271a670

Browse files
authored
Merge pull request #2956 from GetStream/develop
Next Release
2 parents 3c3483a + f8e37f3 commit 271a670

File tree

9 files changed

+68
-23
lines changed

9 files changed

+68
-23
lines changed

package/src/components/Attachment/Gallery.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,14 @@ const GalleryThumbnail = <
293293
theme: {
294294
colors: { overlay },
295295
messageSimple: {
296-
gallery: { image, imageBorderRadius, imageContainer, moreImagesContainer, moreImagesText },
296+
gallery: {
297+
image,
298+
imageBorderRadius,
299+
imageContainer,
300+
imageContainerStyle,
301+
moreImagesContainer,
302+
moreImagesText,
303+
},
297304
},
298305
},
299306
} = useTheme();
@@ -383,7 +390,7 @@ const GalleryThumbnail = <
383390
thumb_url={thumbnail.thumb_url}
384391
/>
385392
) : (
386-
<View style={styles.imageContainerStyle}>
393+
<View style={[styles.imageContainerStyle, imageContainerStyle]}>
387394
<GalleryImageThumbnail
388395
borderRadius={imageBorderRadius ?? borderRadius}
389396
ImageLoadingFailedIndicator={ImageLoadingFailedIndicator}

package/src/components/Message/Message.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ const MessageWithContext = <
229229
const [showMessageReactions, setShowMessageReactions] = useState(true);
230230
const [isBounceDialogOpen, setIsBounceDialogOpen] = useState(false);
231231
const [isEditedMessageOpen, setIsEditedMessageOpen] = useState(false);
232+
const [selectedReaction, setSelectedReaction] = useState<string | undefined>(undefined);
232233

233234
const {
234235
channel,
@@ -300,10 +301,11 @@ const MessageWithContext = <
300301
},
301302
} = useTheme();
302303

303-
const showMessageOverlay = async (showMessageReactions = false) => {
304+
const showMessageOverlay = async (showMessageReactions = false, selectedReaction?: string) => {
304305
await dismissKeyboard();
305306
setShowMessageReactions(showMessageReactions);
306307
setMessageOverlayVisible(true);
308+
setSelectedReaction(selectedReaction);
307309
};
308310

309311
const dismissOverlay = () => {
@@ -733,6 +735,7 @@ const MessageWithContext = <
733735
dismissOverlay={dismissOverlay}
734736
handleReaction={ownCapabilities.sendReaction ? handleReaction : undefined}
735737
messageActions={messageActions}
738+
selectedReaction={selectedReaction}
736739
showMessageReactions={showMessageReactions}
737740
visible={messageOverlayVisible}
738741
/>

package/src/components/Message/MessageSimple/ReactionList/ReactionListBottom.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const ReactionListBottomItem = <
9999
onLongPress({
100100
defaultHandler: () => {
101101
if (showMessageOverlay) {
102-
showMessageOverlay(true);
102+
showMessageOverlay(true, reaction.type);
103103
}
104104
},
105105
emitter: 'reactionList',

package/src/components/MessageMenu/MessageActionList.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
2-
import { StyleSheet, View } from 'react-native';
2+
import { StyleSheet } from 'react-native';
3+
4+
import { ScrollView } from 'react-native-gesture-handler';
35

46
import { MessageActionType } from './MessageActionListItem';
57

@@ -23,27 +25,32 @@ export const MessageActionList = (props: MessageActionListProps) => {
2325
const {
2426
theme: {
2527
messageMenu: {
26-
actionList: { container },
28+
actionList: { container, contentContainer },
2729
},
2830
},
2931
} = useTheme();
3032

3133
if (messageActions?.length === 0) return null;
3234

3335
return (
34-
<View accessibilityLabel='Message action list' style={[styles.container, container]}>
36+
<ScrollView
37+
accessibilityLabel='Message action list'
38+
contentContainerStyle={[styles.contentContainer, contentContainer]}
39+
style={[styles.container, container]}
40+
>
3541
{messageActions?.map((messageAction, index) => (
3642
<MessageActionListItem
3743
key={messageAction.title}
3844
{...{ ...messageAction, index, length: messageActions.length }}
3945
/>
4046
))}
41-
</View>
47+
</ScrollView>
4248
);
4349
};
4450

4551
const styles = StyleSheet.create({
46-
container: {
52+
container: {},
53+
contentContainer: {
4754
paddingHorizontal: 16,
4855
},
4956
});

package/src/components/MessageMenu/MessageMenu.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export type MessageMenuProps<
5252
* @returns
5353
*/
5454
handleReaction?: (reactionType: string) => Promise<void>;
55+
/**
56+
* The selected reaction
57+
*/
58+
selectedReaction?: string;
5559
};
5660

5761
export const MessageMenu = <
@@ -70,6 +74,7 @@ export const MessageMenu = <
7074
MessageUserReactions: propMessageUserReactions,
7175
MessageUserReactionsAvatar: propMessageUserReactionsAvatar,
7276
MessageUserReactionsItem: propMessageUserReactionsItem,
77+
selectedReaction,
7378
showMessageReactions,
7479
visible,
7580
} = props;
@@ -103,6 +108,7 @@ export const MessageMenu = <
103108
message={message}
104109
MessageUserReactionsAvatar={MessageUserReactionsAvatar}
105110
MessageUserReactionsItem={MessageUserReactionsItem}
111+
selectedReaction={selectedReaction}
106112
/>
107113
) : (
108114
<>

package/src/components/MessageMenu/MessageUserReactions.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useMemo } from 'react';
2-
import { FlatList, StyleSheet, Text, View } from 'react-native';
2+
import { StyleSheet, Text, View } from 'react-native';
3+
import { FlatList } from 'react-native-gesture-handler';
34

45
import { ReactionSortBase } from 'stream-chat';
56

@@ -29,6 +30,10 @@ export type MessageUserReactionsProps<
2930
* An array of reactions
3031
*/
3132
reactions?: Reaction[];
33+
/**
34+
* The selected reaction
35+
*/
36+
selectedReaction?: string;
3237
};
3338

3439
const sort: ReactionSortBase = {
@@ -56,11 +61,12 @@ export const MessageUserReactions = (props: MessageUserReactionsProps) => {
5661
MessageUserReactionsAvatar: propMessageUserReactionsAvatar,
5762
MessageUserReactionsItem: propMessageUserReactionsItem,
5863
reactions: propReactions,
64+
selectedReaction: propSelectedReaction,
5965
supportedReactions: propSupportedReactions,
6066
} = props;
6167
const reactionTypes = Object.keys(message?.reaction_groups ?? {});
6268
const [selectedReaction, setSelectedReaction] = React.useState<string | undefined>(
63-
reactionTypes[0],
69+
propSelectedReaction ?? reactionTypes[0],
6470
);
6571
const {
6672
MessageUserReactionsAvatar: contextMessageUserReactionsAvatar,
@@ -179,7 +185,9 @@ export const MessageUserReactions = (props: MessageUserReactionsProps) => {
179185
};
180186

181187
const styles = StyleSheet.create({
182-
container: {},
188+
container: {
189+
flex: 1,
190+
},
183191
contentContainer: {
184192
flexGrow: 1,
185193
justifyContent: 'space-around',

package/src/components/UIComponents/BottomSheetModal.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
4545
const { children, height = windowHeight / 2, onClose, visible } = props;
4646
const {
4747
theme: {
48-
bottomSheetModal: { container, contentContainer, handle, overlay: overlayTheme },
48+
bottomSheetModal: { container, contentContainer, handle, overlay: overlayTheme, wrapper },
4949
colors: { grey, overlay, white_snow },
5050
},
5151
} = useTheme();
@@ -119,11 +119,14 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
119119
});
120120

121121
return (
122-
<GestureHandlerRootView style={{ flex: 1 }}>
123-
<Modal animationType='fade' onRequestClose={handleDismiss} transparent visible={visible}>
124-
<TouchableWithoutFeedback onPress={handleDismiss}>
125-
<View style={[styles.overlay, { backgroundColor: overlay }, overlayTheme]}>
126-
<GestureDetector gesture={gesture}>
122+
<View style={[styles.wrapper, wrapper]}>
123+
<Modal onRequestClose={onClose} transparent visible={visible}>
124+
<GestureHandlerRootView style={{ flex: 1 }}>
125+
<GestureDetector gesture={gesture}>
126+
<View style={[styles.overlay, { backgroundColor: overlay }, overlayTheme]}>
127+
<TouchableWithoutFeedback onPress={onClose} style={{ flex: 1 }}>
128+
<View style={{ flex: 1 }} />
129+
</TouchableWithoutFeedback>
127130
<Animated.View
128131
style={[
129132
styles.container,
@@ -140,11 +143,11 @@ export const BottomSheetModal = (props: PropsWithChildren<BottomSheetModalProps>
140143
/>
141144
<View style={[styles.contentContainer, contentContainer]}>{children}</View>
142145
</Animated.View>
143-
</GestureDetector>
144-
</View>
145-
</TouchableWithoutFeedback>
146+
</View>
147+
</GestureDetector>
148+
</GestureHandlerRootView>
146149
</Modal>
147-
</GestureHandlerRootView>
150+
</View>
148151
);
149152
};
150153

@@ -171,4 +174,9 @@ const styles = StyleSheet.create({
171174
flex: 1,
172175
justifyContent: 'flex-end',
173176
},
177+
wrapper: {
178+
alignItems: 'center',
179+
flex: 1,
180+
justifyContent: 'center',
181+
},
174182
});

package/src/contexts/messageContext/MessageContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export type MessageContextValue<
9696
* @param showMessageReactions
9797
* @returns void
9898
*/
99-
showMessageOverlay: (showMessageReactions?: boolean) => void;
99+
showMessageOverlay: (showMessageReactions?: boolean, selectedReaction?: string) => void;
100100
showMessageStatus: boolean;
101101
/** Whether or not the Message is part of a Thread */
102102
threadList: boolean;

package/src/contexts/themeContext/utils/theme.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export type Theme = {
132132
contentContainer: ViewStyle;
133133
handle: ViewStyle;
134134
overlay: ViewStyle;
135+
wrapper: ViewStyle;
135136
};
136137
channel: {
137138
selectChannel: TextStyle;
@@ -442,6 +443,7 @@ export type Theme = {
442443
messageMenu: {
443444
actionList: {
444445
container: ViewStyle;
446+
contentContainer: ViewStyle;
445447
};
446448
actionListItem: {
447449
container: ViewStyle;
@@ -571,6 +573,7 @@ export type Theme = {
571573
gridWidth: number;
572574
image: ImageStyle;
573575
imageContainer: ViewStyle;
576+
imageContainerStyle: ViewStyle;
574577
maxHeight: number;
575578
maxWidth: number;
576579
minHeight: number;
@@ -891,6 +894,7 @@ export const defaultTheme: Theme = {
891894
contentContainer: {},
892895
handle: {},
893896
overlay: {},
897+
wrapper: {},
894898
},
895899
channel: {
896900
selectChannel: {},
@@ -1196,6 +1200,7 @@ export const defaultTheme: Theme = {
11961200
messageMenu: {
11971201
actionList: {
11981202
container: {},
1203+
contentContainer: {},
11991204
},
12001205
actionListItem: {
12011206
container: {},
@@ -1354,6 +1359,7 @@ export const defaultTheme: Theme = {
13541359
image: {},
13551360
imageBorderRadius: undefined,
13561361
imageContainer: {},
1362+
imageContainerStyle: {},
13571363
maxHeight: 300,
13581364
maxWidth: 256,
13591365
minHeight: 100,

0 commit comments

Comments
 (0)