Skip to content

Commit

Permalink
fix: set number of lines to 1 in Card.Title (#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaulz authored and Trancever committed Feb 11, 2019
1 parent 13d51c0 commit b4490cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/src/Examples/CardExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CardExample extends React.Component<Props> {
</Card>
<Card style={styles.card}>
<Card.Title
title="Berries"
title="Berries that are trimmed at the end"
subtitle="Omega Ruby"
left={props => <Avatar.Icon {...props} icon="folder" />}
right={props => (
Expand Down
18 changes: 15 additions & 3 deletions src/components/Card/CardTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,20 @@ class CardTitle extends React.Component<Props> {

<View style={[styles.titles]}>
{title ? (
<Title style={[{ marginBottom: subtitle ? 0 : 2 }, titleStyle]}>
<Title
style={[
styles.title,
{ marginBottom: subtitle ? 0 : 2 },
titleStyle,
]}
numberOfLines={1}
>
{title}
</Title>
) : null}

{subtitle ? (
<Caption style={[styles.subtitle, subtitleStyle]}>
<Caption style={[styles.subtitle, subtitleStyle]} numberOfLines={1}>
{subtitle}
</Caption>
) : null}
Expand Down Expand Up @@ -142,10 +149,15 @@ const styles = StyleSheet.create({
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
height: 40,
height: 50,
},

title: {
minHeight: 30,
},

subtitle: {
minHeight: 20,
marginVertical: 0,
},
});
Expand Down

0 comments on commit b4490cf

Please sign in to comment.