Merged PR 785242: Add delay to image load to work around Bing issue.
Add delay to image load to work around Bing issue.
This commit is contained in:
Родитель
15b6faf413
Коммит
4b35a3b128
|
@ -63,6 +63,18 @@ export class ImageView extends React.Component {
|
|||
});
|
||||
}
|
||||
};
|
||||
this.fetchImageSize = () => {
|
||||
const { model, size, maxWidth, maxHeight } = this.props;
|
||||
if (model) {
|
||||
if (model.context) {
|
||||
let handler = model.context.infoHandler;
|
||||
if (handler) {
|
||||
handler(`AdaptiveCard >> Start load img >> ${model.url}`);
|
||||
}
|
||||
}
|
||||
ImageUtils.fetchSize(model.url, size || model.size, { width: maxWidth, height: maxHeight }, this.onImageSize, this.onImageSizeError);
|
||||
}
|
||||
};
|
||||
this.state = {
|
||||
loaded: false,
|
||||
width: 0,
|
||||
|
@ -71,16 +83,7 @@ export class ImageView extends React.Component {
|
|||
}
|
||||
componentDidMount() {
|
||||
this.mounted = true;
|
||||
const { model, size, maxWidth, maxHeight } = this.props;
|
||||
if (model) {
|
||||
if (model.context) {
|
||||
let handler = model.context.infoHandler;
|
||||
if (handler) {
|
||||
handler(`AdaptiveCard >> Start load img >> ${model.url}`);
|
||||
}
|
||||
}
|
||||
ImageUtils.fetchSize(model.url, size || model.size, { width: maxWidth, height: maxHeight }, this.onImageSize, this.onImageSizeError);
|
||||
}
|
||||
setTimeout(this.fetchImageSize, 500);
|
||||
}
|
||||
componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
|
|
|
@ -63,6 +63,18 @@ export class ImageView extends React.Component {
|
|||
});
|
||||
}
|
||||
};
|
||||
this.fetchImageSize = () => {
|
||||
const { model, size, maxWidth, maxHeight } = this.props;
|
||||
if (model) {
|
||||
if (model.context) {
|
||||
let handler = model.context.infoHandler;
|
||||
if (handler) {
|
||||
handler(`AdaptiveCard >> Start load img >> ${model.url}`);
|
||||
}
|
||||
}
|
||||
ImageUtils.fetchSize(model.url, size || model.size, { width: maxWidth, height: maxHeight }, this.onImageSize, this.onImageSizeError);
|
||||
}
|
||||
};
|
||||
this.state = {
|
||||
loaded: false,
|
||||
width: 0,
|
||||
|
@ -71,16 +83,7 @@ export class ImageView extends React.Component {
|
|||
}
|
||||
componentDidMount() {
|
||||
this.mounted = true;
|
||||
const { model, size, maxWidth, maxHeight } = this.props;
|
||||
if (model) {
|
||||
if (model.context) {
|
||||
let handler = model.context.infoHandler;
|
||||
if (handler) {
|
||||
handler(`AdaptiveCard >> Start load img >> ${model.url}`);
|
||||
}
|
||||
}
|
||||
ImageUtils.fetchSize(model.url, size || model.size, { width: maxWidth, height: maxHeight }, this.onImageSize, this.onImageSizeError);
|
||||
}
|
||||
setTimeout(this.fetchImageSize, 500);
|
||||
}
|
||||
componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
|
|
|
@ -39,24 +39,7 @@ export class ImageView extends React.Component<IProps, IState> {
|
|||
public componentDidMount() {
|
||||
this.mounted = true;
|
||||
|
||||
const { model, size, maxWidth, maxHeight } = this.props;
|
||||
|
||||
if (model) {
|
||||
if (model.context) {
|
||||
let handler = model.context.infoHandler;
|
||||
if (handler) {
|
||||
handler(`AdaptiveCard >> Start load img >> ${model.url}`);
|
||||
}
|
||||
}
|
||||
|
||||
ImageUtils.fetchSize(
|
||||
model.url,
|
||||
size || model.size,
|
||||
{ width: maxWidth, height: maxHeight },
|
||||
this.onImageSize,
|
||||
this.onImageSizeError
|
||||
);
|
||||
}
|
||||
setTimeout(this.fetchImageSize, 500);
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
|
@ -167,6 +150,27 @@ export class ImageView extends React.Component<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
private fetchImageSize = () => {
|
||||
const { model, size, maxWidth, maxHeight } = this.props;
|
||||
|
||||
if (model) {
|
||||
if (model.context) {
|
||||
let handler = model.context.infoHandler;
|
||||
if (handler) {
|
||||
handler(`AdaptiveCard >> Start load img >> ${model.url}`);
|
||||
}
|
||||
}
|
||||
|
||||
ImageUtils.fetchSize(
|
||||
model.url,
|
||||
size || model.size,
|
||||
{ width: maxWidth, height: maxHeight },
|
||||
this.onImageSize,
|
||||
this.onImageSizeError
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private get flex() {
|
||||
const { model, size } = this.props;
|
||||
|
||||
|
|
|
@ -63,6 +63,18 @@ export class ImageView extends React.Component {
|
|||
});
|
||||
}
|
||||
};
|
||||
this.fetchImageSize = () => {
|
||||
const { model, size, maxWidth, maxHeight } = this.props;
|
||||
if (model) {
|
||||
if (model.context) {
|
||||
let handler = model.context.infoHandler;
|
||||
if (handler) {
|
||||
handler(`AdaptiveCard >> Start load img >> ${model.url}`);
|
||||
}
|
||||
}
|
||||
ImageUtils.fetchSize(model.url, size || model.size, { width: maxWidth, height: maxHeight }, this.onImageSize, this.onImageSizeError);
|
||||
}
|
||||
};
|
||||
this.state = {
|
||||
loaded: false,
|
||||
width: 0,
|
||||
|
@ -71,16 +83,7 @@ export class ImageView extends React.Component {
|
|||
}
|
||||
componentDidMount() {
|
||||
this.mounted = true;
|
||||
const { model, size, maxWidth, maxHeight } = this.props;
|
||||
if (model) {
|
||||
if (model.context) {
|
||||
let handler = model.context.infoHandler;
|
||||
if (handler) {
|
||||
handler(`AdaptiveCard >> Start load img >> ${model.url}`);
|
||||
}
|
||||
}
|
||||
ImageUtils.fetchSize(model.url, size || model.size, { width: maxWidth, height: maxHeight }, this.onImageSize, this.onImageSizeError);
|
||||
}
|
||||
setTimeout(this.fetchImageSize, 500);
|
||||
}
|
||||
componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче