digidem / react-dimensions

[Looking for maintainers]
http://lab.digital-democracy.org/react-dimensions/
450 stars 77 forks source link

Not working with redux connect #77

Open kakariko-village opened 5 years ago

kakariko-village commented 5 years ago

Hi, i try to use react dimensions with redux but got an error:

vendor.js:151117 Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Check the render method of DimensionsHOC. in ConnectFunction (created by DimensionsHOC) in div (created by DimensionsHOC) in DimensionsHOC in Provider

My versions:

"react-dimensions": "^1.3.0", "react": "^16.8.6", "redux": "^4.0.1",

My code:

....
import Dimensions from 'react-dimensions';

....

export default Dimensions({
    getHeight: function(element) {
        return window.innerHeight - 200;
    },
    getWidth: function(element) {
        let widthOffset = window.innerWidth < 1280 ? 70 : 55;
        return window.innerWidth - widthOffset;
    }
})(connect(mapStateToProps, mapDispatchToProps)(MyComponent));