How to use the expo-asset-utils.resolveAsync function in expo-asset-utils

To help you get started, we’ve selected a few expo-asset-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo-three / src / TextureLoader.ts View on Github external
(async () => {
      const nativeAsset = await AssetUtils.resolveAsync(asset);

      function parseAsset(image) {
        texture.image = image;

        // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB.
        texture.format = formatFromURI(nativeAsset.localUri);
        texture.needsUpdate = true;

        if (onLoad !== undefined) {
          onLoad(texture);
        }
      }

      if (Platform.OS === 'web') {
        loader.load(
          nativeAsset.localUri,
github reggie3 / react-native-webview-quilljs / WebViewQuillJS / WebViewQuill.tsx View on Github external
private loadHTMLFile = async () => {
    try {
      let asset: Asset = await AssetUtils.resolveAsync(INDEX_FILE_PATH);
      let fileString: string = await FileSystem.readAsStringAsync(
        asset.localUri
      );

      this.setState({ webviewContent: fileString });
    } catch (error) {
      console.warn(error);
      console.warn("Unable to resolve index file");
    }
  };
github reggie3 / react-native-webview-quilljs / WebViewQuillEditor.js View on Github external
componentDidMount = async () => {
    try {
      const asset = await AssetUtils.resolveAsync(requiredAsset)
      console.log({asset})
      this.setState({ asset })
    } catch (error) {
      console.log({ error })
    }
  };
github kognise / repl.it-mobile / components / webViews / Editor.js View on Github external
async loadHtml() {
      const { uri } = await AssetUtils.resolveAsync(editorCode)
      const res = await fetch(uri)
      const html = await res.text()
      this.setState({ source: html })
    }
github expo / expo-pixi / lib / textureAsync.js View on Github external
async function textureAsync(resource) {
  const asset = await AssetUtils.resolveAsync(resource);
  return texture(asset);
}
export default textureAsync;
github expo / expo-pixi / lib / Pixi.js View on Github external
const textureFromExpoAsync = async resource => {
    let asset = resource;
    if (Platform.OS !== 'web') {
      asset = await resolveAsync(resource);
    }
    return PIXI.Texture.from(asset);
  };
github expo / expo-three / build / resolveAsset.js View on Github external
export default async function resolveAsset(fileReference) {
    let urls = [];
    if (Array.isArray(fileReference)) {
        for (let file of fileReference) {
            const asset = await resolveAsync(file);
            urls.push(asset);
        }
    }
    else {
        const asset = await resolveAsync(fileReference);
        urls.push(asset);
    }
    return urls;
}
export async function stringFromAsset(asset) {
github expo / expo-three / src / resolveAsset.ts View on Github external
export default async function resolveAsset(fileReference: any): Promise {
  let urls: Asset[] = [];
  if (Array.isArray(fileReference)) {
    for (let file of fileReference) {
      const asset = await resolveAsync(file);
      urls.push(asset);
    }
  } else {
    const asset = await resolveAsync(fileReference);
    urls.push(asset);
  }
  return urls;
}
github gre / gl-react / examples / cookbook-expo / gl-react-implementation.js View on Github external
set src(src) {
    if (this._src === src) return;
    delete this.localUri;
    this._src = src;

    if (src) {
      resolveAsync(src).then(({ localUri }) => {
        this.localUri = localUri;
        if (this.onload) this.onload();
      });
    }
  }
};

expo-asset-utils

Utilities for converting files into Expo Assets

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis