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 "pageStyle" prop may also be a function #198

Closed
wants to merge 1 commit into from

Conversation

sergeyshmakov
Copy link
Contributor

In some cases we need to calculate pageStyle "just before" the print.
Because of this we need to pass this prop like a function.

In some cases we need to calculate pageStyle "just before" the print.
Because of this we need to pass this prop like a function.
Copy link
Owner

@MatthewHerbst MatthewHerbst left a comment

Choose a reason for hiding this comment

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

Sorry for the delayed review. Could you please add an example of when this would be used? Otherwise looks good

@@ -144,7 +144,7 @@ The component accepts the following props (note: `?` denotes an optional prop):
| **`onAfterPrint`** | `function?` | Callback function that triggers after print |
| **`onPrintError`** | `function(errorLocation: string, error: Error)?` | Callback function that will be called if there is a printing error serious enough that printing cannot continue. Currently limited to Promise rejections in `onBeforeGetContent` or `onBeforePrint`. Use this to attempt to print again. `errorLocation` will tell you in which callback the Promise was rejected. |
| **`removeAfterPrint`** | `boolean?` | Remove the print iframe after action. Defaults to `false`. |
| **`pageStyle`** | `string?` | Override default print window styling |
| **`pageStyle`** | `string?`, `function?` | Override default print window styling. If `function` then calling in runtime just before the print. |
Copy link
Owner

Choose a reason for hiding this comment

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

Should be string?|function?

@sergeyshmakov
Copy link
Contributor Author

@MatthewHerbst Thanks for review. I will provide all changes in few days.

@MatthewHerbst
Copy link
Owner

@sergeyshmakov I realize we never got this in. Did you want to add an example and then we can merge it?

@MatthewHerbst
Copy link
Owner

Going to include this in #239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants