How to use the expo-asset.Asset.fromURI function in expo-asset

To help you get started, we’ve selected a few expo-asset 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 flow-typed / flow-typed / definitions / npm / expo-asset_v4.x.x / flow_v0.104.x- / test_expo-asset.js View on Github external
it('should raise an error when call with invalid argument', () => {
      // $ExpectError: first argument must be a string
      Asset.fromURI(1);
    });
  });
github Marwan01 / food-converter / node_modules / expo-font / build / Font.js View on Github external
function _getAssetForSource(source) {
    if (source instanceof Asset) {
        return source;
    }
    if (!isWeb && typeof source === 'string') {
        return Asset.fromURI(source);
    }
    if (isWeb || typeof source === 'number') {
        return Asset.fromModule(source);
    }
    // @ts-ignore Error: Type 'string' is not assignable to type 'Asset'
    // We can't have a string here, we would have thrown an error if !isWeb
    // or returned Asset.fromModule if isWeb.
    return source;
}
async function _loadSingleFontAsync(name, asset) {
github expo / expo / packages / expo-font / src / FontLoader.ts View on Github external
export function getAssetForSource(source: FontSource): Asset | FontResource {
  if (source instanceof Asset) {
    return source;
  }

  if (typeof source === 'string') {
    return Asset.fromURI(source);
  } else if (typeof source === 'number') {
    return Asset.fromModule(source);
  } else if (typeof source === 'object' && typeof source.uri !== 'undefined') {
    return getAssetForSource(source.uri);
  }

  // @ts-ignore Error: Type 'string' is not assignable to type 'Asset'
  // We can't have a string here, we would have thrown an error if !isWeb
  // or returned Asset.fromModule if isWeb.
  return source;
}
github expo / expo / packages / expo-font / build / FontLoader.js View on Github external
export function getAssetForSource(source) {
    if (source instanceof Asset) {
        return source;
    }
    if (typeof source === 'string') {
        return Asset.fromURI(source);
    }
    else if (typeof source === 'number') {
        return Asset.fromModule(source);
    }
    else if (typeof source === 'object' && typeof source.uri !== 'undefined') {
        return getAssetForSource(source.uri);
    }
    // @ts-ignore Error: Type 'string' is not assignable to type 'Asset'
    // We can't have a string here, we would have thrown an error if !isWeb
    // or returned Asset.fromModule if isWeb.
    return source;
}
export async function loadSingleFontAsync(name, input) {
github Marwan01 / food-converter / node_modules / expo-font / src / Font.ts View on Github external
function _getAssetForSource(source: FontSource): Asset {
  if (source instanceof Asset) {
    return source;
  }

  if (!isWeb && typeof source === 'string') {
    return Asset.fromURI(source);
  }

  if (isWeb || typeof source === 'number') {
    return Asset.fromModule(source);
  }

  // @ts-ignore Error: Type 'string' is not assignable to type 'Asset'
  // We can't have a string here, we would have thrown an error if !isWeb
  // or returned Asset.fromModule if isWeb.
  return source;
}
github flow-typed / flow-typed / definitions / npm / expo-asset_v4.x.x / flow_v0.104.x- / test_expo-asset.js View on Github external
it('should passes when used properly', () => {
      Asset.fromURI('uri').downloadAsync();
    });

expo-asset

An Expo universal module to download assets and pass them into other APIs

MIT
Latest version published 5 months ago

Package Health Score

82 / 100
Full package analysis