Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: customize message padding #2202

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions package/src/components/MessageList/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ const styles = StyleSheet.create({
flex: 1,
width: '100%',
},
messagePadding: {
paddingHorizontal: 8,
},
stickyHeader: {
position: 'absolute',
top: 0,
Expand Down Expand Up @@ -292,7 +289,8 @@ const MessageListWithContext = <

const {
colors: { white_snow },
messageList: { container, contentContainer, listContainer },
messageList: { container, contentContainer, listContainer, messageContainer },
screenPadding,
} = theme;

const modifiedTheme = useMemo(
Expand Down Expand Up @@ -562,7 +560,10 @@ const MessageListWithContext = <
return (
<>
<View testID={`message-list-item-${index}`}>
<MessageSystem message={message} style={styles.messagePadding} />
<MessageSystem
message={message}
style={[{ paddingHorizontal: screenPadding }, messageContainer]}
/>
</View>
{insertInlineUnreadIndicator && <InlineUnreadIndicator />}
</>
Expand All @@ -587,7 +588,7 @@ const MessageListWithContext = <
message={message}
onThreadSelect={onThreadSelect}
showUnreadUnderlay={showUnreadUnderlay}
style={styles.messagePadding}
style={[{ paddingHorizontal: screenPadding }, messageContainer]}
threadList={threadList}
/>
</View>
Expand Down Expand Up @@ -618,7 +619,7 @@ const MessageListWithContext = <
message={message}
onThreadSelect={onThreadSelect}
showUnreadUnderlay={showUnreadUnderlay}
style={styles.messagePadding}
style={[{ paddingHorizontal: screenPadding }, messageContainer]}
threadList={threadList}
/>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,12 @@ exports[`Thread should match thread snapshot 1`] = `
<View
style={
Array [
Object {
"paddingHorizontal": 8,
},
Array [
Object {
"paddingHorizontal": 8,
},
Object {},
],
Object {
"backgroundColor": undefined,
},
Expand Down Expand Up @@ -497,9 +500,12 @@ exports[`Thread should match thread snapshot 1`] = `
<View
style={
Array [
Object {
"paddingHorizontal": 8,
},
Array [
Object {
"paddingHorizontal": 8,
},
Object {},
],
Object {
"backgroundColor": undefined,
},
Expand Down Expand Up @@ -746,9 +752,12 @@ exports[`Thread should match thread snapshot 1`] = `
<View
style={
Array [
Object {
"paddingHorizontal": 8,
},
Array [
Object {
"paddingHorizontal": 8,
},
Object {},
],
Object {
"backgroundColor": undefined,
},
Expand Down
2 changes: 2 additions & 0 deletions package/src/contexts/themeContext/utils/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ export type Theme = {
text: TextStyle;
};
listContainer: ViewStyle;
messageContainer: ViewStyle;
messageSystem: {
container: ViewStyle;
dateText: TextStyle;
Expand Down Expand Up @@ -840,6 +841,7 @@ export const defaultTheme: Theme = {
text: {},
},
listContainer: {},
messageContainer: {},
messageSystem: {
container: {},
dateText: {},
Expand Down
Loading