Repository navigation
Releases: phattran1201/react-native-thermal-printer
Release list
v1.2.0
[1.2.0]
π Bug Fixes
- Fixed image alignment on Android β
printImageandprintImageBase64were incorrectly passingimageHeightinto thealignparameter of the Java layer. Alignment was always ignored (defaulted to center). Now correctly passesopts.align ?? 'center'as a string.
β¨ New Features
-
New
Alignmenttype β AddedAlignment = '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). -
printColumnsTextnow accepts string alignment β ThecolumnAlignmentparameter now acceptsAlignment[](string) in addition to the legacyColumnAlignment[](enum). Both are supported simultaneously for backward compatibility.
β οΈ Deprecations
-
ColumnAlignmentenum is deprecated β Use the newAlignmentstring literal type instead.ColumnAlignmentwill 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:
printImageDataandprintImageBase64signature changed fromint align(magic number 0/1/2) toString 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.jsand.prettierrcfor 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
π 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 toRNBasePrinterModule.
Build & Configuration
- Updated
build.gradlewith explicit AndroidX support and Gradle plugin8.13.2. - Added
gradle.propertiesfor AndroidX migration flags. - Updated Gradle wrapper.
- Corrected package naming to
com.harold.rn.printeracross all Android files.
ποΈ Removed
BaseStreamPrinterAdapter.javaβ Merged into the newBasePrinterAdapterhierarchy.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