rn-host-detect

2019-08-17 admin

rn-host-detect是什么

什么是rn-host-detect,Get correctly localhost on Android emulator for React Native

rn-host-detect使用教程帮助文档

rn-host-detect

Get correctly localhost on Android emulator for React Native

On Android emulator, if you want to connect any servers of local, you will need run adb reverse on 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 reverse when 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

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-72750.html

文章标题:rn-host-detect

回到顶部