Skip to content

Commit 01f7b80

Browse files
authored
feat: long message ctx menu (#3451)
## 🎯 Goal This PR implements the new design for very long messages in the context menu. Short summary: - Scrollability is removed - Layout is changed to always visible top/bottom items - Layout calculations have been adjusted to fit the frame here ## 🛠 Implementation details <!-- Provide a description of the implementation --> ## 🎨 UI Changes <!-- Add relevant screenshots --> <details> <summary>iOS</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <details> <summary>Android</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> ## 🧪 Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## ☑️ Checklist - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [ ] PR targets the `develop` branch - [ ] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [ ] Expo iOS and Android
1 parent f11ce3e commit 01f7b80

File tree

4 files changed

+139
-188
lines changed

4 files changed

+139
-188
lines changed

package/src/components/MessageInput/__tests__/__snapshots__/AttachButton.test.js.snap

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -787,19 +787,15 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
787787
}
788788
>
789789
<View
790+
pointerEvents="box-none"
790791
style={
791-
[
792-
{
793-
"height": 0,
794-
},
795-
{
796-
"transform": [
797-
{
798-
"translateY": 0,
799-
},
800-
],
801-
},
802-
]
792+
{
793+
"bottom": 0,
794+
"left": 0,
795+
"position": "absolute",
796+
"right": 0,
797+
"top": 0,
798+
}
803799
}
804800
>
805801
<View
@@ -1708,19 +1704,15 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
17081704
}
17091705
>
17101706
<View
1707+
pointerEvents="box-none"
17111708
style={
1712-
[
1713-
{
1714-
"height": 0,
1715-
},
1716-
{
1717-
"transform": [
1718-
{
1719-
"translateY": 0,
1720-
},
1721-
],
1722-
},
1723-
]
1709+
{
1710+
"bottom": 0,
1711+
"left": 0,
1712+
"position": "absolute",
1713+
"right": 0,
1714+
"top": 0,
1715+
}
17241716
}
17251717
>
17261718
<View
@@ -2629,19 +2621,15 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
26292621
}
26302622
>
26312623
<View
2624+
pointerEvents="box-none"
26322625
style={
2633-
[
2634-
{
2635-
"height": 0,
2636-
},
2637-
{
2638-
"transform": [
2639-
{
2640-
"translateY": 0,
2641-
},
2642-
],
2643-
},
2644-
]
2626+
{
2627+
"bottom": 0,
2628+
"left": 0,
2629+
"position": "absolute",
2630+
"right": 0,
2631+
"top": 0,
2632+
}
26452633
}
26462634
>
26472635
<View

package/src/components/MessageInput/__tests__/__snapshots__/SendButton.test.js.snap

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -785,19 +785,15 @@ exports[`SendButton should render a SendButton 1`] = `
785785
}
786786
>
787787
<View
788+
pointerEvents="box-none"
788789
style={
789-
[
790-
{
791-
"height": 0,
792-
},
793-
{
794-
"transform": [
795-
{
796-
"translateY": 0,
797-
},
798-
],
799-
},
800-
]
790+
{
791+
"bottom": 0,
792+
"left": 0,
793+
"position": "absolute",
794+
"right": 0,
795+
"top": 0,
796+
}
801797
}
802798
>
803799
<View
@@ -1704,19 +1700,15 @@ exports[`SendButton should render a disabled SendButton 1`] = `
17041700
}
17051701
>
17061702
<View
1703+
pointerEvents="box-none"
17071704
style={
1708-
[
1709-
{
1710-
"height": 0,
1711-
},
1712-
{
1713-
"transform": [
1714-
{
1715-
"translateY": 0,
1716-
},
1717-
],
1718-
},
1719-
]
1705+
{
1706+
"bottom": 0,
1707+
"left": 0,
1708+
"position": "absolute",
1709+
"right": 0,
1710+
"top": 0,
1711+
}
17201712
}
17211713
>
17221714
<View

package/src/components/MessageMenu/MessageActionListItem.tsx

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useMemo } from 'react';
22
import { StyleProp, StyleSheet, Text, TextStyle, View } from 'react-native';
33

44
import { Pressable } from 'react-native-gesture-handler';
@@ -63,12 +63,12 @@ export const MessageActionListItem = (props: MessageActionListItemProps) => {
6363
const {
6464
theme: {
6565
semantics,
66-
colors: { black },
6766
messageMenu: {
6867
actionListItem: { container, icon: iconTheme, title: titleTheme },
6968
},
7069
},
7170
} = useTheme();
71+
const styles = useStyles();
7272

7373
const onActionPress = useStableCallback(() => {
7474
closeOverlay();
@@ -88,23 +88,36 @@ export const MessageActionListItem = (props: MessageActionListItemProps) => {
8888
style={[styles.container, container]}
8989
>
9090
<View style={iconTheme}>{icon}</View>
91-
<Text style={[styles.titleStyle, { color: black }, titleStyle, titleTheme]}>{title}</Text>
91+
<Text style={[styles.titleStyle, titleStyle, titleTheme]}>{title}</Text>
9292
</View>
9393
</Pressable>
9494
);
9595
};
9696

97-
const styles = StyleSheet.create({
98-
buttonContainer: {
99-
borderRadius: primitives.radiusLg,
100-
},
101-
container: {
102-
alignItems: 'center',
103-
flexDirection: 'row',
104-
justifyContent: 'flex-start',
105-
padding: primitives.spacingXs,
106-
},
107-
titleStyle: {
108-
paddingLeft: primitives.spacingXs,
109-
},
110-
});
97+
const useStyles = () => {
98+
const {
99+
theme: { semantics },
100+
} = useTheme();
101+
return useMemo(
102+
() =>
103+
StyleSheet.create({
104+
buttonContainer: {
105+
borderRadius: primitives.radiusLg,
106+
},
107+
container: {
108+
alignItems: 'center',
109+
flexDirection: 'row',
110+
justifyContent: 'flex-start',
111+
padding: primitives.spacingXs,
112+
},
113+
titleStyle: {
114+
paddingLeft: primitives.spacingXs,
115+
fontWeight: primitives.typographyFontWeightMedium,
116+
fontSize: primitives.typographyFontSizeMd,
117+
lineHeight: primitives.typographyLineHeightNormal,
118+
color: semantics.textPrimary,
119+
},
120+
}),
121+
[semantics.textPrimary],
122+
);
123+
};

0 commit comments

Comments
 (0)