{"id":22663168,"url":"https://github.com/puti94/react-native-addcarview","last_synced_at":"2025-04-12T07:22:31.034Z","repository":{"id":57335036,"uuid":"123925683","full_name":"puti94/react-native-addcarview","owner":"puti94","description":"react-native的一个添加购物车动画效果控件","archived":false,"fork":false,"pushed_at":"2018-03-06T08:31:47.000Z","size":840,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T02:35:01.145Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puti94.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":"2018-03-05T13:46:12.000Z","updated_at":"2021-04-22T08:38:46.000Z","dependencies_parsed_at":"2022-09-13T13:42:51.405Z","dependency_job_id":null,"html_url":"https://github.com/puti94/react-native-addcarview","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/puti94%2Freact-native-addcarview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-native-addcarview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-native-addcarview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-native-addcarview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puti94","download_url":"https://codeload.github.com/puti94/react-native-addcarview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248531137,"owners_count":21119705,"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-12-09T12:17:34.674Z","updated_at":"2025-04-12T07:22:31.014Z","avatar_url":"https://github.com/puti94.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-addcarview\n一个简单实用的实现添加购物车动画的控件\n\n- 安装:`npm install react-native-addcarview --save` or `yarn add react-native-addcarview`\n- 使用: \n    ```\n              \u003cView style={styles.container}\u003e\n              \n                \u003cButton title={'添加购物车(传入控件)'} onPress={() =\u003e {\n                    startAddShopAnim(this.renderCarImage(), {\n                        beforeView: this.beforeView,\n                        afterView: this.afterView,\n                        topFix: 60,\n                        endScale: 0.5,\n                        duration: 1000,\n                        callBack: () =\u003e {\n                            this.setState({number: this.state.number  += 1})\n                        }\n                    })\n                }}/\u003e\n                \u003cButton title={'添加购物车(传入坐标)'} onPress={() =\u003e {\n                    startAddShopAnim(this.renderCarImage(), {\n                        beforeValue: {x: 200, y: 200},\n                        afterValue: {x: 300, y: 400},\n                        endRotateZ: 360,\n                        duration: 5000,\n                        endScale: 2,\n                        callBack: () =\u003e {\n                            this.setState({number: this.state.number     += 1})\n                        }\n                    })\n                }}/\u003e\n\n                \u003cImage ref={ref =\u003e this.beforeView = ref}\n                       style={{width: 120, height: 120, borderRadius: 10}}\n                       source={{uri: imageUrl}}/\u003e\n                \u003cText ref={ref =\u003e this.afterView = ref}\n                      style={{\n                          position: 'absolute',\n                          bottom: 10,\n                          right: 10,\n                          backgroundColor: 'gray'\n                      }}\u003e购物车{this.state.number}\u003c/Text\u003e\n                \u003cShoppingCarView/\u003e\n            \u003c/View\u003e\n \n     ```\n- 注意点:动画开始结束位置是通过传入组件调用measureInWindow方法测量得到的，请确保传入控件有measureInWindow方法。如果没有这个方法（大部分组件有），也可以传入坐标\n  \n\n## 示例图\n  ![效果图](https://github.com/puti94/react-native-addcarview/blob/master/111.gif)\n  ![效果图](https://github.com/puti94/react-native-addcarview/blob/master/222.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputi94%2Freact-native-addcarview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fputi94%2Freact-native-addcarview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputi94%2Freact-native-addcarview/lists"}