{"id":4034,"url":"https://github.com/ladas-larry/react-native-responsive-image","last_synced_at":"2025-04-05T18:11:34.821Z","repository":{"id":31763478,"uuid":"35329708","full_name":"ladas-larry/react-native-responsive-image","owner":"ladas-larry","description":"Responsive image component for React Native","archived":false,"fork":false,"pushed_at":"2021-05-26T07:56:22.000Z","size":1094,"stargazers_count":401,"open_issues_count":0,"forks_count":50,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-29T13:49:41.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ladas-larry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-09T13:33:03.000Z","updated_at":"2024-05-18T01:46:47.000Z","dependencies_parsed_at":"2022-09-16T13:00:36.253Z","dependency_job_id":null,"html_url":"https://github.com/ladas-larry/react-native-responsive-image","commit_stats":null,"previous_names":["dharmoslap/react-native-responsive-images","dharmoslap/react-native-responsive-image"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladas-larry%2Freact-native-responsive-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladas-larry%2Freact-native-responsive-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladas-larry%2Freact-native-responsive-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladas-larry%2Freact-native-responsive-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ladas-larry","download_url":"https://codeload.github.com/ladas-larry/react-native-responsive-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378149,"owners_count":20929297,"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":[],"created_at":"2024-01-05T20:16:59.102Z","updated_at":"2025-04-05T18:11:34.803Z","avatar_url":"https://github.com/ladas-larry.png","language":"JavaScript","funding_links":[],"categories":["Components","JavaScript"],"sub_categories":["UI"],"readme":"# React Native Responsive Image\n\n[![David](https://david-dm.org/dharmoslap/react-native-responsive-image.svg)](https://david-dm.org/dharmoslap/react-native-responsive-image)\n[![npm](https://img.shields.io/npm/v/react-native-responsive-image.svg)](https://www.npmjs.com/package/react-native-responsive-image)\n[![GitHub commits](https://img.shields.io/github/commits-since/dharmoslap/react-native-responsive-image/2.1.0.svg?maxAge=2592000)]()\n[![npm](https://img.shields.io/npm/dt/react-native-responsive-image.svg?maxAge=2592000)](https://www.npmjs.com/package/react-native-responsive-image)\n\n## Why?\n\nReact Native's Image size is rendered with the same dimensions regardless of device screen size and screen resolution. That's bad. This component scales itself seemlesly on all iOS and Android devices.\n\n## Installation\n\n`npm install react-native-responsive-image --save`\n\n## Usage\n\n`\u003cResponsiveImage\u003e` is expecting `initWidth` and `initHeight` props.\n\nThese values are used to set image size on any device that has screen size iPhone Plus, or larger.\nImage is then scaled down for any smaller device.\n\nOptional prop `component` is used to pass down either an `Image` or `ImageBackground` imported react-native (defaults to `Image` if not provided)\n\n## Example\n\n```javascript\nimport React, { Component } from \"react\";\nimport { AppRegistry, StyleSheet, View } from \"react-native\";\nimport ResponsiveImage from \"react-native-responsive-image\";\n\nclass App extends Component {\n  render() {\n    return (\n      \u003cView\n        style={{\n          flexGrow: 1,\n          justifyContent: \"center\",\n          alignItems: \"center\",\n          flexDirection: \"row\"\n        }}\n      \u003e\n        \u003cResponsiveImage\n          source={{ uri: \"https://reactjs.org/logo-og.png\" }}\n          initWidth=\"138\"\n          initHeight=\"138\"\n        /\u003e\n        \u003cResponsiveImage\n          source={{ uri: \"https://reactjs.org/logo-og.png\" }}\n          initWidth=\"138\"\n          initHeight=\"138\"\n        /\u003e\n        \u003cResponsiveImage\n          source={{ uri: \"https://reactjs.org/logo-og.png\" }}\n          initWidth=\"138\"\n          initHeight=\"138\"\n        /\u003e\n      \u003c/View\u003e\n    );\n  }\n}\n\nAppRegistry.registerComponent(\"ResponsiveImageExample\", () =\u003e App);\n```\n\nFor `initWidth=138` it looks like this:\n\n| Device               | Screen width | Scale | `\u003cImage\u003e` width |\n| -------------------- | ------------ | ----- | --------------- |\n| iPhone SE            | 320          | 0.77  | 106             |\n| iPhone X             | 375          | 0.902 | 117             |\n| iPhone8 Plus         | 414          | 1     | 138             |\n| Nokia 5              | 360          | 0.87  | 120             |\n| iPad (or any tablet) | -            | 1     | 138             |\n\n## Just one image?\n\nIt sounds like you could save some loading by delivering low resolution images to screens with lower resolution. The best way is to serve just one high-resolution (retina) well compressed image. It’s surprising how well they can be compressed, and the result looks the same.\n\n![Retina Compression](https://raw.githubusercontent.com/Dharmoslap/react-native-responsive-image/master/retina.png)\n\n## Example project\n\n### Create project\n\n`expo init ResponsiveImageExample`\n\n- go with 'expo-template-blank'\n\n`cp ./example/App.js ./ResponsiveImageExample/App.js`\n\n`cp -R ./src ./ResponsiveImageExample`\n\n`cd ResponsiveImageExample`\n\n`yarn start`\n\n## Development\n\n1. Modify any files in ./src directory\n\n2. Propagate changes by `cp -R ./src ./ResponsiveImageExample/src`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladas-larry%2Freact-native-responsive-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladas-larry%2Freact-native-responsive-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladas-larry%2Freact-native-responsive-image/lists"}