{"id":3992,"url":"https://github.com/APSL/react-native-button","last_synced_at":"2025-08-04T00:30:55.542Z","repository":{"id":44174437,"uuid":"41495065","full_name":"APSL/react-native-button","owner":"APSL","description":"A React Native button component customizable via props","archived":false,"fork":false,"pushed_at":"2022-12-03T15:36:22.000Z","size":965,"stargazers_count":746,"open_issues_count":33,"forks_count":122,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-07-26T14:40:57.875Z","etag":null,"topics":["button","react","react-native"],"latest_commit_sha":null,"homepage":"","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/APSL.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":"2015-08-27T15:28:01.000Z","updated_at":"2025-02-26T21:30:56.000Z","dependencies_parsed_at":"2023-01-23T04:46:26.516Z","dependency_job_id":null,"html_url":"https://github.com/APSL/react-native-button","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/APSL/react-native-button","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Freact-native-button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Freact-native-button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Freact-native-button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Freact-native-button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/APSL","download_url":"https://codeload.github.com/APSL/react-native-button/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/APSL%2Freact-native-button/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268633369,"owners_count":24281769,"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-08-03T02:00:12.545Z","response_time":2577,"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":["button","react","react-native"],"created_at":"2024-01-05T20:16:57.861Z","updated_at":"2025-08-04T00:30:55.121Z","avatar_url":"https://github.com/APSL.png","language":"JavaScript","readme":"# apsl-react-native-button\n\u003cimg src=\"https://travis-ci.org/APSL/react-native-button.svg?branch=master\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/coverage-82%25-green.svg\" /\u003e\n\u003cimg src=\"https://img.shields.io/npm/dm/apsl-react-native-button.svg\" /\u003e\n\nA React Native button component customizable via ``style`` props.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/APSL/react-native-button/button.png\" alt=\"Button component screenshot\" width=\"400\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/wiki/APSL/react-native-button/and.png\" alt=\"Android Button component screenshot\" width=\"400\"\u003e\n\u003c/p\u003e\n\nRenders a ``TouchableOpacity`` under iOS and a ``TouchableNativeFeedback`` under Android.\n\n## Install\n`apsl-react-native-button\u003e=2.6.0` needs React Native 0.28 or higher.\n`apsl-react-native-button\u003e=2.5.0` needs React Native 0.25 or higher.\n`apsl-react-native-button\u003c=2.4.2` needs React Native 0.16 or higher.\n\nInstall the package:\n\n```bash\n$ npm i apsl-react-native-button --save\n```\n\nImport the ``Button`` component:\n\n```javascript\nimport Button from 'apsl-react-native-button'\n```\n\n## Usage\n\nProvide ``TouchableWithoutFeedback``' props to the component (including ``style``),\n``textStyle``'s ``StyleSheet`` to customize the inner text and a children node\nto render. You can also provide the ``isLoading`` prop that will dim the button\nand disable it to prevent accidental taps.\n\n```javascript\n\u003cButton style={{backgroundColor: 'red'}} textStyle={{fontSize: 18}}\u003e\n  Hello!\n\u003c/Button\u003e\n```\n\nYou can also provide a `\u003cButton\u003e` element with nested children that are not strings\nor `\u003cText\u003e` elements as long as they are valid React elements or numbers. This helps\nif your project is using another library that provides easy icon integration\nutilizing the `\u003ci\u003e` tag, for instance, as well as various other cases where you are\ncreating visually complex buttons. You may omit the `textStyle` property and apply\nyour own styles to your child elements as you see fit. Multiple children are allowed.\n\n```javascript\n\u003cButton style={{backgroundColor: 'blue'}}\u003e\n  \u003cView style={styles.nestedViewStyle}\u003e\n    \u003cText style={styles.nestedTextStyle}\u003eNested views!\u003c/Text\u003e\n  \u003c/View\u003e\n\u003c/Button\u003e\n```\n\n## API\n\n| Prop | Type | Description |\n|------|------|-------------|\n| ``onPress`` | ``func`` | Function to execute when the ``onPress`` event is triggered. |\n| ``onPressIn`` | ``func`` | Function to execute when the ``onPressIn`` event is triggered. |\n| ``onPressOut`` | ``func`` | Function to execute when the ``onPressOut`` event is triggered. |\n| ``onLongPress`` | ``func`` | Function to execute when the ``onLongPress`` event is triggered. |\n| ``textStyle`` | ``TextStylePropTypes`` | The StyleSheet to apply to the inner button text. |\n| ``disabledStyle`` | ``TextStylePropTypes`` | The StyleSheet to apply when disabled. |\n| ``children`` | ``string``, ``number``, ``React.Element``,or ``array`` | The child nodes to render inside the button. If child is ``string`` or ``number``, it will be rendered inside of a ``\u003cText\u003e`` element with ``textStyle`` applied if present. Multiple children are allowed (``array``).|\n| ``isLoading`` | ``bool`` | Renders an inactive state dimmed button with a spinner if ``true``. |\n| ``isDisabled`` | ``bool`` | Renders an inactive state dimmed button if ``true``. |\n| ``activeOpacity`` | ``Number`` | The button onpressing transparency (Usually with a point value between 0 and 1). |\n| ``activityIndicatorColor`` | ``string`` | Sets the button of the ``ActivityIndicatorIOS`` or ``ProgressBarAndroid`` in the loading state. |\n| ``background`` | ``TouchableNativeFeedback.propTypes.background`` | **Android only**. The background prop of ``TouchableNativeFeedback``. |\nCheck the included example for more options.\n\n## Similar projects\n\n[James Ide](https://github.com/ide/)'s ``react-native-button`` https://github.com/ide/react-native-button/\n\n## License\n\nMIT.\n","funding_links":[],"categories":["Components","组件","Others","Libraries"],"sub_categories":["UI","Button"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAPSL%2Freact-native-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAPSL%2Freact-native-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAPSL%2Freact-native-button/lists"}