Skip to content

v1.2.0

Latest

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