Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-to-print

Package Overview
Dependencies
Maintainers
2
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-to-print - npm Package Versions

23
10

3.0.3

Diff

Changelog

Source

3.0.3 (December 22th, 2024)

  • FIX 764 Ensure onAfterPrint is called, and print iframe is removed, after the print preview dialog has closed. Previously these would happen when the afterprint event was received which, as noted in the README, may occur immediately in some browsers, rather than when the print preview dialog closes. Thanks sensasi-delight
  • FIX 768 React 19 made a small change to the typing for Refs which requires explicitly handling null/undefined initial types
  • CHORE: Minor code cleanup and comments
  • CHORE: Updated devDependencies to latest, including now using React 19 for our examples
  • DOCS: README updates, including a link to using the lazy method of providing content

Beta Versions

  • 3.0.3-beta-1 (16th Dec 2024)
herbstmb
published 3.0.3-beta-1 •

Changelog

Source

3.0.3-beta-1 (December 16th, 2024)

This is a beta release. Please report any issues in the issue below, thank you!

  • FIX 764 Ensure onAfterPrint is called, and print iframe is removed, after the print preview dialog has closed. Previously these would happen when the afterprint event was received which, as noted in the README, may occur immediately in some browsers, rather than when the print preview dialog closes. Thanks sensasi-delight
herbstmb
published 3.0.2 •

Changelog

Source

3.0.2 (October 17th, 2024)

  • FIX 751 Ensure selected <select> option printed. Currently the first option is printed regardless of selection state
  • FIX 753 Fix incorrect ESLint config reference to tsconfig file
herbstmb
published 3.0.1 •

Changelog

Source

3.0.1 (September 30th, 2024)

  • FIX 743 Allow passing the function returned from useReactToPrint directly to event handlers (this is primarily geared at non-typescript users who are not aware of the new v3 API that prefers the function be wrapped, by changing onClick={printFn} to onClick={() => printFn()})
herbstmb
published 3.0.0 •

Changelog

Source

3.0.0 (September 28th, 2024)

v3.0.0 brings API modernization, React 19 support, a smaller package size, Shadow DOM support, and improved error handling.

BREAKING CHANGES

  • content renamed to contentRef and type changed from () => React.ReactInstance to RefObject<Element | Text>. The core impact here is that Class components now need to have the ref forwarded via props internally to a DOM node
  • React >= 16.8.0 required (dropped support for React versions that don't support hooks)
  • onBeforeGetContent removed. Use onBeforePrint, which similar to onBeforeGetContent, now runs before the print iframe is loaded
  • removeAfterPrint renamed to preserveAfterPrint which defaults to false
  • ReactToPrint removed. Use useReactToPrint
  • PrintContextConsumer removed. Use useReactToPrint
  • trigger removed, use the function returned by useReactToPrint
  • IReactToPrintProps renamed to UseReactToPrintOptions
  • Default package export removed, use named useReactToPrint export
  • Removed event?: unknown type from useReactToPrint callback. optionalContent is now the only (optional) argument
  • Build is now ES6 code. Previously it was ES5
  • No longer supporting IE11

New

  • FEATURE 717: React 19 support + API modernization
  • FEATURE 707: Improved error handling when canvas elements have not properly loaded
  • FEATURE 723: Add new option, copyShadowRoots, to support copying ShadowRoots. Thanks boehlke
  • CHORE: package size reduced by 18.7kb (34%)
  • CHORE: dev dependencies updated

Beta Versions

  • 3.0.0-beta-3 (19 Aug 2024)
  • 3.0.0-beta-2 (19 Aug 2024)
  • 3.0.0-beta-1 (15 Jul 2024)
herbstmb
published 3.0.0-beta-3 •

herbstmb
published 3.0.0-beta-2 •

herbstmb
published 3.0.0-beta-1 •

herbstmb
published 2.15.1 •

Changelog

Source

2.15.1 (February 13th, 2024)

  • FIX 686 A breaking type error was mistakenly introduced as part of 652. This has been fixed.
herbstmb
published 2.15.0 •

Changelog

Source

2.15.0 (February 11th, 2024)

  • FEATURE 652: When using the useReactToPrint hook it is now possible to pass the returned callback the content ref at call time, rather than needing to pass it to the hook directly. This allows for generating the content to be printed closer to when the print occurs. Thanks isocroft
  • DEPENDENCIES: Upgraded all devDependencies to their latest versions
  • CHORE: broke up the single file in the repo, started organizing things a bit
23
10
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc