Skip to content

Releases: phattran1201/react-native-thermal-printer

v1.2.0

Choose a tag to compare

@phattran1201 phattran1201 released this 04 Mar 02:53

[1.2.0]

πŸ› Bug Fixes

  • Fixed image alignment on Android β€” printImage and printImageBase64 were incorrectly passing imageHeight into the align parameter of the Java layer. Alignment was always ignored (defaulted to center). Now correctly passes opts.align ?? 'center' as a string.

✨ New Features

  • New Alignment type β€” Added Alignment = 'left' | 'center' | 'right' string literal type as the recommended way to specify alignment. Works for both image printing (PrinterImageOptions.align) and column printing (IPrintExpandColumn.columnAlignment).

  • printColumnsText now accepts string alignment β€” The columnAlignment parameter now accepts Alignment[] (string) in addition to the legacy ColumnAlignment[] (enum). Both are supported simultaneously for backward compatibility.

⚠️ Deprecations

  • ColumnAlignment enum is deprecated β€” Use the new Alignment string literal type instead. ColumnAlignment will be removed in a future major version.

    // Before (deprecated)
    import { ColumnAlignment } from '@haroldtran/react-native-thermal-printer';
    columnAlignment: [ColumnAlignment.LEFT, ColumnAlignment.CENTER, ColumnAlignment.RIGHT]
    
    // After βœ…
    columnAlignment: ['left', 'center', 'right']

πŸ”§ Internal / Android

  • Java layer: printImageData and printImageBase64 signature changed from int align (magic number 0/1/2) to String align ("left" / "center" / "right") across all modules (RNUSBPrinterModule, RNBLEPrinterModule, RNNetPrinterModule, RNBasePrinterModule, BasePrinterAdapter, PrinterAdapter, RNPrinterModule).
  • BasePrinterAdapter.getAlignCommand() now uses readable string comparison instead of magic integer checks.

πŸ› οΈ Code Quality

  • Added .eslintrc.js and .prettierrc for consistent code style enforcement.
  • Formatted all TypeScript source files to use single quotes, 120-char line width, and trailing commas (per Prettier config).

Full Changelog: v1.1.0...v1.2.0

v1.1.0

Choose a tag to compare

@phattran1201 phattran1201 released this 27 Feb 10:10

πŸš€ v1.1.0 β€” Android Refactor: Unified Printer Adapter Architecture

Released: 2026-02-27

πŸ”§ Refactoring (Android)

This release is a major internal refactor of the Android layer, consolidating duplicated logic across BLE, Network, and USB printers into a clean, unified adapter hierarchy.

New Classes

  • BasePrinterAdapter β€” Base class for all printer adapters, centralizing shared logic for image processing and base64 decoding.
  • RNBasePrinterModule β€” Common React Native bridge logic extracted and shared across all printer modules.

Refactored

  • BLEPrinterAdapter, NetPrinterAdapter, USBPrinterAdapter β€” Now extend the unified base classes, eliminating code duplication.
  • RNBLEPrinterModule, RNNetPrinterModule, RNUSBPrinterModule β€” Slimmed down and delegating shared logic to RNBasePrinterModule.

Build & Configuration

  • Updated build.gradle with explicit AndroidX support and Gradle plugin 8.13.2.
  • Added gradle.properties for AndroidX migration flags.
  • Updated Gradle wrapper.
  • Corrected package naming to com.harold.rn.printer across all Android files.

πŸ—‘οΈ Removed

  • BaseStreamPrinterAdapter.java β€” Merged into the new BasePrinterAdapter hierarchy.
  • ExampleInstrumentedTest.java / ExampleUnitTest.java β€” Removed stale boilerplate test files.

⚠️ Notes

  • No public API changes β€” this is a refactor with no functional breaking changes for JS/TS consumers.
  • Improves reliability with better automatic reconnect logic in the base adapter.

Full Changelog: v1.0.20...v1.1.0

v1.0.20

Choose a tag to compare

@phattran1201 phattran1201 released this 27 Feb 10:04

Full Changelog: v1.0.19...v1.0.20

v1.0.17

Choose a tag to compare

@phattran1201 phattran1201 released this 04 Dec 09:20

Full Changelog: v1.0.14...v1.0.17