npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lab-pdf-view-react-native

v0.3.2

Published

Lab report layout engine — renders a report JSON/template into React elements (web/Electron) or a static HTML string (React Native via WebView/expo-print).

Readme

lab-pdf-view-react-native

Renders a lab report (header/footer/watermark images + a printTemplateDesign JSON layout + patient data/table_data) into a printable output. Same report engine, two output modes:

  • Web / Electron — the original React components (ReportPrintMapper, PageRender, block renderers) rendered directly in the DOM, exactly as kiosk-frontend-app does today.
  • React NativerenderReportHtml(props) runs the same components through react-test-renderer and serializes the resulting element tree to an HTML string. react-dom/server was tried first, but its browser build assumes browser/Node globals (MessageChannel among them) that Hermes/JSC don't provide; react-test-renderer has no host-environment dependencies by design, so it runs the same way in Hermes as anywhere else. Feed the resulting HTML string to a WebView for preview or straight to a native print API.

Install

npm install lab-pdf-view-react-native

For the React Native helpers (./native subpath) also install:

npm install react-native-webview expo-print react-test-renderer

Usage — Web / Electron (same as before)

import { ReportPrintMapper } from "lab-pdf-view-react-native";

<ReportPrintMapper
  ref={componentRef}
  headerImage={organization.header}
  footerImage={organization.footer}
  watermark={organization.watermark}
  data={{ ...header_data, ...footer_data, ...report_footers }}
  table_data={table_data}
  signatures={report_footers}
  printTemplateDesign={report_templates}
/>;

Print it with react-to-print (browser) or by reading componentRef.current.innerHTML and sending it to Electron's silent print IPC — nothing changes from the current app.

Usage — React Native

import { ReportWebView, printReport } from "lab-pdf-view-react-native/native";

<ReportWebView
  style={{ flex: 1 }}
  headerImage={organization.header}
  footerImage={organization.footer}
  watermark={organization.watermark}
  data={{ ...header_data, ...footer_data, ...report_footers }}
  table_data={table_data}
  signatures={report_footers}
  printTemplateDesign={report_templates}
/>;

await printReport({
  data,
  table_data,
  signatures,
  printTemplateDesign,
  headerImage,
  footerImage,
  watermark,
});

Both take the exact same JSON payload your API already returns for lab report printing — no reshaping needed between platforms.

Why HTML string instead of native View/Text?

The report layout is pixel-precise: absolute-positioned blocks, HTML <table> pagination, and @page/@media print CSS. React Native's Yoga layout engine has no equivalent for tables or CSS print pagination, so rebuilding every block as native components would mean re-deriving that layout logic and losing exact fidelity with the designed templates. Reusing the existing components and only changing the output target (DOM vs. HTML string) keeps both platforms byte-for-byte consistent with zero duplicated layout logic.

What's intentionally not in this package

ck-editor/* and the Ant Design editor form (AntFormItem.tsx) from the original LabPrintSetup module were template authoring tools, not part of the render/print path — this package only covers rendering an already-designed printTemplateDesign.

Scripts

  • npm run build — bundles src/index.ts and src/native.tsx with tsup (ESM + CJS + .d.ts).
  • npm run typechecktsc --noEmit.