{"id":18530951,"url":"https://github.com/eden90267/react-native-full-ratio-image","last_synced_at":"2026-05-07T15:42:20.473Z","repository":{"id":57337142,"uuid":"145598899","full_name":"eden90267/react-native-full-ratio-image","owner":"eden90267","description":"擴充 Image 組件，提供自適應全屏寬度並按等比例縮放、屏幕縱橫比例維持以及寬度外距屬性設置","archived":false,"fork":false,"pushed_at":"2018-09-05T18:33:31.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-21T19:26:46.091Z","etag":null,"topics":["react","react-native"],"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/eden90267.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}},"created_at":"2018-08-21T17:44:31.000Z","updated_at":"2018-11-29T06:10:16.000Z","dependencies_parsed_at":"2022-09-12T13:42:46.655Z","dependency_job_id":null,"html_url":"https://github.com/eden90267/react-native-full-ratio-image","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eden90267/react-native-full-ratio-image","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eden90267%2Freact-native-full-ratio-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eden90267%2Freact-native-full-ratio-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eden90267%2Freact-native-full-ratio-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eden90267%2Freact-native-full-ratio-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eden90267","download_url":"https://codeload.github.com/eden90267/react-native-full-ratio-image/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eden90267%2Freact-native-full-ratio-image/sbom","scorecard":{"id":366369,"data":{"date":"2025-08-11","repo":{"name":"github.com/eden90267/react-native-full-ratio-image","commit":"d66bd73011fd462ff4a83b2e5e8dcc8302a028c8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","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":"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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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"}}]},"last_synced_at":"2025-08-18T11:55:01.972Z","repository_id":57337142,"created_at":"2025-08-18T11:55:01.972Z","updated_at":"2025-08-18T11:55:01.972Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276929648,"owners_count":25730216,"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","status":"online","status_checked_at":"2025-09-25T02:00:09.612Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["react","react-native"],"created_at":"2024-11-06T18:04:37.648Z","updated_at":"2025-09-25T14:04:17.533Z","avatar_url":"https://github.com/eden90267.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/react-native-full-ratio-image.svg)](https://badge.fury.io/js/react-native-full-ratio-image)\n\n[![NPM](https://nodei.co/npm/react-native-full-ratio-image.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/react-native-full-ratio-image/)\n\n# react-native-full-ratio-image\n\n擴充 Image 組件，提供以下功能\n\n- 自適應全屏寬度並按等比例縮放\n- 屏幕縱橫比例維持\n- 寬度外距屬性設置\n  - pt 設置\n  - 百分比設置\n\n放置 Logo 用 Image 非常適合。以下範例圖片透過 `width: '70%'` 方式，並隨縱橫比例維持其設置的寬度：\n\n\u003cimg src=\"https://imgur.com/4ooks7K.png\" width=\"300\" height=\"533\"/\u003e\n\u003cimg src=\"https://imgur.com/bOVvHv1.png\" width=\"533\" height=\"300\"/\u003e\n\n## What happened ?\n\n在沒有該擴充 Image 的使用下，一般要能自適應圖片通常會使用寬高百分比，但寬高百分比將會帶來以下問題：\n\n- 不同手機載具的螢幕解析將會有不同圖片比例效果\n  \n  \u003cimg src=\"https://imgur.com/NYAbOxr.png\" width=\"300\" height=\"533\"/\u003e\n  \u003cimg src=\"https://imgur.com/9QJSr1J.png\" width=\"300\" height=\"649\"/\u003e\n\n- Android 的 keyboard 將會在彈出鍵盤避免擋住當前的視圖，自動調整視圖的位置，導致百分比設置圖片的寬高將會是不符常規的比例呈現 (寬高被壓縮)\n\n  \u003cimg src=\"https://imgur.com/vJfec42.png\" width=\"300\" height=\"481\"/\u003e\n\n- 圖片寬高百分比並不會針對手機縱橫使用自動調整比例，需要 reload\n\n  \u003cimg src=\"https://imgur.com/gVL3Lwp.png\" width=\"300\" height=\"649\"/\u003e\n  \u003cimg src=\"https://imgur.com/JLv9jzk.png\" width=\"533\" height=\"300\"/\u003e\n\n## Installation\n\n```shell\n$ npm install react-native-full-ratio-image\n```\n\n## Usage\n\n```javascript\nimport FullRatioImage from 'react-native-full-ratio-image';\n```\n\n必須提供原始圖片寬高 props 以利該擴充 Image 組件可自動計算等比例圖片縮放。\n\n- originWidth:number\n- originHeight:number\n\noptions props：\n\n- marginX:number|string\n\n寬度外距 (marginLeft + merginRight = marginX)。可設置 pt 數字或百分比，比如以下範例設置外距為 '30%'，讓該圖片以父元件寬度保持 `width: '70%'`。\n\n```javascript\nconst LOGO_WIDTH = 3840;\nconst LOGO_HEIGHT = 906;\n\nclass SignInScreen extends Component {\n  \n  // ...\n  \n  render() {\n    return (\n      \u003cView style={[globalStyles.container, globalStyles.center, {backgroundColor: primaryColor}]}\u003e\n        \u003cStatusBar barStyle=\"light-content\"/\u003e\n        \u003cFullRatioImage\n          originalWidth={LOGO_WIDTH}\n          originalHeight={LOGO_HEIGHT}\n          marginX=\"30%\"\n          source={require('../images/ALTA-logo.png')}\n          resizeMode=\"stretch\"\n          style={[styles.logo]}/\u003e\n        {/* ... */}\n      \u003c/View\u003e\n    );\n  }\n}\n```\n\n## License\n\n[MIT License](http://opensource.org/licenses/mit-license.html). © eden90267\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feden90267%2Freact-native-full-ratio-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feden90267%2Freact-native-full-ratio-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feden90267%2Freact-native-full-ratio-image/lists"}