How to use the react-native-fast-image.preload function in react-native-fast-image

To help you get started, we’ve selected a few react-native-fast-image 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 DylanVann / react-native-fast-image / example / FastImageExample.js View on Github external
render() {
    // Force complete re-render.
    const key = uuid()
    // Busting image cache.
    const bust = `?bust=${key}`
    // Preload images.
    FastImage.preload([
      {
        uri: 'https://facebook.github.io/react/img/logo_og.png',
        headers: { Authorization: 'someAuthToken' },
      },
      {
        uri: 'https://facebook.github.io/react/img/logo_og.png',
        headers: { Authorization: 'someAuthToken' },
      },
    ])
    return (
github rainbow-me / rainbow / src / helpers / buildWalletSections.js View on Github external
const withUniqueTokenFamiliesSection = (language, uniqueTokens, data) => {
  // TODO preload elsewhere?
  if (!isPreloadComplete) {
    const imagesToPreload = sortImagesToPreload(
      data.map(buildImagesToPreloadArray)
    );
    isPreloadComplete = !!imagesToPreload.length;
    FastImage.preload(imagesToPreload);
  }

  return {
    collectibles: true,
    data,
    header: {
      title: lang.t('account.tab_collectibles'),
      totalItems: uniqueTokens.length,
      totalValue: '',
    },
    name: 'collectibles',
    renderItem: tokenFamilyItem,
    type: 'big',
  };
};
github SkyzohKey / M-Droid / src / services / RepositoryService.js View on Github external
.then(res => {
          if (res.info().status === 200) {
            FastImage.preload([{ uri: appData.featureGraphic }]);
          } else {
            appData.featureGraphic = null;
          }
        })
        .catch(err => console.log(err));
github rainbow-me / rainbow / src / components / send / SendAssetList.js View on Github external
dataProvider: new DataProvider((r1, r2) => r1 !== r2).cloneWithRows(this.props.allAssets.concat(this.props.uniqueTokens)),
      openCards: [],
    };

    const imageTokens = [];
    this.props.uniqueTokens.forEach(family => {
      family.data.forEach(token => {
        if (token.image_thumbnail_url) {
          imageTokens.push({
            id: token.id,
            uri: token.image_thumbnail_url,
          });
        }
      });
    });
    FastImage.preload(imageTokens);

    this._layoutProvider = new LayoutProvider((i) => {
      if (i < this.props.allAssets.length - 1) {
        return 'COIN_ROW';
      } if (i === this.props.allAssets.length - 1) {
        return 'COIN_ROW_LAST';
      }
      if (this.state.openCards[i - this.props.allAssets.length]) {
        return {
          size: this.props.uniqueTokens[i - this.props.allAssets.length].data.length + 1,
          type: 'COLLECTIBLE_ROW',
        };
      }
      return 'COLLECTIBLE_ROW_CLOSED';
    }, (type, dim) => {
      if (type === 'COIN_ROW') {
github birkir / hekla / src / components / meta-link / MetaLink.tsx View on Github external
async fetch() {
    const { url } = this.props;
    if (!url || this.state.title || this.state.image) return;
    this.setState({ loading: true });
    const { title, image } = await fetchMetadata(url);
    if (this.dead) return;
    if (image && typeof image.url === 'string' && this.showThumbnail) {
      const res = await FastImage.preload([{ uri: image.url }]);
    }
    if (this.dead) return;
    this.setState({
      title,
      image,
      loading: false,
    });
  }

react-native-fast-image

🚩 FastImage, performant React Native image component.

MIT
Latest version published 2 years ago

Package Health Score

61 / 100
Full package analysis