{"id":4073,"url":"https://github.com/billmalarky/react-native-image-cache-hoc","last_synced_at":"2026-03-05T09:33:52.918Z","repository":{"id":26327220,"uuid":"108015348","full_name":"billmalarky/react-native-image-cache-hoc","owner":"billmalarky","description":"React Native Higher Order Component that adds advanced caching functionality to the react native Image component.","archived":false,"fork":false,"pushed_at":"2024-03-27T15:56:56.000Z","size":1103,"stargazers_count":286,"open_issues_count":40,"forks_count":53,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-19T19:37:53.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/billmalarky.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":null,"authors":null,"dei":null}},"created_at":"2017-10-23T17:27:19.000Z","updated_at":"2025-08-21T08:19:00.000Z","dependencies_parsed_at":"2024-04-25T00:41:15.964Z","dependency_job_id":"86abc80d-2688-4fbd-9975-9a566f10925b","html_url":"https://github.com/billmalarky/react-native-image-cache-hoc","commit_stats":{"total_commits":68,"total_committers":4,"mean_commits":17.0,"dds":"0.044117647058823484","last_synced_commit":"20c438a62c5997e8e5bc673abeedf63f6fbb1321"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/billmalarky/react-native-image-cache-hoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmalarky%2Freact-native-image-cache-hoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmalarky%2Freact-native-image-cache-hoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmalarky%2Freact-native-image-cache-hoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmalarky%2Freact-native-image-cache-hoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/billmalarky","download_url":"https://codeload.github.com/billmalarky/react-native-image-cache-hoc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billmalarky%2Freact-native-image-cache-hoc/sbom","scorecard":{"id":238117,"data":{"date":"2025-08-11","repo":{"name":"github.com/billmalarky/react-native-image-cache-hoc","commit":"20c438a62c5997e8e5bc673abeedf63f6fbb1321"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":1,"reason":"Found 3/21 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"122 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-j4mr-9xw3-c9jx","Warn: Project is vulnerable to: GHSA-7p89-p6hx-q4fw","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-3w3w-pxmm-2w2j","Warn: Project is vulnerable to: GHSA-xwcq-pm8m-c4vf","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-675m-85rw-j3w4","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-gwg9-rgvj-4h5j","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-7mc5-chhp-fmc3","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-4cpg-3vgw-4877","Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-gff7-g5r8-mg8m","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-46c4-8wrp-j99v","Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442","Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc","Warn: Project is vulnerable to: GHSA-rqff-837h-mm52","Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2","Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j","Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872","Warn: Project is vulnerable to: GHSA-qgmg-gppg-76g5","Warn: Project is vulnerable to: GHSA-5v72-xg48-5rpm","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv","Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q","Warn: Project is vulnerable to: GHSA-crh6-fp67-6883","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp","Warn: Project is vulnerable to: GHSA-rq8g-5pc5-wrhr","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-f9cm-qmx5-m98h","Warn: Project is vulnerable to: GHSA-6394-6h9h-cfjg","Warn: Project is vulnerable to: GHSA-hxcm-v35h-mg2x","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-38h8-x697-gh8q","Warn: Project is vulnerable to: GHSA-pv4c-p2j5-38j4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T06:08:28.609Z","repository_id":26327220,"created_at":"2025-08-17T06:08:28.609Z","updated_at":"2025-08-17T06:08:28.609Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30117738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T08:19:04.902Z","status":"ssl_error","status_checked_at":"2026-03-05T08:17:37.148Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-01-05T20:17:00.231Z","updated_at":"2026-03-05T09:33:52.896Z","avatar_url":"https://github.com/billmalarky.png","language":"JavaScript","funding_links":[],"categories":["Components","JavaScript","Others"],"sub_categories":["UI"],"readme":"# React Native Image Cache HOC\n\n[![Build Status](https://travis-ci.org/billmalarky/react-native-image-cache-hoc.svg?branch=master)](https://travis-ci.org/billmalarky/react-native-image-cache-hoc)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/billmalarky/react-native-image-cache-hoc/blob/master/LICENSE)\n[![ESLint](https://img.shields.io/badge/eslint-ok-green.svg)](https://github.com/billmalarky/react-native-image-cache-hoc/blob/master/.eslintrc.js)\n[![Coverage Status](https://coveralls.io/repos/github/billmalarky/react-native-image-cache-hoc/badge.svg?branch=master)](https://coveralls.io/github/billmalarky/react-native-image-cache-hoc?branch=master)\n\nReact Native Higher Order Component that adds advanced caching functionality to the react native Image component.\n\n## Features\n\n* **Drop in Replacement** for native \\\u003cImage\\\u003e component.\n* **Automatically Cache** remote image files to local filesystem to increase performance.\n* **Automatically Persist** remote image files to local filesystem _forever_ with a simple component prop flag.\n\n## Installation\n\n```bash\n$ npm install --save react-native-image-cache-hoc\n```\n\nOr\n\n```bash\n$ yarn add react-native-image-cache-hoc\n```\n\nThen, because this package has a depedency on [rn-fetch-blob](https://github.com/joltup/rn-fetch-blob) you will need to link this native package by running:\n\n```bash\n$ react-native link rn-fetch-blob\n```\n\nLinking rn-fetch-blob **should only be done once**, reinstalling node_modules with npm or yarn does not require running the above command again.\n\nTo troubleshoot linking, refer to [the rn-fetch-blob installation instructions](https://github.com/joltup/rn-fetch-blob#user-content-installation).\n\n## Usage\n\nReact Native Image Cache HOC creates an advanced image component, \\\u003cCacheableImage\\\u003e, that is a drop in replacement for the standard \\\u003cImage\\\u003e component. \n\n**Differences between the advanced image component and standard image component API are as follows:**\n\n1. **Modified \"source\" Prop:** The advanced component \"source\" prop only accepts a web accessible url (there's no reason to use this library to render files that already exist on the local filesystem), and it does NOT accept an array of urls.\n2. **New \"permanent\" Prop:** The new, optional (defaults to False), \"permanent\" prop determines if the image file should be stored forever on the local filesystem instead of written to a temperary cache that is subject to occasional pruning.\n3. **New  \"placeholder\" Prop:** The new, optional (defaults to standard Image component), \"placeholder\" prop determines component to render while remote image file is downloading.\n\n**TL;DR: To cache image files for performance, simply use \\\u003cCacheableImage\\\u003e as a drop in replacement for \\\u003cImage\\\u003e. To store files permanently add a permanent={true} prop to \\\u003cCacheableImage\\\u003e.**\n\n```js\n\nimport React, { Component } from 'react';\nimport {\n  StyleSheet,\n  Text,\n  View,\n  Image\n} from 'react-native';\n\nimport imageCacheHoc from 'react-native-image-cache-hoc';\n\n/**\n* Pass the native \u003cImage\u003e component into imageCacheHoc() to create the advanced image component \u003cCacheableImage\u003e.\n* \n* imageCacheHoc() takes an options object as the second parameter (refer to options section of README.md)\n*/\nconst CacheableImage = imageCacheHoc(Image, {\n  fileHostWhitelist: ['i.redd.it']\n});\n\nexport default class App extends Component\u003c{}\u003e {\n  render() {\n    return (\n      \u003cView style={styles.container}\u003e\n        \u003cText style={styles.welcome}\u003eWelcome to React Native!\u003c/Text\u003e\n        \u003cCacheableImage style={styles.image} source={{uri: 'https://i.redd.it/rc29s4bz61uz.png'}} permanent={false} /\u003e\n      \u003c/View\u003e\n  );\n  }\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#F5FCFF',\n  },\n  welcome: {\n    fontSize: 20,\n    textAlign: 'center',\n    margin: 10,\n  },\n  image: {\n    width:150,\n    height: 204\n  }\n});\n\n```\n\n## Options\n\nReact Native Image Cache HOC accepts an options object in order to tweak standard functionality.\n\n```js\nimageCacheHoc(Image, {\n  \n  // Allow http urls. \n  // Defaults to https only.\n  validProtocols: ['http', 'https'],\n  \n  // Use domain host whitelist. \n  // Defaults to allowing urls from all domain hosts.\n  fileHostWhitelist: ['localhost', 'i.redd.it'],\n  \n  // Namespace the directory that stores files to avoid collisions with other app libraries. \n  // Defaults to 'react-native-image-cache-hoc'.\n  fileDirName: 'example-app-files-namespace',\n  \n  // Max size of file cache in bytes before pruning occurs. \n  // Note that cache size can exceed this limit, \n  // but sequential writes to the cache will trigger cache pruning \n  // which will delete cached files until total cache size is below this limit before writing.\n  // Defaults to 15 MB.\n  cachePruneTriggerLimit: 1024 * 1024 * 10,\n  \n  // Default placeholder component to render while remote image file is downloading. \n  // Can be overridden with placeholder prop like \u003cCacheableImage placeholder={placeHolderObject} /\u003e. \n  //\n  // Placeholder Object is structed like:\n  // const placeHolderObject = {\n  //   component: ReactComponentToUseHere,\n  //    props: {\n  //      examplePropLikeStyle: componentStylePropValue,\n  //      anotherExamplePropLikeSource: componentSourcePropValue\n  //   }\n  // };\n  //\n  // Defaults to \u003cImage\u003e component with style prop passed through.\n  defaultPlaceholder: {\n    component: ActivityIndicator,\n    props: {\n      style: activityIndicatorStyle\n    }\n  }\n  \n});\n```\n\n## Using Loading Placeholders\n\nReact Native Image Cache HOC allows you to easily supply any component to be used as a placeholder while the remote image file is downloading. While the default placeholder should be great for many use cases, you can easily use your own to match the style of the rest of your app.\n\n```js\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#F5FCFF',\n  },\n  welcome: {\n    fontSize: 20,\n    textAlign: 'center',\n    margin: 10,\n  },\n  image: {\n    width:150,\n    height: 204\n  },\n  activityIndicatorStyle: {\n    width: 150,\n    height: 204,\n    backgroundColor: '#dc143c'\n  }\n});\n\n// This placeholder object will be used as a placeholder component for all instances of \u003cCacheableImage\u003e \n// unless individual \u003cCacheableImage\u003e uses \"placeholder\" prop to override this default.\nconst defaultPlaceholderObject = {\n  component: ActivityIndicator,\n  props: {\n    style: styles.activityIndicatorStyle\n  }\n};\n\n// We will use this placeholder object to override the default placeholder.\nconst propOverridePlaceholderObject = {\n  component: Image,\n  props: {\n    style: styles.image,\n    source: {require('./localPlaceholderImage.png')}\n  }\n};\n\nconst CacheableImage = imageCacheHoc(Image, {\n  defaultPlaceholder: defaultPlaceholderObject\n});\n\nexport default class App extends Component\u003c{}\u003e {\n  render() {\n    return (\n      \u003cView style={styles.container}\u003e\n        \u003cText style={styles.welcome}\u003eWelcome to React Native!\u003c/Text\u003e\n        \u003cCacheableImage style={styles.image} source={{uri: 'https://i.redd.it/rc29s4bz61uz.png'}} /\u003e\n        \u003cCacheableImage style={styles.image} source={{uri: 'https://i.redd.it/hhhim0kc5swz.jpg'}} placeholder={propOverridePlaceholderObject} /\u003e\n        \u003cCacheableImage style={styles.image} source={{uri: 'https://i.redd.it/17ymhqwgbswz.jpg'}} /\u003e\n      \u003c/View\u003e\n  );\n  }\n}\n```\n\n## Static Methods\n\nThe CacheableImage class returned by React Native Image Cache HOC includes a couple of static methods for convenience.\n\n**CacheableImage.cacheFile(url, permanent)**\n\nUse this method if you need to download a file to the local filesystem prior to rendering \\\u003cCacheableImage\\\u003e for some reason (perhaps to pre-warm the local cache). If calling this method repeatedly to cache a long list of files, be sure to use a queue and limit concurrency so your app performance does not suffer.\n\n```js\nimport imageCacheHoc from 'react-native-image-cache-hoc';\nconst CacheableImage = imageCacheHoc(Image);\nCacheableImage.cacheFile('https://i.redd.it/17ymhqwgbswz.jpg')\n  .then( localFileInfo =\u003e {\n    console.log(localFileInfo);\n    // The https://i.redd.it/17ymhqwgbswz.jpg remote file is now saved to local fs. \n    // Since permanent was not set, this file is subject to cache pruning.\n  });\n\nCacheableImage.cacheFile('https://i.redd.it/hhhim0kc5swz.jpg', true)\n  .then( localFileInfo =\u003e {\n    console.log(localFileInfo);\n    // The https://i.redd.it/hhhim0kc5swz.jpg remote file is now saved to local fs permanently.\n  });\n```\n\n**CacheableImage.flush()**\n\nDelete all locally stored image files created by react-native-image-cache-hoc (cache AND permanent). Calling this method will cause a performance hit on your app until the local files are rebuilt.\n\n```js\nimport imageCacheHoc from 'react-native-image-cache-hoc';\nconst CacheableImage = imageCacheHoc(Image);\nCacheableImage.flush()\n  .then( flushResults =\u003e {\n    console.log(flushResults);\n    // All local filles created by 'react-native-image-cache-hoc' are now destroyed. \n    // They will be rebuilt by future \u003cCacheableImage\u003e renders.\n  });\n```\n\n## Jest Test Support\n\nReact Native Image Cache HOC must be run in a native environment to work correctly. As a result it will create issues in your jest tests unless you mock it. Since this module is an HOC that adds additional functionality to the standard \\\u003cImage\\\u003e component, it can be easily mocked with a function that returns the standard \\\u003cImage\\\u003e component.\n\n**Add the following to your jest mocks:**\n\n```js\njest.mock('react-native-image-cache-hoc', () =\u003e {\n\n  const mockComponent = require('react-native/jest/mockComponent');\n  const MockCacheableImage = mockComponent('Image');\n  \n  // Add mock static methods\n  // To see how to use jest.fn() to return mock data in your tests see the following:\n  // https://facebook.github.io/jest/docs/en/mock-function-api.html\n  MockCacheableImage.cacheFile = jest.fn(); \n  MockCacheableImage.flush = jest.fn();\n\n  return function() {\n    return MockCacheableImage;\n  }\n\n});\n```\n\n\n## Warning\n\niOS only allows requests to https urls. If you need to load image files using http you will need to make additional react native config changes.\n\n\u003e By default, iOS will block any request that's not encrypted using SSL. If you need to fetch from a cleartext URL (one that begins with http) you will first need to add an App Transport Security exception. If you know ahead of time what domains you will need access to, it is more secure to add exceptions just for those domains; if the domains are not known until runtime you can disable ATS completely. Note however that from January 2017, Apple's App Store review will require reasonable justification for disabling ATS.\n\nhttps://facebook.github.io/react-native/docs/network.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillmalarky%2Freact-native-image-cache-hoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbillmalarky%2Freact-native-image-cache-hoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillmalarky%2Freact-native-image-cache-hoc/lists"}