react-detect-offline
Advanced tools
Comparing version 1.0.6 to 2.0.0
@@ -24,3 +24,4 @@ "use strict"; | ||
var unsupportedUserAgentsPattern = /Windows.*Chrome/; | ||
// these browsers don't fully support navigator.onLine, so we need to use a polling backup | ||
var unsupportedUserAgentsPattern = /Windows.*Chrome|Windows.*Firefox/; | ||
@@ -85,3 +86,4 @@ var config = { | ||
var children = this.props.children; | ||
var wrapperType = this.props.wrapperType; | ||
var _props$wrapperType = this.props.wrapperType, | ||
wrapperType = _props$wrapperType === undefined ? "span" : _props$wrapperType; | ||
@@ -102,12 +104,3 @@ // usual case: one child that is a react Element | ||
var firstChild = childrenArray[0]; | ||
// use wrapperType if specified | ||
if (!wrapperType) { | ||
if (typeof firstChild === "string" || firstChild.type === "span") { | ||
// use span for string or span children | ||
wrapperType = "span"; | ||
} else { | ||
// fallback on div | ||
wrapperType = "div"; | ||
} | ||
} | ||
return _react.createElement.apply(undefined, [wrapperType, {}].concat(_toConsumableArray(childrenArray))); | ||
@@ -114,0 +107,0 @@ } |
{ | ||
"name": "react-detect-offline", | ||
"version": "1.0.6", | ||
"version": "2.0.0", | ||
"description": "Offline and Online components for React", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -8,3 +8,4 @@ import React, { | ||
const unsupportedUserAgentsPattern = /Windows.*Chrome/; | ||
// these browsers don't fully support navigator.onLine, so we need to use a polling backup | ||
const unsupportedUserAgentsPattern = /Windows.*Chrome|Windows.*Firefox/; | ||
@@ -53,5 +54,6 @@ const config = { | ||
} | ||
renderChildren() { | ||
const { children } = this.props; | ||
let { wrapperType } = this.props; | ||
const { wrapperType = "span" } = this.props; | ||
@@ -71,12 +73,3 @@ // usual case: one child that is a react Element | ||
const firstChild = childrenArray[0]; | ||
// use wrapperType if specified | ||
if (!wrapperType) { | ||
if (typeof firstChild === "string" || firstChild.type === "span") { | ||
// use span for string or span children | ||
wrapperType = "span"; | ||
} else { | ||
// fallback on div | ||
wrapperType = "div"; | ||
} | ||
} | ||
return createElement(wrapperType, {}, ...childrenArray); | ||
@@ -83,0 +76,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71542
298