react-image-fallback
Advanced tools
Comparing version 5.0.0 to 6.0.0
{ | ||
"name": "react-image-fallback", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "if your image doesn't exist, fallback onto another provided image.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -55,3 +55,3 @@ # React Image Fallback | ||
Copyright (C) 2016 Social Tables, Inc. (https://www.socialtables.com) All rights reserved. | ||
Copyright (C) 2017 Social Tables, Inc. (https://www.socialtables.com) All rights reserved. | ||
@@ -58,0 +58,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at |
@@ -1,2 +0,2 @@ | ||
import PropTypes from 'prop-types' | ||
import PropTypes from "prop-types" | ||
import React, { Component } from "react"; | ||
@@ -30,5 +30,6 @@ import filterInvalidDOMProps from "filter-invalid-dom-props"; | ||
} | ||
setDisplayImage({ image, fallbacks }) { | ||
const imagesArray = [image].concat(fallbacks); | ||
const fallbacksArray = Array.isArray(fallbacks) ? fallbacks : [fallbacks]; | ||
const imagesArray = image ? [image].concat(fallbacksArray) : fallbacksArray; | ||
this.displayImage.onerror = () => { | ||
@@ -73,3 +74,3 @@ if (imagesArray.length > 2 && typeof imagesArray[1] === "string") { | ||
ReactImageFallback.propTypes = { | ||
src: PropTypes.string.isRequired, | ||
src: PropTypes.string, | ||
fallbackImage: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.array]).isRequired, | ||
@@ -76,0 +77,0 @@ initialImage: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), |
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
16813
306