RNCNETINFO;getCurrentState got 3 arguments, expected 2

Hi,

I searched some solutions but here is nothing for the moment or only few results without answer. There is my code and my error.

Thanks

componentDidMount() {
  this.netUnsubscribe = NetInfo.addEventListener(state => {
        this.setState({ offline: state.type === 'none' });
  });
  }

  componentWillUnmount = () => {
    this.netUnsubscribe();
  };

Hi Hugo. I ran into this same issue today and found that it’s due to NetInfo versions past 4.6.0 not being compatible with Expo. I was able to resolve it by downgrading -
yarn add @react-native-community/netinfo@4.6.0
or
npm install @react-native-community/netinfo@4.6.0
Hope that helps!

2 Likes

Hi!
I had the same issue, but downgrading didn’t help. What solved the issue for me in the end was running “expo install @react-native-community/netinfo”

Hope that might help somebody :slight_smile:

2 Likes

Thank you @tindery. Worked for me too.

I had the same problem (SDK 36.0.0) and solved it by upgrading to react-native-community/netinfo version from 4.6.0 to 5.0.0.

  1. Delete the netinfo package:
    npm uninstall @react-native-community/netinfo
    npm uninstall @react-native-community/netinfo@4.6.0

  2. run expo start -> you will get an error, because no netinfo package is installed now

  3. stop expo -> Ctrl + C

  4. Install the new netinfo package:
    expo install @react-native-community/netinfo@5.0.0

  5. execute expo start

Now the problem should be solved

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.