HeligPfleigh / react-native-thermal-receipt-printer

A RN library for thermal printer
157 stars 102 forks source link

TypeError: Cannot read property 'NetPrinter' of undefined, js engine: hermes , #130

Open tranvanthien123 opened 1 year ago

tranvanthien123 commented 1 year ago

I have a problem with the library on iOS with NetPrinter even though I have configured it according to the library and after the operation I get the error again Error: Requiring module "node_modules/react-native-thermal-receipt-printer/dist/index.js", which threw an exception: Invariant Violation: new NativeEventEmitter() requires a non-null argument., js engine: hermes WARN [TypeError: Cannot read property 'NetPrinter' of undefined code : import { ActivityIndicator, Button, StyleSheet, Text, View } from 'react-native' import React, { useState } from 'react' import { BLEPrinter, NetPrinter, USBPrinter,

} from "react-native-thermal-receipt-printer"; import { LogBox } from 'react-native'; LogBox.ignoreLogs(['new NativeEventEmitter']); LogBox.ignoreAllLogs(); const App = () => { const [Loadding, setLoadding] = useState(false) const handlePrint = async () => { setLoadding(true) try { await NetPrinter.init() await NetPrinter.connectPrinter( "192.168.1.122", 9100, ) NetPrinter.printBill(

DELTA POSDELTA POS ) setLoadding(false) } catch (err) { setLoadding(false) console.warn(err); } }; return ( Select printer type: { Loadding ? : '' } ) } export default App