leesiongchan / react-native-esc-pos

A React Native ESC/POS module to help you connect to your ESC/POS printer easily.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I implement ScanDevices()?

thiagopeluque opened this issue · comments

I tried to do like this

useEffect(() => {
async function init() {
const devices = await BluetoothSerial.scanDevices();
setDeviceList(devices);
console.log(deviceList);
}
init();

return () => {
  async function remove() {
    await BluetoothSerial.stopScan();
    console.log('Stop Scan');
  }
  remove();
};

}, []);

It´s return an empty array

Anyone have an example??? please!!!