snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
26
react/features/base/participants/preloadImage.native.ts
Normal file
26
react/features/base/participants/preloadImage.native.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Image } from 'react-native';
|
||||
|
||||
import { isIconUrl } from './functions';
|
||||
|
||||
/**
|
||||
* Tries to preload an image.
|
||||
*
|
||||
* @param {string | Object} src - Source of the avatar.
|
||||
* @param {boolean} _isUsingCORS - Used on web.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export function preloadImage(src: string | Object, _isUsingCORS: boolean): Promise<any> {
|
||||
if (isIconUrl(src)) {
|
||||
return Promise.resolve(src);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// @ts-ignore
|
||||
Image.prefetch(src).then(
|
||||
() => resolve({
|
||||
src,
|
||||
isUsingCORS: false
|
||||
}),
|
||||
reject);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user