diff --git a/README.md b/README.md index 72af238..56ac5a4 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,7 @@ const getSizesFallback = userAgent => { return { fallbackWidth: 1280, - fallbackHeiht: 700, + fallbackHeight: 700, } } diff --git a/src/withSizes.js b/src/withSizes.js index de58abb..c8b58f7 100644 --- a/src/withSizes.js +++ b/src/withSizes.js @@ -7,7 +7,7 @@ import getDisplayName from './utils/getDisplayName' import shallowDiff from './utils/shallowDiff' import getWindowSizes from './utils/getWindowSizes' -import contextTypes from './contextTypes' +import contextTypes, { contextKey } from './contextTypes' import * as presets from './presets' const withSizes = (...mappedSizesToProps) => WrappedComponent => { @@ -24,7 +24,8 @@ const withSizes = (...mappedSizesToProps) => WrappedComponent => { super(props, context) this.getWindowSizesWithFallback = () => { - const { fallbackHeight = null, fallbackWidth = null } = this.context + const config = this.context[contextKey] || {} + const { fallbackHeight = null, fallbackWidth = null } = config return getWindowSizes({ fallbackHeight, fallbackWidth }) }