How to use the expo.Asset.loadAsync function in expo

To help you get started, we’ve selected a few expo 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 tenx-tech / stargazer / app / src / App.tsx View on Github external
async preloadAssets(): Promise {
    try {
      if (this.props.fontAssets) {
        // @ts-ignore - prop type should be correct I think the Expo type is wrong
        await Font.loadAsync(this.props.fontAssets);
      }
    } catch (err) {
      console.log(
        "Error fetching providing fontAssets - please check they match the expected format. Error:",
        err,
      );
    }

    try {
      await Asset.loadAsync(
        [require("./stargazer.png")].concat(this.props.imageAssets || []),
      );
    } catch (err) {
      console.log(
        "Error fetching providing imageAssets - please check they match the expected format. Error:",
        err,
      );
    }
  }
github HaysS / firebase-login-app / App.js View on Github external
_loadResourcesAsync = async () => {
    return Promise.all([
      Asset.loadAsync([
        require('./assets/images/robot-dev.png'),
        require('./assets/images/robot-prod.png'),
      ]),
      Font.loadAsync({
        // This is the font that we are using for our tab bar
        ...Icon.Ionicons.font,
        // We include SpaceMono because we use it in HomeScreen.js. Feel free
        // to remove this if you are not using it in your app
        'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
      }),
    ]);
  };
github by12380 / react-universal / Client / Expo / App.js View on Github external
_loadResourcesAsync = async () => {
    return Promise.all([
      Asset.loadAsync([
        require('./assets/images/robot-dev.png'),
        require('./assets/images/robot-prod.png'),
      ]),
      Font.loadAsync({
        // This is the font that we are using for our tab bar
        ...Icon.Ionicons.font,
        // We include SpaceMono because we use it in HomeScreen.js. Feel free
        // to remove this if you are not using it in your app
        'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
      }),
    ]);
  };
github DefinitelyTyped / DefinitelyTyped / types / expo / v23 / expo-tests.tsx View on Github external
obj.z;
});
Accelerometer.removeAllListeners();
Accelerometer.setUpdateInterval(1000);

Amplitude.initialize('key');
Amplitude.setUserId('userId');
Amplitude.setUserProperties({key: 1});
Amplitude.clearUserProperties();
Amplitude.logEvent('name');
Amplitude.logEventWithProperties('event', {key: 'value'});
Amplitude.setGroup('type', {key: 'value'});

const asset = Asset.fromModule(1);
asset.downloadAsync();
Asset.loadAsync(1);
Asset.loadAsync([1, 2, 3]);
const asset1 = new Asset({
    uri: 'uri',
    type: 'type',
    name: 'name',
    hash: 'hash',
    width: 122,
    height: 122
});

const url = AuthSession.getRedirectUrl();
AuthSession.dismiss();
AuthSession.startAsync({
    authUrl: 'url1',
    returnUrl: 'url2'
}).then(result => {
github wcandillon / can-it-be-done-in-react-native / youtube-transitions / App.js View on Github external
videos.map(video => Promise.all([
        Asset.loadAsync(video.video),
        Asset.loadAsync(video.avatar),
        Asset.loadAsync(video.thumbnail),
      ])),
    );
github wcandillon / can-it-be-done-in-react-native / youtube-transitions / App.js View on Github external
videos.map(video => Promise.all([
        Asset.loadAsync(video.video),
        Asset.loadAsync(video.avatar),
        Asset.loadAsync(video.thumbnail),
      ])),
    );
github wcandillon / can-it-be-done-in-react-native / flutter-animations / App.js View on Github external
    await Promise.all(sections.map(section => Asset.loadAsync(section.image)));
    this.setState({ ready: true });
github wcandillon / can-it-be-done-in-react-native / snapchat-discovery / App.js View on Github external
await Promise.all(stories.map(story => Promise.all([
      Asset.loadAsync(story.source),
      Asset.loadAsync(story.avatar),
    ])));
    this.setState({ ready: true });
github nomadcoders / nomadgrapp / App.js View on Github external
_loadAssetsAsync = async () => {
    return Promise.all([
      Asset.loadAsync([
        require("./assets/images/logo.png"),
        require("./assets/images/logo-white.png"),
        require("./assets/images/noPhoto.jpg"),
        require("./assets/images/photoPlaceholder.png")
      ]),
      Font.loadAsync({
        ...Ionicons.font,
        ...MaterialIcons.font
      })
    ]);
  };
  _handleLoadingError = error => {