rn-host-detect

2019-08-17

Get correctly localhost on Android emulator for React Native

rn-host-detect

Get correctly localhoston Android emulator for React Native

On Android emulator, if you want to connect any servers of local, you will need run adb reverseon your terminal. This module made it easier, you can get the localhost IP of host machine directly (10.0.2.2, Genymotion: 10.0.3.2).

This was done in the following projects:

That's why you don't need adb reversewhen you're using these modules on Android emulator.

Installation

$ npm i rn-host-detect --save-dev

Usage

const getHostForRN = require('rn-host-detect')

// '10.0.2.2' or '10.0.3.2' on Android
getHostForRN('localhost')

// '192.168.1.111', only convert localhost (or 127.0.0.1) to host IP
getHostForRN('192.168.1.111')

License

MIT

Repository

https+https://github.com/jhen0409/rn-host-detect


上一篇:reselect-tree
下一篇:get-params
相关教程
关注微信

扫码加入 JavaScript 社区

相关文章

首次访问,需要验证
微信扫码,关注即可
(仅需验证一次)

欢迎加入 JavaScript 社区

号内回复关键字:

回到顶部