Skip to content

Commit

Permalink
feat: add numberOfLines prop to DataTableTitle (#863)
Browse files Browse the repository at this point in the history
Closes #848
  • Loading branch information
Taym95 authored and satya164 committed Feb 22, 2019
1 parent 8afb7d6 commit f9a0949
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/DataTable/DataTableTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ type Props = React.ElementConfig<typeof TouchableWithoutFeedback> & {|
* Direction of sorting. An arrow indicating the direction is displayed when this is given.
*/
sortDirection?: 'ascending' | 'descending',
/**
* The number of lines to show.
*/
numberOfLines?: number,
/**
* Function to execute on press.
*/
Expand All @@ -44,6 +48,10 @@ type State = {
class DataTableTitle extends React.Component<Props, State> {
static displayName = 'DataTable.Title';

static defaultProps = {
numberOfLines: 1,
};

state = {
spinAnim: new Animated.Value(
this.props.sortDirection === 'ascending' ? 0 : 1
Expand All @@ -70,6 +78,7 @@ class DataTableTitle extends React.Component<Props, State> {
sortDirection,
theme,
style,
numberOfLines,
...rest
} = this.props;

Expand Down Expand Up @@ -99,7 +108,7 @@ class DataTableTitle extends React.Component<Props, State> {
styles.cell,
sortDirection ? styles.sorted : { color: textColor },
]}
numberOfLines={1}
numberOfLines={numberOfLines}
>
{children}
</Text>
Expand Down

0 comments on commit f9a0949

Please sign in to comment.