How to use the expo-asset.Asset 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 passes when used properly', () => {
    const a = new Asset(requiredAssetOptions);
    const b = new Asset({
      hash: 'string',
      width: 1,
      height: 1,
      ...requiredAssetOptions,
    });
    const c = new Asset({
      hash: null,
      width: null,
      height: null,
      ...requiredAssetOptions,
    });
  });
});
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', () => {
    const a = new Asset(requiredAssetOptions);
    const b = new Asset({
      hash: 'string',
      width: 1,
      height: 1,
      ...requiredAssetOptions,
    });
    const c = new Asset({
      hash: null,
      width: null,
      height: null,
      ...requiredAssetOptions,
    });
  });
});
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', () => {
    const a = new Asset(requiredAssetOptions);
    const b = new Asset({
      hash: 'string',
      width: 1,
      height: 1,
      ...requiredAssetOptions,
    });
    const c = new Asset({
      hash: null,
      width: null,
      height: null,
      ...requiredAssetOptions,
    });
  });
});
github expo / expo-asset-utils / dist / index.js View on Github external
async function fromUriAsync(remoteUri, fileName) {
  const { uri, name, hash } = await fileInfoAsync(remoteUri, fileName);

  if (uri) {
    const type = getExtension(name);
    let width = undefined;
    let height = undefined;
    if (isImageType(type)) {
      const size = await imageSizeAsync(uri);
      width = size.width;
      height = size.height;
    }

    return new expoAsset.Asset({ name, type, hash, uri, width, height });
  }
}
github expo / expo-asset-utils / src / fromUriAsync.js View on Github external
async function fromUriAsync(remoteUri: string, fileName: ?string): Promise {
  const { uri, name, hash } = await fileInfoAsync(remoteUri, fileName);

  if (uri) {
    const type = getExtension(name);
    let width = undefined;
    let height = undefined;
    if (isImageType(type)) {
      const size = await getSizeAsync(uri);
      width = size.width;
      height = size.height;
    }

    return new Asset({ name, type, hash, uri, width, height });
  }
}

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