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.