AllInOneYT / react-native-thermal-printer

MIT License
102 stars 53 forks source link

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

Closed tranvanthien123 closed 2 years ago

tranvanthien123 commented 2 years ago

i have problem with library on iOS even though i have configured according to library and after operation i get error 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( <L>DELTA POS</L><R>DELTA POS</R> )

  setLoadding(false)
} catch (err) {
  setLoadding(false)
  console.warn(err);
}

}; return ( <View style={{ flex: 1 }}>

Select printer type:
  <Button
    title="Print sample"
    onPress={handlePrint}
  />
  {
    Loadding ?
      <ActivityIndicator
        color='#333'
        size={55}
        style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}
      /> : ''
  }
</View>

) }

export default App