react-native-offline icon indicating copy to clipboard operation
react-native-offline copied to clipboard

Incompatible with react-redux v8

Open geraintwhite opened this issue 3 years ago • 1 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
├─┬ [email protected]
│ └── [email protected]
└── [email protected]
 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

geraintwhite avatar May 05 '22 09:05 geraintwhite

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.

stale[bot] avatar Aug 13 '22 14:08 stale[bot]

+1 facing the same issue

nilesh0710 avatar Oct 31 '22 18:10 nilesh0710

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

rgommezz avatar Jan 24 '23 22:01 rgommezz

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.

geraintwhite avatar Feb 06 '23 13:02 geraintwhite

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 avatar Feb 14 '23 21:02 rgommezz

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

superyarik avatar Apr 08 '24 14:04 superyarik