How to use the react-native-offline.reducer.isConnected function in react-native-offline

To help you get started, we’ve selected a few react-native-offline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anchetaWern / RNOffline / src / reducers / ChatReducer.js View on Github external
export default (state = INITIAL_STATE, action) => {
  switch (action.type) {
    case offlineActionTypes.CONNECTION_CHANGE:
      if (network.isConnected != action.payload && !action.payload) {
        return { ...state, isNetworkBannerVisible: true };
      } else {
        return { ...state, isNetworkBannerVisible: false };
      }

    case SET_CURRENT_USER:
      return { ...state, user: action.user };

    case SET_CURRENT_ROOM:
      return { ...state, room: action.room };

    case PUT_USER:
      const current_users = [...state.users];
      const users = current_users.concat(action.user);
      return { ...state, users };

react-native-offline

Handy toolbelt to deal with offline mode in React Native applications. Cross-platform, provides a smooth redux integration.

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis