Surile / react-native-sunmi-printer

商米内置打印机
MIT License
47 stars 33 forks source link

SunmiPrinter is importing as a null #21

Closed Dinozar1 closed 1 year ago

Dinozar1 commented 1 year ago

Hello 👋 I'm trying to use @heasy/react-native-sunmi-printer libary to print in sunmi v2 terminal.

I'm using: React 18.0.0 React Native 0.69.6 expo ~46.0.16

I'm testing it on example/src/App.tsx on your repo, but I'm getting errors like this one: TypeError: null is not an object (evaluating '_reactNativeSunmiPrinter.default.printerText')

If I try to console.log SunmiPrinter it returns null.

This is the import on the example:

import SunmiPrinter, {
  AlignValue,
  SunmiScan,
} from '@heasy/react-native-sunmi-printer';

I didn't link anything because on the readme there is written that: Automatic linking is supported for all platforms (even windows on React native >= 0.63!)

The types are loading correctly but if I try use anything from SunmiPrinter it throws an error. Please tell me if am I doing something wrong I really need to get this working.

I will really appreciate any help 🥺

Surile commented 1 year ago

expo is not recommended。Please see if you want to use it #10

Dinozar1 commented 1 year ago

Thanks for the answer!

I tried printing on react native without expo and it's working fine. I must rewrite my entire app to plain react native but at least I don't get fired 😁

Thanks for help!