diff --git a/src/__tests__/FixedSizeGrid.js b/src/__tests__/FixedSizeGrid.js
index aa1733a..24bcb9a 100644
--- a/src/__tests__/FixedSizeGrid.js
+++ b/src/__tests__/FixedSizeGrid.js
@@ -288,21 +288,44 @@ describe('FixedSizeGrid', () => {
it('should warn about deprecated overscanCount prop', () => {
spyOn(console, 'warn');
+ const renderer = ReactTestRenderer.create(
+
+ );
+ expect(console.warn).toHaveBeenCalledTimes(1);
+ expect(console.warn).toHaveBeenLastCalledWith(
+ 'The overscanCount prop has been deprecated. ' +
+ 'Please use the overscanColumnCount and overscanRowCount props instead.'
+ );
+
+ renderer.update();
+
+ // But it should only warn once.
+ expect(console.warn).toHaveBeenCalledTimes(1);
+ });
+
+ it('should warn about deprecated overscanRowsCount or overscanColumnsCount prop', () => {
+ spyOn(console, 'warn');
+
const renderer = ReactTestRenderer.create(
);
expect(console.warn).toHaveBeenCalledTimes(1);
expect(console.warn).toHaveBeenLastCalledWith(
- 'The overscanCount, overscanColumnsCount and overscanRowsCount props have been deprecated. ' +
+ 'The overscanColumnsCount and overscanRowsCount props have been deprecated. ' +
'Please use the overscanColumnCount and overscanRowCount props instead.'
);
- renderer.update();
+ renderer.update(
+
+ );
// But it should only warn once.
expect(console.warn).toHaveBeenCalledTimes(1);
diff --git a/src/createGridComponent.js b/src/createGridComponent.js
index 6f0f65b..e36da11 100644
--- a/src/createGridComponent.js
+++ b/src/createGridComponent.js
@@ -132,10 +132,12 @@ const defaultItemKey = ({ columnIndex, data, rowIndex }) =>
// In DEV mode, this Set helps us only log a warning once per component instance.
// This avoids spamming the console every time a render happens.
let devWarningsOverscanCount = null;
+let devWarningsOverscanRowsColumnsCount = null;
let devWarningsTagName = null;
if (process.env.NODE_ENV !== 'production') {
if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
devWarningsOverscanCount = new WeakSet();
+ devWarningsOverscanRowsColumnsCount = new WeakSet();
devWarningsTagName = new WeakSet();
}
}
@@ -772,21 +774,35 @@ const validateSharedProps = (
height,
innerTagName,
outerTagName,
+ overscanColumnsCount,
overscanCount,
+ overscanRowsCount,
width,
}: Props,
{ instance }: State
): void => {
if (process.env.NODE_ENV !== 'production') {
- if (
- typeof overscanCount === 'number' ||
- typeof overscanColumnsCount === 'number' ||
- typeof overscanRowsCount === 'number'
- ) {
+ if (typeof overscanCount === 'number') {
if (devWarningsOverscanCount && !devWarningsOverscanCount.has(instance)) {
devWarningsOverscanCount.add(instance);
console.warn(
- 'The overscanCount, overscanColumnsCount and overscanRowsCount props have been deprecated. ' +
+ 'The overscanCount prop has been deprecated. ' +
+ 'Please use the overscanColumnCount and overscanRowCount props instead.'
+ );
+ }
+ }
+
+ if (
+ typeof overscanColumnsCount === 'number' ||
+ typeof overscanRowsCount === 'number'
+ ) {
+ if (
+ devWarningsOverscanRowsColumnsCount &&
+ !devWarningsOverscanRowsColumnsCount.has(instance)
+ ) {
+ devWarningsOverscanRowsColumnsCount.add(instance);
+ console.warn(
+ 'The overscanColumnsCount and overscanRowsCount props have been deprecated. ' +
'Please use the overscanColumnCount and overscanRowCount props instead.'
);
}