rgommezz/react-native-offline

Incompatible with react-redux v8

geraintwhite opened this issue · 6 comments

Current Behavior

Because react-redux is pinned to ^7.0.0 in dependencies it means that an application using react-native-offline is unable to use a newer major version of react-redux (e.g. v8) due to mismatched versions resulting in this issue.

$ npm ls react-redux
├─┬ react-native-offline@6.0.0
│ └── react-redux@7.2.8
└── react-redux@8.0.1
 ERROR  Error: Could not find "store" in the context of "Connect(ReduxNetworkProvider)". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to Connect(ReduxNetworkProvider) in connect options.

This error is located at:
    in Connect(ReduxNetworkProvider) (at app.js:103)
    in PersistGate (at app.js:102)
    in Provider (at app.js:101)
    in App
    in RCTView (at View.js:32)
    in View (created by b)
    in b
    in Unknown (at renderApplication.js:50)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:92)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:119)
    in AppContainer (at renderApplication.js:43)

Expected Behavior

The application should be able to use newer major versions of react-redux.

How to reproduce

Run app using react-native-offline 6.x and react-redux 8.x

Your Environment

software version
react-native-offline 6.0.0
react-native 0.68.1
node 16.14.0
npm 8.3.1
stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

+1 facing the same issue

I've released v6.0.1. Please update to the latest, should be fixed now!

This didn't actually fix the issue because "react-redux": "^7.0.0" is in the dependencies of react-native-offline, thus forcing this version to be included and conflicting with any other versions included by the app.

A workaround for app developers is to use the npm overrides feature with "react-redux": "$react-redux" to force the same version of react-redux throughout.

Good point.

I have decided to relax the constraints of dependencies, to mirror peer dependencies. I still prefer to have those dependencies and avoid people installing extra libraries, like react-redux in case they don't need it.

@grit96 v.6.0.2 is released. Let me know!

@rgommezz hi, why 6.0.2 not listed in releases on github?