0.2.0 • Published 4 years ago

@mutagen-d/react-native-image-cache v0.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

React Native Image Cache

Caching images to disk

Installation

This package depends on rn-fetch-blob. First install it

npm i @mutagen-d/react-native-image-cache
// or
yarn add @mutagen-d/react-native-image-cache

Usage

ImageCache inherits all methods of RNFileCache from @mutagen-d/react-native-file-cache

import React, { useEffect } from 'react'
import ImageCache from '@mutagen-d/react-native-image-cache'

const App = () => {
  useEffect(() => {
    const load = async () => {
      await ImageCache.load()
    }
    load()
  }, [])
  return <ImageCache
    source={{
      uri: 'https://example.com/image.png',
      headers: { Authorization: 'Bearer <token>' },
    }}
  />
}