Releases: RichardRNStudio/react-native-find-local-devices
Releases · RichardRNStudio/react-native-find-local-devices
v2.0.9
What's Changed
- We have refactored the entire package. It works based on a class
PortScanner
:
import PortScanner from 'react-native-find-local-devices';
const scanner = new PortScanner({
timeout: 40,
ports: [8000],
onDeviceFound: (device) => {
console.log('Found device!', device);
},
onFinish: (devices) => {
console.log('Finished , devices:', devices);
},
onCheck: (device) => {
console.log('Checking IP: ', device.ipAddress);
},
onNoDevices: () => {
console.log('Finished scanning, no results have been found!');
},
onError: (error) => {
// Called when no service found
console.log('Error', error);
},
});
// You can start the discovering with the following function:
scanner.start();
// When the discovering is running, you can cancel that with the following function:
scanner.stop();
-
Advanced example with state management: https://github.com/RichardRNStudio/react-native-find-local-devices/blob/main/example/src/App.tsx
-
Rename
onResults
toonFinished
, this handler responds the array of the devices which have been found during the progress. -
Rename
onFinished
toonNoDevices
, this handler is just a notification when the scanning has been finished without any results. -
chore(#14): refactor the entire package by @RichardRNStudio in #5
-
chore(#14): add advanced example by @RichardRNStudio in #15
New Contributors
Thank you for your contribution @gstcyr!
Full Changelog: v1.3.5...v2.0.8