From 27498ff01a35ff1ced05074d58df8f7791596c7f Mon Sep 17 00:00:00 2001 From: Harry Yu Date: Thu, 20 Jun 2019 00:29:25 -0700 Subject: [PATCH] Fixed `throttle` config param passing to wrapped components --- src/SizesContext.js | 2 ++ src/withSizes.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/SizesContext.js b/src/SizesContext.js index d397ebe..04a773d 100644 --- a/src/SizesContext.js +++ b/src/SizesContext.js @@ -1,6 +1,8 @@ import React from 'react' const SizesContext = React.createContext({ + // Keep these fields in sync with the excluded fields in the `render()` + // function of `withSizes.js` fallbackWidth: null, fallbackHeight: null, forceFallback: false, diff --git a/src/withSizes.js b/src/withSizes.js index ef7fb16..d99b58f 100644 --- a/src/withSizes.js +++ b/src/withSizes.js @@ -75,9 +75,12 @@ const withSizes = (...mappedSizesToProps) => WrappedComponent => { render() { const { + // Ensure all the `SizesContext.js` arguments are excluded. + // Keep this in sync with `SizesContextjs` fields fallbackHeight, fallbackWidth, forceFallback, + throttle, ...otherProps } = this.props