TypeError: Cannot read property 'NetPrinter' of undefined, js engine: hermes ,
tranvanthien123 opened this issue · comments
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:
{
Loadding ?
<ActivityIndicator
color='#333'
size={55}
style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}
/> : ''
}
)
}
export default App