If using HOC for a cell being rendered one will get "Rendered cell should include style property for positioning" warnings in console even if style actually set for an inner component. The following example is showing React-Draggable being used together with cell renderer.
...
<Draggable
key={key}
...
<-- we can't put style here because Draggable component doesn't accept such prop
>
<div style={style} ... >
caption
</div>
</Draggable>
...
Can't find where to put this style to make log shut up:
https://codesandbox.io/s/monr4x9qnx
(I'm putting the style in NodeView.jsx)
Solution:
rowRenderer = ({ key, index, style }) => {
return (
<div style={style}>
<Observer>
{() => (
<NodeWithDnD
key={key}
index={index}
node={this.items[index]}
/>
)}
</Observer>
</div>
);
};
(now the rowRenderer with MobX works without any warnings from Virtualized and reactively)
It will not work in my case as Draggable HOC must be outer component.
Has anyone discovered a work-around for this? Perhaps we could have a data-react-virtualized-no-warning prop that could be used to disable the warning a case-by-case basis?
I vote for removing this warning. It is so annoying.
Most helpful comment
Has anyone discovered a work-around for this? Perhaps we could have a
data-react-virtualized-no-warningprop that could be used to disable the warning a case-by-case basis?