react-native-public-ip
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

react-native-public-ip

Get public IP address in React Native

Using the ipify API

Install

$ npm install --save react-native-public-ip

Usage

import publicIP from 'react-native-public-ip';
 
publicIP()
  .then(ip => {
    console.log(ip);
    // '47.122.71.234'
  })
  .catch(error => {
    console.log(error);
    // 'Unable to get IP address.'
  });

API

publicIP()

Returns a Promise for the IP address.

License

MIT © Alex Hinson

Package Sidebar

Install

npm i react-native-public-ip

Weekly Downloads

4,523

Version

1.0.2

License

MIT

Unpacked Size

2.56 kB

Total Files

5

Last publish

Collaborators

  • amhinson