MCPcopy Create free account
hub / github.com/microsoft/SandDance / ImageBase1

Function ImageBase1

docs/app/js/sanddance-app.js:26540–26566  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

26538var ImageBase = /** @class */ function(_super) {
26539 (0, _tslib.__extends)(ImageBase1, _super);
26540 function ImageBase1(props) {
26541 var _this = _super.call(this, props) || this;
26542 // Make an initial assumption about the image layout until we can
26543 // check the rendered element. The value here only takes effect when
26544 // shouldStartVisible is true.
26545 _this._coverStyle = (0, _imageTypes.ImageCoverStyle).portrait;
26546 _this._imageElement = _react.createRef();
26547 _this._frameElement = _react.createRef();
26548 _this._onImageLoaded = function(ev) {
26549 var _a = _this.props, src = _a.src, onLoad = _a.onLoad;
26550 if (onLoad) onLoad(ev);
26551 _this._computeCoverStyle(_this.props);
26552 if (src) _this.setState({
26553 loadState: (0, _imageTypes.ImageLoadState).loaded
26554 });
26555 };
26556 _this._onImageError = function(ev) {
26557 if (_this.props.onError) _this.props.onError(ev);
26558 _this.setState({
26559 loadState: (0, _imageTypes.ImageLoadState).error
26560 });
26561 };
26562 _this.state = {
26563 loadState: (0, _imageTypes.ImageLoadState).notLoaded
26564 };
26565 return _this;
26566 }
26567 ImageBase1.prototype.UNSAFE_componentWillReceiveProps = function(nextProps) {
26568 if (nextProps.src !== this.props.src) this.setState({
26569 loadState: (0, _imageTypes.ImageLoadState).notLoaded

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected