$ npm install rn-netops --save
$ react-native link rn-netops
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜rn-netops
and addRNNetOps.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNNetOps.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNNetOpsPackage;
to the imports at the top of the file - Add
new RNNetOpsPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':rn-netops' project(':rn-netops').projectDir = new File(rootProject.projectDir, '../node_modules/rn-netops/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':rn-netops')
import NetOps from 'rn-netops'
NetOps.
// ipv4
ipAddress: ()
// ping packet
ping: (url, timeout)
// wol packet
wake: (mac, ip)
// socket connection
poke: (host, port, timeout)
// Create an HTTP request.
// @param {string} url Request target url string.
// @param {object} options Configuration options for the fetch request, which can be.
// @param {string} method HTTP method, should be `GET`, `POST`, `PUT`, `DELETE`
// @param {object} headers HTTP request headers.
// @param {string} body HTTP request body.
// @param {boolean} cacheImage Use the url as a cache key (md5'd) and use a png
// extension for the file.
// @param {number} timeout Request timeout in millionseconds.
// @param {boolean} trusty If true, the request can be made against self-signed certs.
fetch: (url, options)
Inspired by
MIT