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

Make numberOfLines optional #174

Merged
merged 3 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export interface SnackBarOptions {
text: string;

/**
* Number of text lines to display on the snackbar.
* Number of text lines to display on the snackbar.
* Default 2 lines are shown.
*/
numberOfLines: number;
numberOfLines?: number;

/**
* Length of time the Snackbar stays on screen.
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type SnackBarOptions = {
* Number of text lines to display on the snackbar.
* Default 2 lines are shown.
*/
numberOfLines: number,
numberOfLines?: number,

/**
* Length of time the Snackbar stays on screen.
Expand Down Expand Up @@ -107,7 +107,7 @@ const SnackBar: ISnackBar = {
warnDeprecation(options, 'color', 'textColor');

const text = options.text || options.title;
const { numberOfLines } = options;
const { numberOfLines = 2 } = options;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? It seems to default in the native code instead, perhaps we can leave this undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, it's unnecessary, handled on this line and this line

// eslint-disable-next-line no-param-reassign
delete options.title;
const textColorRaw = options.textColor || options.color;
Expand Down