Skip to content

Commit

Permalink
Fix React version check to support 16.10 (#1407)
Browse files Browse the repository at this point in the history
* Fix React version check to support 16.10

Since `parseFloat(React.version)` resolves to `16.1`, that breaks our version check. So, I've switched to checking against the `forwardRef` API's existence, which was also added in 16.3.

* Also fix the version check in connectAdvanced.
  • Loading branch information
timdorr committed Oct 1, 2019
1 parent 9137f7f commit 4144715
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import { storeShape, subscriptionShape } from '../utils/PropTypes'
import warning from '../utils/warning'

const prefixUnsafeLifecycleMethods = parseFloat(React.version) >= 16.3
const prefixUnsafeLifecycleMethods = typeof React.forwardRef !== "undefined"

let didWarnAboutReceivingStore = false
function warnAboutReceivingStore() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/connectAdvanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isValidElementType } from 'react-is'
import Subscription from '../utils/Subscription'
import { storeShape, subscriptionShape } from '../utils/PropTypes'

const prefixUnsafeLifecycleMethods = parseFloat(React.version) >= 16.3
const prefixUnsafeLifecycleMethods = typeof React.forwardRef !== "undefined"

let hotReloadingVersion = 0
const dummyState = {}
Expand Down

0 comments on commit 4144715

Please sign in to comment.