Skip to content

feat: React Native 0.79 compatibility and New Architecture support#4

Open
scantarbian wants to merge 9 commits intomainfrom
feat/update-versions
Open

feat: React Native 0.79 compatibility and New Architecture support#4
scantarbian wants to merge 9 commits intomainfrom
feat/update-versions

Conversation

@scantarbian
Copy link
Collaborator

Summary

  • Upgrade example app to React Native 0.79.5
  • Add TurboModule support for React Native New Architecture
  • Update Android dependencies and SDK versions (compileSdk 35, targetSdk 35)
  • Fix Base64 encoding with NO_WRAP flag for consistent handling
  • Fix RN 0.79 runtime compatibility issues
  • Update Gradle to 8.11.1

Changes

New Architecture (TurboModules)

  • Add NativeSunmiExternalPrinter.ts TurboModule spec
  • Update Kotlin module to extend NativeSunmiExternalPrinterSpec
  • Add override modifiers to all spec-defined methods
  • Add oldarch fallback for backward compatibility

Android Updates

  • Update Android Gradle Plugin to 8.9.1
  • Update Kotlin to 2.0.21
  • Update compileSdk/targetSdk to 35
  • Convert MainActivity and MainApplication to Kotlin

Bug Fixes

  • Use Base64.NO_WRAP for consistent base64 encoding
  • Fix ipAddress/port state variables in example app

Test plan

  • Build example app with newArchEnabled=true
  • Build example app with newArchEnabled=false
  • Test TCP/IP printing
  • Test Bluetooth printing
  • Test USB printing

🤖 Generated with Claude Code

scantarbian and others added 9 commits December 1, 2025 15:39
- ESCPOS-ThermalPrinter-Android: 3.2.0 → 3.4.0
- androidx.core:core: 1.7.0 → 1.17.0
- espresso-core: 3.2.0 → 3.5.1
- html2bitmap: 1.9 → 1.10
- kotlinx-coroutines-android: 1.3.9 → 1.7.3
- Kotlin: 1.7.0 → 1.8.22
- compileSdkVersion: 31 → 35
- targetSdkVersion: 31 → 35
- minSdkVersion: 21 → 28

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Upgrade React Native 0.71.6 → 0.79.5
- Upgrade React 18.2.0 → 19.0.0
- Update AGP 7.3.1 → 8.9.1
- Update Gradle 7.5.1 → 8.11.1
- Update compileSdkVersion 33 → 36
- Update targetSdkVersion 33 → 35
- Update minSdkVersion 21 → 28
- Update Kotlin 1.7.0 → 2.0.21
- Add @react-native-community/cli dependencies
- Update build.gradle and settings.gradle for RN 0.79 structure
- Enable New Architecture (newArchEnabled=true)
- Update library devDependencies for RN 0.79 compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Library changes:
- Update build.gradle for AGP 8.9.1, Java 17, namespace support
- Update Kotlin version 1.8.22 → 2.0.21
- Add codegenConfig to package.json for New Architecture
- Add TurboModule spec file (NativeSunmiExternalPrinter.ts)
- Update index.tsx to support TurboModule when available

Example app changes:
- Convert MainApplication.java to MainApplication.kt (RN 0.79 style)
- Remove deprecated Flipper integration
- Add autolinkLibrariesWithApp() to app/build.gradle
- Simplify app/build.gradle react block

Note: Currently builds with newArchEnabled=false. Full New Architecture
support requires additional codegen setup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add network_security_config.xml to allow cleartext traffic to localhost
  (fixes "CLEARTEXT communication to localhost not permitted" error)
- Update AndroidManifest.xml with networkSecurityConfig and usesCleartextTraffic
- Convert MainActivity.java to MainActivity.kt for RN 0.79 compatibility
- Fix MainApplication.kt to use OpenSourceMergedSoMapping for SoLoader
  (fixes "libreact_featureflagsjni.so not found" crash)
- Update babel.config.js to use @react-native/babel-preset (replaces metro-react-native-babel-preset)
- Update metro.config.js to extend @react-native/metro-config
- Update react-native.config.js with project paths for interactive mode

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Change all Base64.decode calls to use NO_WRAP flag for better
  compatibility with single-line base64 strings (modern standard)
- Change convertHTMLtoBase64 encoding to use NO_WRAP for cleaner output
- Fixes "bad base-64" error when printing images from external sources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…button

Previously the "Print with Raster Bit Wrapper" button had hardcoded
IP address and port values instead of using the state variables.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Implement TurboModule spec with codegen for New Architecture compatibility:
- Add override modifiers to all spec-defined methods in Kotlin module
- Change convertHTMLtoBase64 width parameter from Int to Double for codegen
- Add oldarch fallback for backward compatibility with Old Architecture
- Enable newArchEnabled=true in example app for testing
- Update Gradle wrapper to 8.11.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant