Skip to content

Commit

Permalink
feat: customize message padding (#2202)
Browse files Browse the repository at this point in the history
* feat: customize message padding

* chore: revert back to normal default

* chore: update snapshot
  • Loading branch information
aharwood9 authored Sep 2, 2023
1 parent 2b912c5 commit b2f3708
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
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 @@ -841,6 +842,7 @@ export const defaultTheme: Theme = {
text: {},
},
listContainer: {},
messageContainer: {},
messageSystem: {
container: {},
dateText: {},
Expand Down

0 comments on commit b2f3708

Please sign in to comment.