Skip to content

Commit 99dc834

Browse files
committed
Fix context config from withSizes
1 parent b691e36 commit 99dc834

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ const getSizesFallback = userAgent => {
255255

256256
return {
257257
fallbackWidth: 1280,
258-
fallbackHeiht: 700,
258+
fallbackHeight: 700,
259259
}
260260
}
261261

src/withSizes.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import getDisplayName from './utils/getDisplayName'
77
import shallowDiff from './utils/shallowDiff'
88
import getWindowSizes from './utils/getWindowSizes'
99

10-
import contextTypes from './contextTypes'
10+
import contextTypes, { contextKey } from './contextTypes'
1111
import * as presets from './presets'
1212

1313
const withSizes = (...mappedSizesToProps) => WrappedComponent => {
@@ -24,7 +24,8 @@ const withSizes = (...mappedSizesToProps) => WrappedComponent => {
2424
super(props, context)
2525

2626
this.getWindowSizesWithFallback = () => {
27-
const { fallbackHeight = null, fallbackWidth = null } = this.context
27+
const config = this.context[contextKey] || {}
28+
const { fallbackHeight = null, fallbackWidth = null } = config
2829
return getWindowSizes({ fallbackHeight, fallbackWidth })
2930
}
3031

0 commit comments

Comments
 (0)