How to use the expo-constants.experienceUrl function in expo-constants

To help you get started, we’ve selected a few expo-constants 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-constants_v4.x.x / flow_v0.69.0-v0.103.x / test_expo-constants.js View on Github external
it('should raise an error when lead to an incompatible type', () => {
      // $ExpectError
      (Constants.debugMode: 'ups...');
      // $ExpectError
      (Constants.deviceName: 'ups...');
      // $ExpectError
      (Constants.deviceYearClass: 'ups...');
      // $ExpectError
      (Constants.experienceUrl: 'ups...');
      // $ExpectError
      (Constants.expoRuntimeVersion: 'ups...');
      // $ExpectError
      (Constants.expoVersion: 'ups...');
      // $ExpectError
      (Constants.isDetached: 'ups...');
      // $ExpectError
      (Constants.intentUri: 'ups...');
      // $ExpectError
      (Constants.installationId: 'ups...');
      // $ExpectError
      (Constants.isDevice: 'ups...');
      // $ExpectError
      (Constants.isHeadless: 'ups...');
      // $ExpectError
      (Constants.linkingUri: 'ups...');
github expo / expo / packages / expo-asset / build / AssetSources.js View on Github external
import Constants from 'expo-constants';
import { Platform } from '@unimodules/core';
import path from 'path-browserify';
import { PixelRatio } from 'react-native';
import URL from 'url-parse';
import AssetSourceResolver from './AssetSourceResolver';
import { getManifestBaseUrl } from './AssetUris';
// Fast lookup check if asset map has any overrides in the manifest
const assetMapOverride = Constants.manifest && Constants.manifest.assetMapOverride;
// Compute manifest base URL if available
const manifestBaseUrl = Constants.experienceUrl
    ? getManifestBaseUrl(Constants.experienceUrl)
    : null;
/**
 * Selects the best file for the given asset (ex: choosing the best scale for images) and returns
 * a { uri, hash } pair for the specific asset file.
 *
 * If the asset isn't an image with multiple scales, the first file is selected.
 */
export function selectAssetSource(meta) {
    // Override with the asset map in manifest if available
    if (assetMapOverride && assetMapOverride.hasOwnProperty(meta.hash)) {
        meta = { ...meta, ...assetMapOverride[meta.hash] };
    }
    // This logic is based on that of AssetSourceResolver, with additional support for file hashes and
    // explicitly provided URIs
    const scale = AssetSourceResolver.pickScale(meta.scales, PixelRatio.get());
    const index = meta.scales.findIndex(s => s === scale);
github expo / expo / packages / expo-asset / src / AssetSources.ts View on Github external
httpServerLocation: string;
  uri?: string;
  fileHashes?: string[];
  fileUris?: string[];
};

export type AssetSource = {
  uri: string;
  hash: string;
};

// Fast lookup check if asset map has any overrides in the manifest
const assetMapOverride = Constants.manifest && Constants.manifest.assetMapOverride;

// Compute manifest base URL if available
const manifestBaseUrl = Constants.experienceUrl
  ? getManifestBaseUrl(Constants.experienceUrl)
  : null;

/**
 * Selects the best file for the given asset (ex: choosing the best scale for images) and returns
 * a { uri, hash } pair for the specific asset file.
 *
 * If the asset isn't an image with multiple scales, the first file is selected.
 */
export function selectAssetSource(meta: AssetMetadata): AssetSource {
  // Override with the asset map in manifest if available
  if (assetMapOverride && assetMapOverride.hasOwnProperty(meta.hash)) {
    meta = { ...meta, ...assetMapOverride[meta.hash] };
  }

  // This logic is based on that of AssetSourceResolver, with additional support for file hashes and
github expo / expo / packages / expo-asset / src / AssetSources.ts View on Github external
uri?: string;
  fileHashes?: string[];
  fileUris?: string[];
};

export type AssetSource = {
  uri: string;
  hash: string;
};

// Fast lookup check if asset map has any overrides in the manifest
const assetMapOverride = Constants.manifest && Constants.manifest.assetMapOverride;

// Compute manifest base URL if available
const manifestBaseUrl = Constants.experienceUrl
  ? getManifestBaseUrl(Constants.experienceUrl)
  : null;

/**
 * Selects the best file for the given asset (ex: choosing the best scale for images) and returns
 * a { uri, hash } pair for the specific asset file.
 *
 * If the asset isn't an image with multiple scales, the first file is selected.
 */
export function selectAssetSource(meta: AssetMetadata): AssetSource {
  // Override with the asset map in manifest if available
  if (assetMapOverride && assetMapOverride.hasOwnProperty(meta.hash)) {
    meta = { ...meta, ...assetMapOverride[meta.hash] };
  }

  // This logic is based on that of AssetSourceResolver, with additional support for file hashes and
  // explicitly provided URIs
github expo / expo / packages / expo-asset / build / AssetSources.js View on Github external
import Constants from 'expo-constants';
import { Platform } from '@unimodules/core';
import path from 'path-browserify';
import { PixelRatio } from 'react-native';
import URL from 'url-parse';
import AssetSourceResolver from './AssetSourceResolver';
import { getManifestBaseUrl } from './AssetUris';
// Fast lookup check if asset map has any overrides in the manifest
const assetMapOverride = Constants.manifest && Constants.manifest.assetMapOverride;
// Compute manifest base URL if available
const manifestBaseUrl = Constants.experienceUrl
    ? getManifestBaseUrl(Constants.experienceUrl)
    : null;
/**
 * Selects the best file for the given asset (ex: choosing the best scale for images) and returns
 * a { uri, hash } pair for the specific asset file.
 *
 * If the asset isn't an image with multiple scales, the first file is selected.
 */
export function selectAssetSource(meta) {
    // Override with the asset map in manifest if available
    if (assetMapOverride && assetMapOverride.hasOwnProperty(meta.hash)) {
        meta = { ...meta, ...assetMapOverride[meta.hash] };
    }
    // This logic is based on that of AssetSourceResolver, with additional support for file hashes and
    // explicitly provided URIs
    const scale = AssetSourceResolver.pickScale(meta.scales, PixelRatio.get());