{"id":17957508,"url":"https://github.com/itinance/react-native-smart-badge-ex","last_synced_at":"2025-08-16T08:32:11.594Z","repository":{"id":57340189,"uuid":"121857386","full_name":"itinance/react-native-smart-badge-ex","owner":"itinance","description":null,"archived":false,"fork":false,"pushed_at":"2018-08-03T08:59:34.000Z","size":17,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-29T11:29:13.866Z","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/itinance.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-02-17T13:27:21.000Z","updated_at":"2021-04-09T08:02:38.000Z","dependencies_parsed_at":"2022-08-26T04:30:49.152Z","dependency_job_id":null,"html_url":"https://github.com/itinance/react-native-smart-badge-ex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Freact-native-smart-badge-ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Freact-native-smart-badge-ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Freact-native-smart-badge-ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itinance%2Freact-native-smart-badge-ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itinance","download_url":"https://codeload.github.com/itinance/react-native-smart-badge-ex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229694722,"owners_count":18108932,"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-10-29T10:55:26.396Z","updated_at":"2024-12-16T20:50:34.471Z","avatar_url":"https://github.com/itinance.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-smart-badge-ex\n\n[![npm](https://img.shields.io/npm/v/react-native-smart-badge.svg)](https://www.npmjs.com/package/react-native-smart-badge-ex)\n[![npm](https://img.shields.io/npm/dm/react-native-smart-badge.svg)](https://www.npmjs.com/package/react-native-smart-badge-ex)\n[![npm](https://img.shields.io/npm/dt/react-native-smart-badge.svg)](https://www.npmjs.com/package/react-native-smart-badge-ex)\n[![npm](https://img.shields.io/npm/l/react-native-smart-badge.svg)](https://github.com/react-native-component/react-native-smart-badge/blob/master/LICENSE)\n\nA smart autofit badge for react-native apps, written in JS for cross-platform support.\nIt works on iOS and Android.\n\nThis component is compatible with React Native 0.25 and newer.\n\n## Preview\n\n![react-native-smart-badge-preview-ios][1]\n![react-native-smart-badge-preview-android][4]\n\n## Installation\n\n```\nyarn add react-native-smart-badge-ex\n```\n\n## Full Demo\n\nsee [ReactNativeComponentDemos][0]\n\n## Usage\n\nInstall the package from npm with `yarn add react-native-smart-badge-ex`.\nThen, require it from your app's JavaScript files with `import Badge from 'react-native-smart-badge-ex'`.\n\n```js\nimport React, {\n  Component,\n} from 'react'\nimport {\n  StyleSheet,\n  View,\n  Text,\n} from 'react-native'\n\nimport Badge from 'react-native-smart-badge-ex'\nimport Button from 'react-native-smart-button'\n\nexport default class NumberBadge extends Component {\n\n    // 构造\n    constructor (props) {\n        super(props);\n        // 初始状态\n        this.state = {\n            num1: 2,\n            num2: 15,\n            num3: 328,\n        };\n    }\n\n    render () {\n        return (\n            \u003cView style={{marginTop: 20 + 44, flex: 1, justifyContent: 'center', alignItems: 'center', }}\u003e\n                \u003cBadge minWidth={18} minHeight={18} textStyle={{color: '#fff',}}\u003e\n                    {this.state.num1}\n                \u003c/Badge\u003e\n                \u003cBadge textStyle={{color: '#fff',}} style={{marginTop: 10,}}\u003e\n                    {this.state.num2}\n                \u003c/Badge\u003e\n                \u003cBadge textStyle={{color: '#fff',}} style={{marginTop: 10,}}\u003e\n                    {this.state.num3}\n                \u003c/Badge\u003e\n\n                \u003cButton\n                    touchableType={'blur'}\n                    style={{marginTop: 10, width: 300, justifyContent: 'center', height: 40, backgroundColor: '#00AAEF', borderRadius: 3, borderWidth: StyleSheet.hairlineWidth, borderColor: '#00AAEF', justifyContent: 'center',}}\n                    textStyle={{fontSize: 17,  color: 'white'}}\n                    onPress={this._addNum}\u003e\n                    click to plus num(点击增加数字)\n                \u003c/Button\u003e\n            \u003c/View\u003e\n        )\n    }\n\n    _addNum = () =\u003e {\n        this.setState({\n            num1: this.state.num1 + 3,\n            num2: this.state.num2 + 30,\n            num3: this.state.num3 + 300,\n        })\n    }\n\n}\n```\n\n## Props\n\nProp                   | Type   | Optional | Default   | Description\n---------------------- | ------ | -------- | --------- | -----------\nextraPaddingHorizontal | number | Yes      | 10        | determines the value of extra horizontal padding when the badge's width is larger than height.\nstyle                  | style  | Yes      |           | see [react-native documents][2]\ntextStyle              | style  | Yes      |           | see [react-native documents][3]\nminHeight              | number | Yes      |           | determines the min-height of badge\nminWidth               | number | Yes      |           | determines the min-width of badge\n\n[0]: https://github.com/cyqresig/ReactNativeComponentDemos\n[1]: http://cyqresig.github.io/img/react-native-smart-badge-preview-ios-v1.0.7.gif\n[2]: https://facebook.github.io/react-native/docs/style.html\n[3]: https://facebook.github.io/react-native/docs/text.html#style\n[4]: http://cyqresig.github.io/img/react-native-smart-badge-preview-android-v1.0.7.gif\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitinance%2Freact-native-smart-badge-ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitinance%2Freact-native-smart-badge-ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitinance%2Freact-native-smart-badge-ex/lists"}