rax-image
Advanced tools
Comparing version 2.2.5 to 2.2.6
@@ -1,6 +0,13 @@ | ||
# changelog | ||
# Changelog | ||
## 2.2.4 | ||
- [feat] Support loading | ||
## 2.2.2 | ||
- [feat] Support ref | ||
## v2.2.7 | ||
- Fix fallbackSource with error alicdn source uri | ||
## v2.2.6 | ||
- Format npm output files | ||
## v2.2.4 | ||
- Support `loading` property in Web and Miniapp |
@@ -1,1 +0,1 @@ | ||
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t};const a={},c=Object(n.forwardRef)((e,r)=>{var{source:t,fallbackSource:c,onLoad:l,onError:s,style:f,resizeMode:p,loading:d}=e,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;const y=b,[g,O]=Object(n.useState)({});y.onError=Object(n.useCallback)(e=>{void 0===g.uri&&O({uri:t.uri}),s&&s(e)},[t.uri,s,g]),y.onLoad=Object(n.useCallback)(e=>{o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):s&&s(e)},[l,s]),void 0!==g.uri&&(g.uri!==t.uri?g.uri=void 0:null!=c.uri&&(t=c));const{width:v,height:j,uri:h}=t;return y.src=h,y.style=Object.assign({width:v,height:j},f),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))});r.default=c}]); | ||
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="/",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t};const a={},c=Object(n.forwardRef)(((e,r)=>{var{source:t,fallbackSource:c,onLoad:l,onError:s,style:f,resizeMode:p,loading:d}=e,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;const y=b,[g,O]=Object(n.useState)({});y.onError=Object(n.useCallback)((e=>{void 0===g.uri&&O({uri:t.uri}),s&&s(e)}),[t.uri,s,g]),y.onLoad=Object(n.useCallback)((e=>{o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):(void 0===g.uri&&O({uri:t.uri}),s&&s(e))}),[l,s]),void 0!==g.uri&&(g.uri!==t.uri?g.uri=void 0:null!=c.uri&&(t=c));const{width:v,height:j,uri:h}=t;return y.src=h,y.style=Object.assign({width:v,height:j},f),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))}));r.default=c}]); |
@@ -1,1 +0,1 @@ | ||
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},a={},c=Object(n.forwardRef)((function(e,r){var t=e.source,c=e.fallbackSource,l=e.onLoad,s=e.onError,f=e.style,p=e.resizeMode,d=e.loading,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;var y=b,g=Object(n.useState)({}),O=g[0],v=g[1];y.onError=Object(n.useCallback)((function(e){void 0===O.uri&&v({uri:t.uri}),s&&s(e)}),[t.uri,s,O]),y.onLoad=Object(n.useCallback)((function(e){o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):s&&s(e)}),[l,s]),void 0!==O.uri&&(O.uri!==t.uri?O.uri=void 0:null!=c.uri&&(t=c));var j=t,h=j.width,m=j.height,x=j.uri;return y.src=x,y.style=Object.assign({width:h,height:m},f),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))}));r.default=c}]); | ||
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="/",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},a={},c=Object(n.forwardRef)((function(e,r){var t=e.source,c=e.fallbackSource,l=e.onLoad,s=e.onError,f=e.style,p=e.resizeMode,d=e.loading,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;var y=b,g=Object(n.useState)({}),O=g[0],v=g[1];y.onError=Object(n.useCallback)((function(e){void 0===O.uri&&v({uri:t.uri}),s&&s(e)}),[t.uri,s,O]),y.onLoad=Object(n.useCallback)((function(e){o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):(void 0===O.uri&&v({uri:t.uri}),s&&s(e))}),[l,s]),void 0!==O.uri&&(O.uri!==t.uri?O.uri=void 0:null!=c.uri&&(t=c));var j=t,h=j.width,m=j.height,x=j.uri;return y.src=x,y.style=Object.assign({width:h,height:m},f),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))}));r.default=c}]); |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.raxImage=r():e.raxImage=r()}(window,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="./",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},a={},c=Object(n.forwardRef)((function(e,r){var t=e.source,c=e.fallbackSource,l=e.onLoad,f=e.onError,s=e.style,p=e.resizeMode,d=e.loading,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;var y=b,g=Object(n.useState)({}),O=g[0],j=g[1];y.onError=Object(n.useCallback)((function(e){void 0===O.uri&&j({uri:t.uri}),f&&f(e)}),[t.uri,f,O]),y.onLoad=Object(n.useCallback)((function(e){o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):f&&f(e)}),[l,f]),void 0!==O.uri&&(O.uri!==t.uri?O.uri=void 0:null!=c.uri&&(t=c));var v=t,m=v.width,x=v.height,h=v.uri;return y.src=h,y.style=Object.assign({width:m,height:x},s),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))}));r.default=c}])})); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.raxImage=r():e.raxImage=r()}(window,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="/",t(t.s=2)}([function(e,r){e.exports=require("universal-env")},function(e,r){e.exports=require("rax")},function(e,r,t){e.exports=t(3)},function(e,r,t){"use strict";t.r(r);var n=t(1),o=t(0);function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var u=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t},a={},c=Object(n.forwardRef)((function(e,r){var t=e.source,c=e.fallbackSource,l=e.onLoad,f=e.onError,s=e.style,p=e.resizeMode,d=e.loading,b=u(e,["source","fallbackSource","onLoad","onError","style","resizeMode","loading"]);t=t||a,c=c||a;var y=b,g=Object(n.useState)({}),O=g[0],v=g[1];y.onError=Object(n.useCallback)((function(e){void 0===O.uri&&v({uri:t.uri}),f&&f(e)}),[t.uri,f,O]),y.onLoad=Object(n.useCallback)((function(e){o.isMiniApp||o.isWeChatMiniProgram||e&&e.success||e&&e.currentTarget&&e.currentTarget.naturalWidth>1&&e.currentTarget.naturalHeight>1?l&&l(e):(void 0===O.uri&&v({uri:t.uri}),f&&f(e))}),[l,f]),void 0!==O.uri&&(O.uri!==t.uri?O.uri=void 0:null!=c.uri&&(t=c));var j=t,m=j.width,x=j.height,h=j.uri;return y.src=h,y.style=Object.assign({width:m,height:x},s),d&&(o.isWeb?y.loading=d:(o.isMiniApp||o.isWeChatMiniProgram||o.isByteDanceMicroApp)&&(y["lazy-load"]="lazy"===d)),(p=p||y.style.resizeMode)&&(o.isWeex?(y.resize=p,y.style.resizeMode=p):y.style.objectFit=p),o.isWeex?Object(n.createElement)("image",i({quality:"original"},y,{ref:r})):Object(n.createElement)("img",i({},y,{ref:r}))}));r.default=c}])})); |
@@ -12,25 +12,14 @@ "use strict"; | ||
var __rest = void 0 && (void 0).__rest || function (s, e) { | ||
var t = {}; | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
} | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var EMPTY_SOURCE = {}; | ||
var Image = (0, _rax.forwardRef)(function (_a, ref) { | ||
var source = _a.source, | ||
fallbackSource = _a.fallbackSource, | ||
onLoad = _a.onLoad, | ||
onError = _a.onError, | ||
style = _a.style, | ||
resizeMode = _a.resizeMode, | ||
loading = _a.loading, | ||
otherProps = __rest(_a, ["source", "fallbackSource", "onLoad", "onError", "style", "resizeMode", "loading"]); | ||
var Image = (0, _rax.forwardRef)(function (_ref, ref) { | ||
var source = _ref.source, | ||
fallbackSource = _ref.fallbackSource, | ||
onLoad = _ref.onLoad, | ||
onError = _ref.onError, | ||
style = _ref.style, | ||
resizeMode = _ref.resizeMode, | ||
loading = _ref.loading, | ||
otherProps = _objectWithoutPropertiesLoose(_ref, ["source", "fallbackSource", "onLoad", "onError", "style", "resizeMode", "loading"]); | ||
@@ -61,6 +50,13 @@ source = source || EMPTY_SOURCE; | ||
onLoad && onLoad(e); | ||
} else if (e && e.currentTarget && e.currentTarget.naturalWidth > 1 && e.currentTarget.naturalHeight > 1) { | ||
} else if ( // alicdn will return an 1x1 img when img is not loaded successfully | ||
e && e.currentTarget && e.currentTarget.naturalWidth > 1 && e.currentTarget.naturalHeight > 1) { | ||
// web | ||
onLoad && onLoad(e); | ||
} else { | ||
if (errorState.uri === undefined) { | ||
setErrorState({ | ||
uri: source.uri | ||
}); | ||
} | ||
onError && onError(e); | ||
@@ -83,3 +79,3 @@ } | ||
nativeProps.src = uri; | ||
nativeProps.style = Object.assign({ | ||
nativeProps.style = _extends({ | ||
width: width, | ||
@@ -111,2 +107,3 @@ height: height | ||
if (_universalEnv.isWeex) { | ||
// @ts-ignore | ||
return (0, _rax.createElement)("image", _extends({ | ||
@@ -113,0 +110,0 @@ quality: "original" |
{ | ||
"name": "rax-image", | ||
"version": "2.2.5", | ||
"version": "2.2.6", | ||
"description": "Image component for Rax.", | ||
"license": "BSD-3-Clause", | ||
"main": "lib/index.js", | ||
"module": "es/index.js", | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
"es", | ||
"lib", | ||
"dist" | ||
], | ||
"miniprogram": ".", | ||
"types": "lib/index.d.ts", | ||
"miniappConfig": { | ||
"main": "lib/miniapp/index", | ||
"main:wechat": "lib/miniapp-wechat/index", | ||
"main:bytedance": "lib/bytedance-microapp/index", | ||
"main:quickapp": "lib/quickapp/index" | ||
}, | ||
"quickappConfig": { | ||
"main": "lib/quickapp/index" | ||
}, | ||
"scripts": { | ||
"clean": "rm -rf ./lib ./package-lock.json ./demo/miniapp/lib ", | ||
"build": "npm run clean && ../../node_modules/.bin/build-scripts build --config ../../build.json", | ||
"build": "../../node_modules/.bin/build-scripts build --config ../../build.json --skip-demo", | ||
"start": "../../node_modules/.bin/build-scripts start --config ../../build.json", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"files": [ | ||
"dist", | ||
"lib", | ||
"src" | ||
], | ||
"repository": { | ||
@@ -24,13 +33,11 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/raxjs/rax-components/issues" | ||
}, | ||
"homepage": "https://github.com/raxjs/rax-components#readme", | ||
"keywords": [ | ||
"Rax", | ||
"rax-component" | ||
"rax-component", | ||
"react-component" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/alibaba/rax/issues" | ||
}, | ||
"homepage": "https://github.com/alibaba/rax#readme", | ||
"engines": { | ||
"npm": ">=3.0.0" | ||
}, | ||
"dependencies": { | ||
@@ -56,12 +63,3 @@ "universal-env": "^3.0.0" | ||
"typescript": "^3.5.3" | ||
}, | ||
"miniappConfig": { | ||
"main": "lib/miniapp/index", | ||
"main:wechat": "lib/miniapp-wechat/index", | ||
"main:bytedance": "lib/bytedance-microapp/index", | ||
"main:quickapp": "lib/quickapp/index" | ||
}, | ||
"quickappConfig": { | ||
"main": "lib/quickapp/index" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
68011
63
1301
4
1