mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-16 06:50:25 +00:00
Fix 6.10 remounting/double click issue (#1499)
Fixes https://github.com/tannerlinsley/react-table/issues/1336 (or at least fixes my issue with double click not working)
This commit is contained in:
committed by
Tanner Linsley
parent
8ea48576b8
commit
ab12816799
+30
-1
@@ -204,5 +204,34 @@ function isSortingDesc (d) {
|
||||
}
|
||||
|
||||
function normalizeComponent (Comp, params = {}, fallback = Comp) {
|
||||
return typeof Comp === 'function' ? <Comp {...params} /> : fallback
|
||||
return typeof Comp === 'function' ? (
|
||||
isReactComponent(Comp) ? (
|
||||
<Comp {...params} />
|
||||
) : (
|
||||
Comp(params)
|
||||
)
|
||||
) : (
|
||||
fallback
|
||||
)
|
||||
}
|
||||
|
||||
function isClassComponent (component) {
|
||||
return !!((
|
||||
typeof component === 'function' &&
|
||||
!!component.prototype.isReactComponent
|
||||
))
|
||||
}
|
||||
|
||||
function isFunctionComponent (component) {
|
||||
return !!((
|
||||
typeof component === 'function' &&
|
||||
String(component).includes('return React.createElement')
|
||||
))
|
||||
}
|
||||
|
||||
function isReactComponent (component) {
|
||||
return !!((
|
||||
isClassComponent(component) ||
|
||||
isFunctionComponent(component)
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user