{"id":15019742,"url":"https://github.com/dylanvann/react-native-fast-image","last_synced_at":"2025-05-07T11:52:53.768Z","repository":{"id":37237240,"uuid":"88124214","full_name":"DylanVann/react-native-fast-image","owner":"DylanVann","description":"🚩 FastImage, performant React Native image component.","archived":false,"fork":false,"pushed_at":"2024-06-14T09:29:08.000Z","size":61812,"stargazers_count":8332,"open_issues_count":468,"forks_count":1506,"subscribers_count":62,"default_branch":"main","last_synced_at":"2025-04-30T15:56:31.393Z","etag":null,"topics":["cocoapod","glide","hacktoberfest","image","image-cache","priority","react-native","sdwebimage"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DylanVann.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"docs/roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-13T04:13:44.000Z","updated_at":"2025-04-30T09:03:10.000Z","dependencies_parsed_at":"2024-11-08T01:49:34.682Z","dependency_job_id":null,"html_url":"https://github.com/DylanVann/react-native-fast-image","commit_stats":{"total_commits":541,"total_committers":74,"mean_commits":"7.3108108108108105","dds":0.6210720887245841,"last_synced_commit":"9ab80fcd570b7f56da66ab20e52c9a35934067c9"},"previous_names":[],"tags_count":115,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DylanVann%2Freact-native-fast-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DylanVann%2Freact-native-fast-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DylanVann%2Freact-native-fast-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DylanVann%2Freact-native-fast-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DylanVann","download_url":"https://codeload.github.com/DylanVann/react-native-fast-image/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252873974,"owners_count":21817710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapod","glide","hacktoberfest","image","image-cache","priority","react-native","sdwebimage"],"created_at":"2024-09-24T19:53:59.350Z","updated_at":"2025-05-07T11:52:53.741Z","avatar_url":"https://github.com/DylanVann.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  🚩 FastImage\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\nPerformant React Native image component.\n\n[![Version][version-badge]][package]\n[![Downloads][downloads-badge]][npmtrends]\n[![Build Status][build-badge]][build]\n[![Code Coverage][coverage-badge]][coverage]\n\n[![Watch on GitHub][github-watch-badge]][github-watch]\n[![Star on GitHub][github-star-badge]][github-star]\n[![Tweet][twitter-badge]][twitter]\n\n\u003c/div\u003e\n\n\u003cp align=\"center\" \u003e\n  \u003ckbd\u003e\n    \u003cimg\n      src=\"https://github.com/DylanVann/react-native-fast-image/blob/main/docs/assets/scroll.gif?raw=true\"\n      title=\"Scroll Demo\"\n      float=\"left\"\n    \u003e\n  \u003c/kbd\u003e\n  \u003ckbd\u003e\n    \u003cimg\n      src=\"https://github.com/DylanVann/react-native-fast-image/blob/main/docs/assets/priority.gif?raw=true\"\n      title=\"Priority Demo\"\n      float=\"left\"\n    \u003e\n  \u003c/kbd\u003e\n  \u003cbr\u003e\n  \u003cem\u003eFastImage example app.\u003c/em\u003e\n\u003c/p\u003e\n\nReact Native's `Image` component handles image caching like browsers\nfor the most part.\nIf the server is returning proper cache control\nheaders for images you'll generally get the sort of built in\ncaching behavior you'd have in a browser.\nEven so many people have noticed:\n\n-   Flickering.\n-   Cache misses.\n-   Low performance loading from cache.\n-   Low performance in general.\n\n`FastImage` is an `Image` replacement that solves these issues.\n`FastImage` is a wrapper around\n[SDWebImage (iOS)](https://github.com/rs/SDWebImage)\nand\n[Glide (Android)](https://github.com/bumptech/glide).\n\n## Features\n\n-   [x] Aggressively cache images.\n-   [x] Add authorization headers.\n-   [x] Prioritize images.\n-   [x] Preload images.\n-   [x] GIF support.\n-   [x] Border radius.\n\n## Usage\n\n**Note: You must be using React Native 0.60.0 or higher to use the most recent version of `react-native-fast-image`.**\n\n```bash\nyarn add react-native-fast-image\ncd ios \u0026\u0026 pod install\n```\n\n```jsx\nimport FastImage from 'react-native-fast-image'\n\nconst YourImage = () =\u003e (\n    \u003cFastImage\n        style={{ width: 200, height: 200 }}\n        source={{\n            uri: 'https://unsplash.it/400/400?image=1',\n            headers: { Authorization: 'someAuthToken' },\n            priority: FastImage.priority.normal,\n        }}\n        resizeMode={FastImage.resizeMode.contain}\n    /\u003e\n)\n```\n\n## Are you using Glide already using an AppGlideModule?\n\n-   [Are you using Glide already using an AppGlideModule?](docs/app-glide-module.md) (you might have problems if you don't read this)\n\n## Are you using Proguard?\n\nIf you use Proguard you will need to add these lines to `android/app/proguard-rules.pro`:\n\n```\n-keep public class com.dylanvann.fastimage.* {*;}\n-keep public class com.dylanvann.fastimage.** {*;}\n-keep public class * implements com.bumptech.glide.module.GlideModule\n-keep public class * extends com.bumptech.glide.module.AppGlideModule\n-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {\n  **[] $VALUES;\n  public *;\n}\n```\n\n## Properties\n\n### `source?: object`\n\nSource for the remote image to load.\n\n---\n\n### `source.uri?: string`\n\nRemote url to load the image from. e.g. `'https://facebook.github.io/react/img/logo_og.png'`.\n\n---\n\n### `source.headers?: object`\n\nHeaders to load the image with. e.g. `{ Authorization: 'someAuthToken' }`.\n\n---\n\n### `source.priority?: enum`\n\n-   `FastImage.priority.low` - Low Priority.\n-   `FastImage.priority.normal` **(Default)** - Normal Priority.\n-   `FastImage.priority.high` - High Priority.\n\n---\n\n### `source.cache?: enum`\n\n-   `FastImage.cacheControl.immutable` - **(Default)** - Only updates if url changes.\n-   `FastImage.cacheControl.web` - Use headers and follow normal caching procedures.\n-   `FastImage.cacheControl.cacheOnly` - Only show images from cache, do not make any network requests.\n\n---\n\n### `defaultSource?: number`\n\n-   An asset loaded with `require(...)`.\n-   Note that like the built-in `Image` implementation, on Android `defaultSource` does not work in debug mode. This is due to the fact that assets are sent from the dev server, but RN's functions only know how to load it from `res`.\n\n---\n\n### `resizeMode?: enum`\n\n-   `FastImage.resizeMode.contain` - Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).\n-   `FastImage.resizeMode.cover` **(Default)** - Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding).\n-   `FastImage.resizeMode.stretch` - Scale width and height independently, This may change the aspect ratio of the src.\n-   `FastImage.resizeMode.center` - Do not scale the image, keep centered.\n\n---\n\n### `onLoadStart?: () =\u003e void`\n\nCalled when the image starts to load.\n\n---\n\n### `onProgress?: (event) =\u003e void`\n\nCalled when the image is loading.\n\ne.g. `onProgress={e =\u003e console.log(e.nativeEvent.loaded / e.nativeEvent.total)}`\n\n---\n\n### `onLoad?: (event) =\u003e void`\n\nCalled on a successful image fetch. Called with the width and height of the loaded image.\n\ne.g. `onLoad={e =\u003e console.log(e.nativeEvent.width, e.nativeEvent.height)}`\n\n---\n\n### `onError?: () =\u003e void`\n\nCalled on an image fetching error.\n\n---\n\n### `onLoadEnd?: () =\u003e void`\n\nCalled when the image finishes loading, whether it was successful or an error.\n\n---\n\n### `style`\n\nA React Native style. Supports using `borderRadius`.\n\n---\n\n### `fallback: boolean`\n\nIf true will fallback to using `Image`.\nIn this case the image will still be styled and laid out the same way as `FastImage`.\n\n---\n\n### `tintColor?: number | string`\n\nIf supplied, changes the color of all the non-transparent pixels to the given color.\n\n## Static Methods\n\n### `FastImage.preload: (source[]) =\u003e void`\n\nPreload images to display later. e.g.\n\n```js\nFastImage.preload([\n    {\n        uri: 'https://facebook.github.io/react/img/logo_og.png',\n        headers: { Authorization: 'someAuthToken' },\n    },\n    {\n        uri: 'https://facebook.github.io/react/img/logo_og.png',\n        headers: { Authorization: 'someAuthToken' },\n    },\n])\n```\n\n### `FastImage.clearMemoryCache: () =\u003e Promise\u003cvoid\u003e`\n\nClear all images from memory cache.\n\n### `FastImage.clearDiskCache: () =\u003e Promise\u003cvoid\u003e`\n\nClear all images from disk cache.\n\n## Troubleshooting\n\nIf you have any problems using this library try the steps in [troubleshooting](docs/troubleshooting.md) and see if they fix it.\n\n## Development\n\n[Follow these instructions to get the example app running.](docs/development.md)\n\n## Supported React Native Versions\n\nThis project only aims to support the latest version of React Native.\\\nThis simplifies the development and the testing of the project.\n\nIf you require new features or bug fixes for older versions you can fork this project.\n\n## Credits\n\nThe idea for this modules came from\n[vovkasm's](https://github.com/vovkasm)\n[react-native-web-image](https://github.com/vovkasm/react-native-web-image)\npackage.\nIt also uses Glide and SDWebImage, but didn't have some features I needed (priority, headers).\n\nThanks to [@mobinni](https://github.com/mobinni) for helping with the conceptualization\n\n## Licenses\n\n-   FastImage - MIT © [DylanVann](https://github.com/DylanVann)\n-   SDWebImage - `MIT`\n-   Glide - BSD, part MIT and Apache 2.0. See the [LICENSE](https://github.com/bumptech/glide/blob/master/license) file for details.\n\n[build-badge]: https://github.com/dylanvann/react-native-fast-image/workflows/CI/badge.svg\n[build]: https://github.com/DylanVann/react-native-fast-image/actions?query=workflow%3ACI\n[coverage-badge]: https://img.shields.io/codecov/c/github/dylanvann/react-native-fast-image.svg\n[coverage]: https://codecov.io/github/dylanvann/react-native-fast-image\n[downloads-badge]: https://img.shields.io/npm/dm/react-native-fast-image.svg\n[npmtrends]: http://www.npmtrends.com/react-native-fast-image\n[package]: https://www.npmjs.com/package/react-native-fast-image\n[version-badge]: https://img.shields.io/npm/v/react-native-fast-image.svg\n[twitter]: https://twitter.com/home?status=Check%20out%20react-native-fast-image%20by%20%40atomarranger%20https%3A//github.com/DylanVann/react-native-fast-image\n[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/DylanVann/react-native-fast-image.svg?style=social\n[github-watch-badge]: https://img.shields.io/github/watchers/dylanvann/react-native-fast-image.svg?style=social\n[github-watch]: https://github.com/dylanvann/react-native-fast-image/watchers\n[github-star-badge]: https://img.shields.io/github/stars/dylanvann/react-native-fast-image.svg?style=social\n[github-star]: https://github.com/dylanvann/react-native-fast-image/stargazers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylanvann%2Freact-native-fast-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylanvann%2Freact-native-fast-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylanvann%2Freact-native-fast-image/lists"}