连接到 wifi 网络时 React Native 扫描打印机并获取打印机的 ip 地址

React Native scan printers when connected to wifi network and get ip address of the printer

您好,我想在 React Native (Android & iOS) 中扫描连接到我的网络的打印机设备,并获取选定的打印机 IP 地址。到目前为止,我尝试的是:

1. https://github.com/leesiongchan/react-native-esc-pos -- 给我设备 mac_address

2. https://github.com/bencomtech/react-native-pos-printer -- 它给了我设备的 id

但我需要 IP 地址,是否有任何模块可以检测跨平台的此类场景。 谁能建议我完成这个任务

我认为您将找不到执行此特定任务的 RN 库。您将不得不编写本机实现并将其打包为 RN 模块。

Android: https://developer.android.com/guide/topics/connectivity/wifi-scan

iOS: https://developer.apple.com/library/archive/qa/qa1942/_index.html