Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

605
Views
Quiero imprimir un recibo con impresora térmica Bluetooth en react native

Hola quiero imprimir un recibo con impresora térmica bluetooth en react native. Tengo código a partir de ahora, está funcionando pero da una advertencia. con este código, ¿puedo imprimir un recibo? Por favor, ayúdeme a eliminar esta advertencia también. aquí está mi código. Advertencia posible rechazo de promesa no controlada (id: 0) TypeError: null no es un objeto (evaluando 'RNBLEPrinter.init')

 import React, { useState, useEffect } from "react"; import { USBPrinter, NetPrinter, BLEPrinter, } from "react-native-thermal-receipt-printer"; import { View, Text, TouchableOpacity, StyleSheet } from "react-native"; function Print() { const [printers, setPrinters] = useState([]); const [currentPrinter, setCurrentPrinter] = useState(); useEffect(() => { BLEPrinter.init().then(() => { BLEPrinter.getDeviceList().then(setPrinters); }); }, []); (_connectPrinter) => (printer) => { //connect printer BLEPrinter.connectPrinter(printer.inner_mac_address).then( setCurrentPrinter, (error) => console.warn(error) ); }; printTextTest = () => { currentPrinter && USBPrinter.printText("this is new print"); }; printBillTest = () => { currentPrinter && USBPrinter.printBill("this is for bill testing"); }; return ( <View style={styles.container}> {printers.map((printer) => ( <TouchableOpacity key={printer.inner_mac_address} onPress={() => _connectPrinter(printer)} > {`device_name: ${printer.device_name}, inner_mac_address: ${printer.inner_mac_address}`} </TouchableOpacity> ))} <TouchableOpacity onPress={printTextTest}> <Text>Print Text</Text> </TouchableOpacity> <TouchableOpacity onPress={printBillTest}> <Text>Print Bill Text</Text> </TouchableOpacity> </View> ); } export default Print; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: "center", alignItems: "center", }, });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Parece que puede provenir de la biblioteca react-native-thermal-receipt-printer . Buscaría en el módulo de nodo, generalmente en el archivo index.js, hará esa llamada de inicio.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!