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

fix: Add style prop to Bullet component #2008

Merged
Merged
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
16 changes: 11 additions & 5 deletions package/src/components/Message/MessageSimple/utils/renderText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ export const ListOutput = ({ node, output, state, styles }: ListOutputProps) =>
if (item === null) {
return (
<ListRow key={index} style={styles?.listRow} testID='list-item'>
<Bullet index={node.ordered && indexAfterStart} />
<Bullet
index={node.ordered && indexAfterStart}
style={node.ordered ? styles?.listItemNumber : styles?.listItemBullet}
/>
</ListRow>
);
}
Expand All @@ -338,7 +341,10 @@ export const ListOutput = ({ node, output, state, styles }: ListOutputProps) =>

return (
<ListRow key={index} style={styles?.listRow} testID='list-item'>
<Bullet index={node.ordered && indexAfterStart} />
<Bullet
index={node.ordered && indexAfterStart}
style={node.ordered ? styles?.listItemNumber : styles?.listItemBullet}
/>
<ListItem key={1} style={[styles?.listItemText, style]}>
{output(item, state)}
</ListItem>
Expand All @@ -354,13 +360,13 @@ interface BulletProps extends TextProps {
}

const Bullet = ({ index, style }: BulletProps) => (
<Text key={0} style={[style, defaultMarkdownStyles.listItemNumber]}>
santhoshvai marked this conversation as resolved.
Show resolved Hide resolved
<Text key={0} style={style}>
{index ? `${index}. ` : '\u2022 '}
</Text>
);

const ListRow = (props: PropsWithChildren<ViewProps>) => (
<Text style={[props.style, defaultMarkdownStyles.listRow]}>{props.children}</Text>
santhoshvai marked this conversation as resolved.
Show resolved Hide resolved
const ListRow = ({ children, style }: PropsWithChildren<ViewProps>) => (
<Text style={style}>{children}</Text>
);

const ListItem = ({ children, style }: PropsWithChildren<TextProps>) => (
Expand Down