react-native-netinfo / react-native-netinfo Goto Github PK
View Code? Open in Web Editor NEWReact Native Network Info API for Android & iOS
License: MIT License
React Native Network Info API for Android & iOS
License: MIT License
NetInfo API should work in web environments
Not able to retrieve the Device ID
import DeviceInfo from 'react-native-device-info';
export default class SignUp extends Component {
constructor(props) {
super(props);
this.state = {
email : '',
fullName: '',
password: '',
mobileNo: '',
deviceId: '',
}
}
componentWillMount(){
var id = DeviceInfo.getUniqueID();
this.setState({ deviceId: id, });
}
I am using the following code to get the connection info but it return unknown for android:
componentDidMount() { NetInfo.getConnectionInfo().then(connectionInfo => { console.log("Connection type", connectionInfo.type); console.log("Connection effective type", connectionInfo.effectiveType); }); }
React Native Version: 0.59.0
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 350.61 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.12.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 19, 21, 23, 25, 26, 27, 28
Build Tools: 23.0.1, 25.0.2, 26.0.3, 27.0.3, 28.0.3
System Images: android-19 | Google APIs ARM EABI v7a, android-21 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-27 | Google Play Intel x86 Atom
IDEs:
Android Studio: 2.3 AI-162.4069837
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.4 => 0.59.4
npmGlobalPackages:
react-native-cli: 2.0.1
Just used yarn to add the package, and I am getting this error. I have followed the instructions suggested in the message. I am not using CocoaPods.
Simply importing the library as described in the README documentation produces the error.
import NetInfo from '@react-native-community/netinfo';
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 37.34 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.59.8 => 0.59.8
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7
react-native-schemes-manager: 1.0.5
Android
Cannot build react-native run-android
android.useAndroidX=true
android.enableJetifier=true
classpath 'com.android.tools.build:gradle:3.3.1'
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
Environment:
OS: Windows 10
Node: 10.15.3
Yarn: Not Found
npm: 3.10.10
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.3.0.0 AI-182.5107.16.33.5314842
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0
Loading dependency graph, done.
error: bundling failed: SyntaxError in D:\github\markit\node_modules@react-native-community\netinfo\js\index.js: D:/github/markit/node_modules/@react-native-community/netinfo/js/index.js: Unexpected token (42:46)
40 | type IsConnectedHandler = (isConnected: boolean) => void;
41 |
42 | const _subscriptions = new Set();
| ^
43 | const _isConnectedSubscriptions = new Map();
44 |
45 | let _latestNetInfo = null;
DELTA [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓░░░░░░ 62.9% (613/773), failed.
On Android
I am getting this error on build my android app, help needed.
React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz
Memory: 6.47 GB / 15.95 GB
Binaries:
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.3.0.0 AI-182.5107.16.33.5314842
I'm experiencing the issue on both iOS and Android.
If the network state changes while the app is in background, NetInfo.getConnectionInfo() returns the older state until the state changes again with the app in foreground.
A similar issue was opened on 4 Oct 2018 on the react-native repo: facebook/react-native#21476.
I don't know if it's a regression or not.
I call the function when the instrested component mounts:
static getDeviceConnectionInfo = async () => {
const info = await NetInfo.getConnectionInfo();
Reactotron.log('G O T N E T I N F O', info);
return info;
}
It returns the correct state. If I disable the WiFi (for example) and re-mount my component (it's a modal that I mount/unmount) the state I get is correct and updated (type === unknown).
Now i put the app in background and I re-enable the WiFi. Then I resume the app and open the modal again. The state returned is still type === unknown.
The state I get doesn't update until I make another network change with the app in foreground.
Android
Calling NetInfo.getConnectionInfo() returns type "unknown", if a vpn is activated and the device have a connection with wifi/cellular.
The deprecated intern React Native Package have the correct return of "wifi" by calling getConnectionInfo().
Also calling NetInfo.isConnected() return "false".
Just throwing up an issue to track some issues with Android CI flakiness;
Potential workaround: I think this is just down to lack of host gpu support on Circle CI & gpu emulation being slow - could increase the timeout
Run Tests (API 28)
logs)Potential fix: Add a Jest afterAll()
global and a await device.terminateApp();
or process.exit(0)
I can take a look at these sometime next week; unless someone beats me too it 🙃
effectiveType
property name does not really communicate what the value means (cellular generation).effectiveType
property only makes sense when type: "cellular"
. Additionally, the shape of the object makes it hard to add new properties which are only applicable for one of the connection types such as "SSID" for Wifi connections. Related to issues #37 and #52.NetInfo.getCurrentInfo()
and NetInfo.isConnected.fetch()
even though they serve the same purpose of fetching the current information once.NetInfo.isConnected
methods only say that we have an active connection, not that the internet is reachable. Related to issue #12.NetInfo.isConnectionExpensive()
is only available on Android. This is useful information to know for when you want to make large API calls.// Methods
NetInfo.fetch(): Promise<NetInfoState>;
NetInfo.addEventListener(listener: (state: NetInfoState) => void): void;
// Types
type NetInfoState =
| NetInfoUnknownState
| NetInfoNoConnectionState
| NetInfoCellularState
| NetInfoWifiState
| NetInfoBluetoothState
| NetInfoEthernetState
| NetInfoWimaxState;
type NetInfoConnectedDetails = {
isConnectionExpensive: boolean,
externalIp: string | null,
externalIpv6: string | null,
};
type NetInfoUnknownState = {
type: 'unknown',
isConnected: false,
isInternetReachable: false,
details: null,
};
type NetInfoNoConnectionState = {
type: 'none',
isConnected: false,
isInternetReachable: false,
details: null,
};
type NetInfoCellularState = {
type: 'cellular',
isConnected: true,
isInternetReachable: boolean,
details: NetInfoConnectedDetails & {
cellularGeneration: '2g' | '3g' | '4g' | null,
},
};
type NetInfoWifiState = {
type: 'wifi',
isConnected: true,
isInternetReachable: boolean,
details: NetInfoConnectedDetails & {
ssid: string | null,
},
};
type NetInfoBluetoothState = {
type: 'bluetooth',
isConnected: true,
isInternetReachable: boolean,
details: NetInfoConnectedDetails,
};
type NetInfoEthernetState = {
type: 'ethernet',
isConnected: true,
isInternetReachable: boolean,
details: NetInfoConnectedDetails,
};
type NetInfoWimaxState = {
type: 'wimax',
isConnected: true,
isInternetReachable: boolean,
details: NetInfoConnectedDetails,
};
For the shape of the NetInfoState
type:
type
, isConnected,
isInternetReachable) are properties which make sense across all states, including
type: "none"`.details
are one which are only applicable for a subset of states, including those which are only applicable when connected. To tidy up the types these are defined once in the NetInfoConnectedDetails
type.Example usage:
NetInfo.addEventListener((state: NetInfoState) => {
if (state.isConnected) {
console.log(`Connected!`);
console.log(`Is internet reachable: ${state.isInternetReachable}`);
// Get the connection type and cellular generation and SSID if we have the correct types
console.log(`Type: ${state.type}`);
if (state.type === 'cellular') {
console.log(`Cellular generation: ${state.details.cellularGeneration}`);
} else if (state.type === 'wifi') {
console.log(`Cellular generation: ${state.details.ssid}`);
}
// Type systems should allow this as details always has "externalIpv6" when connected, but it might be "null"
console.log(`External IP: ${state.details.externalIpv6}`);
} else {
console.log('No connection');
}
});
NetInfo.addEventListener()
method.effectiveType
property to state.details.cellularGeneration
.state.details
property. The types make it clear when these properties are available and will throw errors on both Flow and TypeScript if misused.NetInfo.isConnected
methods as the connected flag is now included in NetInfoState
. This encourages developer to make full use of the information we fetch and is no less efficient because we always fetch all of the data anyway and transform is to a boolean
in Javascript.isInternetReachable
flag which makes it clearer that isConnected
is not the one to use.isConnectionExpensive
into state.details
for all connected states makes the flag useable on both platforms and much easier to get access to.
cellular
is expensive and wifi
is not. This is why the property is a boolean
rather than having a fixed true
or false
value for each connection type.We should not introduce such big breaking changes lightly. I believe with this API we can actually provide full backward compatibility with the current API.
NetInfo.getCurrentInfo()
method to NetInfo.fetch()
we can keep the previous one around and transform the new state shape into the current one. This was the reason for changing the method name to fetch
.NetInfo.addEventListener()
method with a string
as the first parameter, we can assume they want to use the current API and transform the new state shape into the current one.NetInfo.isConnected
methods is the API and simply return the isConnected
boolean
from the new state shape.All of these cases can be handled in a backward compatible way and we can include Yellow Box warnings to encourage upgrading to the newer APIs.
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Memory: 78.85 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.14.1 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
System Images: android-25 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom_64, android-27 | Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.1 => 0.59.1
Android only
Task :@react-native-community_netinfo:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
Could not create service of type DefaultGeneralCompileCaches using GradleScopeCompileServices.createGeneralCompileCaches().
Following this issue: #32
Calls to await NetInfo.getConnectionInfo();
always return type "unknown" when called from a headless or background task (such as when using react-native-background-fetch).
Is there a way to get an uncached version of the network info? This is critical to only perform background requests when the user is on wifi.
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
Memory: 127.13 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.12.0 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.4 => 0.59.4
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
iOS
After upgrading from 2.0.0 to 2.0.1 pod init
returns in this error. [!] No podspec found for 'react-native-netinfo' in '../node_modules/@react-native-community/netinfo'
before the update everything is working fine. There's no new instruction for linking or a warning in the release.
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Memory: 784.71 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.6.0 - ~/.nvm/versions/node/v11.6.0/bin/node
Yarn: 1.13.0 - ~/.yarn/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v11.6.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 23, 27, 28
Build Tools: 27.0.3, 28.0.2, 28.0.3
System Images: android-23 | Google APIs Intel x86 Atom_64, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom_64
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.4 => 16.8.4
react-native: 0.59.5 => 0.59.5
npmGlobalPackages:
react-native-cli: 2.0.1
Jest
Running a simple test in my app result in this:
FAIL src/__tests__/App.test.js
● Test suite failed to run
@react-native-community/netinfo: NativeModule.RNCNetInfo is null. To fix this issue try these steps:
• Run `react-native link @react-native-community/netinfo` in the project root.
• Rebuild and re-run the app.
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-netinfo
at Object.<anonymous> (node_modules/@react-native-community/netinfo/lib/commonjs/nativeInterface.js:18:9)
at Object.<anonymous> (node_modules/@react-native-community/netinfo/lib/commonjs/index.js:14:1)
tests/App.test.js:
import React from 'react';
import renderer from 'react-test-renderer';
import App from '../App';
describe('App tests', () => {
test('renders correctly', () => {
const tree = renderer.create(<App />).toJSON();
expect(tree).toMatchSnapshot();
});
});
run jest
Hi. There is not any information in docs when NetInfo.fetch promise is rejected. Could you explain it in the docs?
info
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
Memory: 261.48 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.15.1 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
Build Tools: 21.1.1, 21.1.2, 22.0.0, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.0, 26.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3
API Levels: 22, 24, 26, 27, 28
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5014246
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.5 => 16.8.5
react-native: 0.59.2 => 0.59.2
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
iOS
Uses old version of React and when adding the React dependecies from the node_modules directory (which is a really stupid way to do this) CocoaPods crashes. Isn't there really a better way to add dependencies with just package.json as all other dependencies? Really don't understand why some developers choose this CocoaPods way, which never works.
pod 'yoga', path: './node_modules/react-native/ReactCommon/yoga'
pod 'Folly', :podspec => './node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'GLog', :podspec => './node_modules/react-native/third-party-podspecs/GLog.podspec'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'React', path: './node_modules/react-native', subspecs: [
'Core',
'jschelpers',
'cxxreact',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTImage',
'RCTNetwork',
'RCTActionSheet',
'RCTAnimation',
'RCTWebSocket'
]
.rvm/gems/ruby-2.2.1@global/gems/gh_inspector-1.0.3/lib/gh_inspector/sidekick.rb:91:in `block in validate_delegate': #<Pod::UserInterface::InspectorReporter:0x007f811242da48> does not handle inspector_successfully_recieved_report (RuntimeError)
Honestly, I tried to run react-native info
but it hung? That was unexpected. It only spit this bit out first:
mike@isabela:~/work/Kullki/kscoreapp-rxp (mvp3-dev *) % react-native info
info
React Native Environment Info:
System:
OS: Linux 5.1 Ubuntu 19.04 (Disco Dingo)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 685.18 MB / 31.13 GB
Shell: 5.0.3 - /bin/bash
Binaries:
Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node
Yarn: 1.16.0 - ~/.nvm/versions/node/v12.2.0/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v12.2.0/bin/npm
SDKs:
Android SDK:
API Levels: 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 24.0.0, 24.0.2, 25.0.0, 25.0.1, 25.0.2, 26.0.0, 26.0.3, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.0
System Images: android-15 | Intel x86 Atom, android-15 | Google APIs Intel x86 Atom, android-16 | ARM EABI v7a, android-16 | Intel x86 Atom, android-16 | Google APIs Intel x86 Atom, android-17 | Intel x86 Atom, android-17 | Google APIs Intel x86 Atom, android-18 | Intel x86 Atom, android-18 | Google APIs Intel x86 Atom, android-19 | Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-21 | Intel x86 Atom, android-21 | Google APIs Intel x86 Atom, android-22 | ARM EABI v7a, android-22 | Intel x86 Atom, android-22 | Google APIs ARM EABI v7a, android-23 | Android TV Intel x86 Atom, android-23 | Intel x86 Atom, android-23 | Google APIs ARM EABI v7a, android-23 | Google APIs Intel x86 Atom, android-24 | ARM 64 v8a, android-24 | ARM EABI v7a, android-24 | Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-25 | Google APIs ARM 64 v8a, android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-Q | Google Play Intel x86 Atom_64, chromeos-67 | Chrome OS 67
npmPackages:
react: ^16.8.6 => 16.8.6
react-native: ^0.59.8 => 0.59.8
npmGlobalPackages:
react-native-cli: 2.0.1
both - but really, typescript 3.4.5 with this tsconfig:
{
"compilerOptions": {
"declaration": false,
"noResolve": false,
"jsx": "react",
"reactNamespace": "RX",
"lib": ["dom", "es5", "scripthost", "es2015"],
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"sourceMap": true,
"skipLibCheck": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"outDir": "./dist/",
"strict": true
},
"exclude": ["node_modules"],
"include": ["./src/**/*"]
}
I run tsc and get this, with the above tsconfig.json:
[12:39:59 AM] Starting compilation in watch mode...
node_modules/@react-native-community/netinfo/src/internal/deprecatedSubscriptions.ts:23:23 - error TS2569: Type 'Set<ChangeHandler>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
23 for (let handler of _subscriptions) {
~~~~~~~~~~~~~~
node_modules/@react-native-community/netinfo/src/internal/subscriptions.ts:23:23 - error TS2569: Type 'Set<NetInfoChangeHandler>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
23 for (let handler of _subscriptions) {
~~~~~~~~~~~~~~
[12:40:06 AM] Found 2 errors. Watching for file changes.
If you paste my tsconfig.json over the project's one in the root, then run npm run validate:typescript
you will see it
This looked like interesting related reading: https://mariusschulz.com/blog/typescript-2-3-downlevel-iteration-for-es3-es5
I suppose I could move up to es6 as my target but it would be nice for safety's sake in a ReactXP project (that touches the web) to stay on ES5 just in case. Maybe there's an easy refactor to remove the need for this style iteration?
Or at the least you should warn that the typescript requires either ES6 or downlevel-iterators, but then you might take note of the tslib/importhelpers note in the linked article
NetInfo.isConnected.addEventListener only works when wifi is turned on/off. I am looking to listen to an event when wifi switches from one network to another. Can anyone have some solutions or any workarounds? Thanks in advance.
NetInfo.isConnected.addEventListener("connectionSwitch", listener)
or
NetInfo.isConnected.addEventListener("wifiConnectionSwitch", listener)
Hi all, ever since we migrated from the original ReactNative library to this one we've been having two issues, one with eslint error (which can be ignored) that complains about no default export being found and more importantly with Jest:
.../node_modules/@react-native-community/netinfo/js/index.js:11
import {Platform} from 'react-native';
^
which seems to be similar.
Judging by google result and the fact that no one else seems to be having this issue I think we're doing something wrong but after a few days of trying I thought it's best to ask here.
correct me if I'm wrong but judging by the source code looks like this library is using es5 style module export which seems to be related to the errors we're getting?
Any help or ideas would be much appreciated :) Thanks!
info
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 84.29 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.0.0 - /usr/local/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
API Levels: 21, 22, 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.2, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3
System Images: android-27 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.4 => 0.59.3
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7
Android
Android keeps throwing an error on launch saying RNCNetInfo Native module is not present. iOS is working fine.
The connection info should include the IP address for all connected network interfaces (cellular, wifi, wired, vpn?)
Add a map of network interface and their IP addresses to the connection info.
The Apple TV has WiFi and a Wired Ethernet jack and iOS supports USB network adapters. Netinfo should include a wired connection type.
Add a wired connection type
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
Memory: 1.17 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.8.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 24, 26, 27, 28
Build Tools: 24.0.0, 26.0.0, 28.0.3
System Images: android-27 | Android TV Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz => 0.57.1
npmGlobalPackages:
react-native-cli: 2.0.1
react-native: 0.59.4
Test on IOS only so far, actual device
Info above
After following the directions, 2 steps to install I get an error running the example code that says RNCNetInfo is null. To fix this issue try these steps:, Run 'react-native link....'. I have removed the node modules and reinstalled everything. This module does not work. Very disappointing to see the NetInfo is depreciated and the replacement has problems just to run the example code.
Just install the project using NPM per the instructions with the latest react-native version
npm install --save @react-native-community/netinfo
react-native link @react-native-community/netinfo
Hi,
I recently upgraded to Netinfo 2.0.6 and I'm getting the following error:
Task :@react-native-community_netinfo:compileReleaseJavaWithJavac FAILED
/Users/vsts/agent/2.150.0/work/1/s/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/ConnectivityReceiver.java:14: error: package android.support.v4.net does not exist
import android.support.v4.net.ConnectivityManagerCompat;
I've tried making sure that the package is in my build.gradle but nothing is helping.
My react native version is 0.59.5.
Thanks!
info
React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-5775R CPU @ 3.30GHz
Memory: 183.88 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 22, 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.3, 24.0.1, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.0
System Images: android-23 | Google APIs Intel x86 Atom_64, android-24 | ARM 64 v8a, android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom_64, android-25 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.59.0 => 0.59.0
Both Android and iOS
If we use the code in readme:
const subscription = NetInfo.addEventListener(state => {
console.log("Connection type", state.type);
console.log("Is connected?", state.isConnected);
});
we got this message in logcat:
Trying to subscribe to unknown event: "function (state) {
console.log('DEBUG!!! Connection type', state.type);
console.log('DEBUG!!! Is connected?', state.isConnected);
}"
And Netinfo seems not working...
Can you help us ?
Thank you
Execution failed for task ':@react-native-community_netinfo:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: /node_modules/@react-native-community/netinfo/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json (No such file or directory)
Android
This file is not present in the relevant directory.
I tried running the assemble task inside the android folder of netinfo library. Then this file got generated inside /node_modules/@react-native-community/netinfo/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug directory.
Then I tried pasting that file into the desired directory.
When I tried running react-native run-android command this file automatically gets removed from the directory.
Android
Calling NetInfo.getConnectionInfo() always returns type "unknown" when wifi is turned off, and cellular data is turned off.
One would expect that "none" is returned instead. Right now, it is impossible to tell the difference between actually being offline, or not being able to tell the network status at all.
Since network info can be sometimes be unreliable (such as when called in background #64 ), being able to tell the difference between unknown and none is actually very important, since you can then implement different behaviors for each case.
Android
Android has multiple Java and Lint warnings which, depending on project configuration, could cause build errors. These should all be fixed or suppressed.
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 3.03 GB / 32.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 25.0.2, 27.0.3, 28.0.2, 28.0.3
System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.2 => 0.59.2
npmGlobalPackages:
react-native-cli: 2.0.1
Android
The NetworkCallbackConnectivityReceiver
class does not correctly handle the none
case. It should set connectionType
to CONNECTION_TYPE_NONE
when mNetworkCapabilities
is null
. This will match the behaviour of iOS and older versions of Android.
Would be great to have a react hook for netinfo coming from this repo rather than having to install an external dependency.
A hook has been created on this repo, could be easily brought in
https://github.com/react-native-community/react-native-hooks/blob/master/lib/useNetInfo.js
can you please update the documentation?
By example
Readme says
NetInfo.fetch()
and this doesn't works at all, The Right way it's the next
NetInfo.isConnected.fetch().
React Native Environment Info:
System:
OS: Linux 4.20 Arch Linux undefined
CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Memory: 399.44 MB / 15.35 GB
Shell: 5.0.0 - /bin/bash
Binaries:
Node: 10.7.0 - /usr/local/bin/node
npm: 6.7.0 - ~/.node_modules/bin/npm
IDEs:
Android Studio: 3.3
npmPackages:
react: ^16.8.4 => 16.8.4
react-native: ^0.59.0 => 0.59.0
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-google-signin: 0.12.0
react-native-rename: 2.4.0
Both
react-native-netinfo: 1.2.3
react-native: 0.59.0
react: 16.8.4
typescript: 3.3.3333
When creating a project using Typescript, import NetInfo from "@react-native-community/netinfo"
would throw this error:
Cannot read property 'getConnectionInfo' of undefined
ts file:
async componentWillMount() {
let {type} = await NetInfo.getConnectionInfo();
if (type === "none") {
}
}
This is the compiled js file:
componentWillMount() {
return __awaiter(this, void 0, void 0, function* () {
let { type } = yield netinfo_1.default.getConnectionInfo();
if (type === "none") {
}
});
}
To avoid this error, I have to use
const NetInfo = require("@react-native-community/netinfo");
or
import * as NetInfo from "@react-native-community/netinfo"
but either solution would lose the typing support.
Is it possible to use import * as NetInfo from "@react-native-community/netinfo
while it still has the typing available?
My tsconfig:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"removeComments": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"experimentalDecorators": true,
"noLib": false,
"declaration": false,
"emitDecoratorMetadata": true,
"lib": ["es6", "dom"],
"types": ["reflect-metadata"],
"inlineSources":true,
"skipLibCheck": true,
"jsx": "react-native",
"resolveJsonModule": true
}
}
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Memory: 188.01 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.13.0 - /var/folders/nl/710wyq5x15v877chfxh5hsd80000gn/T/yarn--1554154696352-0.5529216754436022/node
Yarn: 1.13.0 - /var/folders/nl/710wyq5x15v877chfxh5hsd80000gn/T/yarn--1554154696352-0.5529216754436022/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 26.0.0, 27.0.3, 28.0.3
System Images: android-24 | Google APIs Intel x86 Atom, android-25 | Google APIs ARM 64 v8a, android-25 | Google APIs ARM EABI v7a, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5264788
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.0 => 0.59.0
iOS
yarn react-native run-ios --device="iPhone XS" - getting build failed
This library should be updated to use the AndroidX dependencies rather than the old Support Library ones.
https://developer.android.com/jetpack/androidx/migrate
I was trying to run the following codes:
NetInfo.isConnected.fetch().then(isConnected => {
alert("Is connected", isConnected);
});
on OnePlus 2 and Xiaomi Redmi 4 while both devices are connected.
OnePlus2 return true and Redmi4 return false. Just a suggestion and hope we can find the solution :)
Thanks.
info
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 17.01 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.9.4 - /usr/local/bin/node
Yarn: 1.6.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.4.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 27.0.0, 27.0.3, 28.0.2, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.0 AI-171.4408382
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: ^16.8.3 => 16.8.4
react-native: ^0.59.4 => 0.59.4
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Android on different brands
I was trying to run the following codes:
NetInfo.isConnected.fetch().then(isConnected => {
alert("Is connected", isConnected);
});
on OnePlus 2 and Xiaomi Redmi 4 while both devices are connected.
OnePlus2 return true and Redmi4 return false. With suggestion from @matt-oakes , I ran the following codes on both devices with and without internet connection.
NetInfo.getConnectionInfo().then(connectionInfo => {
console.log("Connection type", connectionInfo.type);
console.log("Connection effective type", connectionInfo.effectiveType);
});
Results are as following:
Redmi Note 4
Either when connected or not connected,
Connection type - unknown
Connection effective type - unknown
OnePlus2
When connected,
Connection type - wifi
Connection effective type - unknown
When not connected,
Connection type - none
Connection effective type - unknown
I just created a simple project and run the codes on both devices.
Android
When trying to use this plugin with Gradle 5.0 (which should come soon to RN facebook/react-native#23324), I am getting these error :
* What went wrong:
A problem occurred configuring project ':@react-native-community/netinfo'.
> The project name '@react-native-community/netinfo' must not contain any of the following characters: [/, \, :, <, >, ", ?, *, |]. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/5.2/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
I think it is because Gradle 5.+ does not accept anymore that kind of name : https://docs.gradle.org/current/userguide/upgrading_version_4.html
Thanking you in advance
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
Memory: 225.40 MB / 16.00 GB
Shell: 2.7.1 - /usr/local/bin/fish
Binaries:
Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 24, 25, 26, 27, 28
Build Tools: 27.0.3, 28.0.2, 28.0.3
System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.1 => 0.59.1
Android
react-native link @react-native-community/netinfo
command is not linking the library properly.
To fix this issue one must manually add the following
android/app/build.gradle:
dependencies {
...
implementation project(':@react-native-community_netinfo')
}
android/app/src/main/java/.../MainApplication.java:
protected List<ReactPackage> getPackages() {
...
new NetInfoPackage()
}
We are using react-native-navigation
that causes the MainApplication.java to be a slightly different than it is in React Native's project template.
$ react-native info
info
React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
Memory: 921.76 MB / 7.93 GB
Binaries:
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.5429.30.34.5452501
Android
When compiling the android binary I get this error:
Task :@react-native-community_netinfo:compileReleaseJavaWithJavac FAILED
/Users/vsts/agent/2.150.0/work/1/s/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/ConnectivityReceiver.java:14: error: package android.support.v4.net does not exist
import android.support.v4.net.ConnectivityManagerCompat;
^
/Users/vsts/agent/2.150.0/work/1/s/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/ConnectivityReceiver.java:78: error: cannot find symbol
promise.resolve(ConnectivityManagerCompat.isActiveNetworkMetered(getConnectivityManager()));
^
symbol: variable ConnectivityManagerCompat
location: class ConnectivityReceiver
2 errors
FAILURE: Build failed with an exception.
Compilation failed; see the compiler error output for details.
Code matches the sample on the github repo
I have tried putting the old android.support.v4 libraries into my build.gradle. I had to upgrade to androidx for support of @react-native-communiy/slider so I've tried using that to do legacy libraries too but they all fail.
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 86.61 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.3.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 25, 26, 27, 28
Build Tools: 26.0.2, 27.0.3, 28.0.3
System Images: android-27 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.58.3 => 0.58.3
Android
It's the same issue which is described here.
import React, { Component } from 'react'
import {
View,
Text
} from 'react-native'
import { connect } from 'src/store'
import NetInfo from "@react-native-community/netinfo";
class InternetConnection extends Component {
listener = null
state = {
online: false
}
componentDidMount () {
let me = this
me.listener = NetInfo.isConnected.addEventListener('connectionChange', me.onConnectionChange.bind(me))
}
componentWillUnmount () {
let me = this
if (me.listener) {
me.listener.remove()
}
}
onConnectionChange ({ info, effectiveType }) {
let me = this
if (!info || info === 'none' || info === 'unknown') {
me.setState({ online: false })
} else {
me.setState({ online: true })
}
console.log(info, effectiveType)
}
render() {
let { online } = this.state
if (online) {
return null
}
return (
<View style={{ backgroundColor: 'red', padding: 5 }}>
<Text style={{ textAlign: 'center', color: '#fff' }}>
Offline
</Text>
</View>
)
}
}
export default connect(InternetConnection)
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Memory: 48.39 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.0.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5199772
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.0-rc.3 => 0.59.0-rc.3
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native-i18n: 2.0.11
iOS/Android/Typescript
When creating a project using Typescript the types file for netinfo
does not declare its types correctly.
react-native init TestNetInfo --version [email protected] --template typescript
cd TestNetInfo
Open in VSCode (other other editor supporting typescript)
Paste the following code into your App.ts
file:
import React from 'react';
import { View } from 'react-native';
import NetInfo, { ConnectionInfo } from "@react-native-community/netinfo";
class App extends React.PureComponent {
render () { return (<View/>); }
componentDidMount() {
NetInfo.addEventListener("connectionChange", this.connectionChanged);
}
}
The function addEventListener
should be available on the NetInfo
type in the editor.
The function addEventListener
is not detected as a valid type in the editor.
Environment:
OS: macOS 10.14.4
Node: 10.15.3
Yarn: Not Found
npm: 6.4.1
Watchman: Not Found
Xcode: Xcode 10.2.1 Build version 10E1001
Android Studio: 3.4 AI-183.5429.30.34.5452501
Packages: (wanted => installed)
react: ^16.3.1 => 16.3.1
react-native: ^0.55.4 => 0.55.4
Android
Resolver doesn't find the module. Still, the package is correctly installed, linked, and the file exist.
I tried to reset-cache, rm -rf node_modules and npm i, still can't resolve this module.
bundling failed: Error:
While trying to resolve module `@react-native-community/netinfo` from file `xxx/app/middleware/network.js`,
the package `xxx/node_modules/@react-native-community/netinfo/package.json` was successfully found.
However, this package itself specifies a `main` module field that could not be resolved (`xxx/node_modules/@react-native-community/netinfo/src/index.ts`.
Indeed, none of these files exist:
* `xxx/node_modules/@react-native-community/netinfo/src/index.ts(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 174.83 MB / 16.00 GB
Shell: 5.5.1 - /usr/local/bin/zsh
Binaries:
Node: 8.11.4 - ~/.nvm/versions/node/v8.11.4/bin/node
npm: 6.4.0 - ~/.nvm/versions/node/v8.11.4/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.1 => 0.57.1
Both
I installed the latest version as well as 2.0.2
, linked the package using react-native link @react-native-community/netinfo
, and rebuilt the project using react-native run-ios
. I got the previously reported @react-native-community/netinfo: NativeModule.RNCNetInfo is null...
error.
As per @matt-oakes 's request, I am not using Cocoa Pods so there isn't a Podfile or Podlock to report, I am using react-native's link
command for everything.
All I did was install, rebuild the project and restart the packager after importing the package in the root App.js
file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.