{"id":15728579,"url":"https://github.com/conduitmobilernd/react-native-scratch","last_synced_at":"2025-07-13T03:34:58.377Z","repository":{"id":34382330,"uuid":"174830544","full_name":"ConduitMobileRND/react-native-scratch","owner":"ConduitMobileRND","description":"Scratch view for react native","archived":false,"fork":false,"pushed_at":"2022-06-02T11:43:47.000Z","size":119,"stargazers_count":2,"open_issues_count":6,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-03T00:04:40.292Z","etag":null,"topics":["react-native","react-native-scratch","react-native-scratch-card","react-native-scratch-image","react-native-scratch-view","scratch","scratch-card","scratch-image","scratch-view"],"latest_commit_sha":null,"homepage":"","language":"Java","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/ConduitMobileRND.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":"2019-03-10T13:55:00.000Z","updated_at":"2024-07-18T09:42:43.000Z","dependencies_parsed_at":"2022-08-28T05:31:22.798Z","dependency_job_id":null,"html_url":"https://github.com/ConduitMobileRND/react-native-scratch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ConduitMobileRND/react-native-scratch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConduitMobileRND%2Freact-native-scratch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConduitMobileRND%2Freact-native-scratch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConduitMobileRND%2Freact-native-scratch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConduitMobileRND%2Freact-native-scratch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ConduitMobileRND","download_url":"https://codeload.github.com/ConduitMobileRND/react-native-scratch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConduitMobileRND%2Freact-native-scratch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265084157,"owners_count":23708872,"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":["react-native","react-native-scratch","react-native-scratch-card","react-native-scratch-image","react-native-scratch-view","scratch","scratch-card","scratch-image","scratch-view"],"created_at":"2024-10-03T23:03:58.813Z","updated_at":"2025-07-13T03:34:58.353Z","avatar_url":"https://github.com/ConduitMobileRND.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# react-native-scratch\n\n## Getting started\n\n`$ npm install react-native-scratch --save`\n\n### Mostly automatic installation\n\n`$ react-native link react-native-scratch`\n\n### Manual installation\n\n\n#### iOS\n\n1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n2. Go to `node_modules` ➜ `react-native-scratch` and add `RNScratch.xcodeproj`\n3. In XCode, in the project navigator, select your project. Add `libRNScratch.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n4. Run your project (`Cmd+R`)\u003c\n\n#### Android\n\n1. Open up `android/app/src/main/java/[...]/MainActivity.java`\n  - Add `import com.como.RNTScratchView.ScratchViewPackage;` to the imports at the top of the file\n  - Add `new ScratchViewPackage()` to the list returned by the `getPackages()` method\n2. Append the following lines to `android/settings.gradle`:\n  \t```\n  \tinclude ':react-native-scratch'\n  \tproject(':react-native-scratch').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-scratch/android')\n  \t```\n3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n  \t```\n      implementation project(':react-native-scratch')\n  \t```\n\n\n## Usage\n\nThe ScratchView will fill its containing view and cover all other content untill you scratch it\nJust put it as the last component in your view\n```javascript\nimport React, { Component } from 'react';\nimport { View } from 'react-native';\nimport ScratchView from 'react-native-scratch'\n\nclass MyView extends Component {\n\n\tonImageLoadFinished = ({ id, success }) =\u003e {\n\t\t// Do something\n\t}\n\n\tonScratchProgressChanged = ({ value, id }) =\u003e {\n\t\t// Do domething like showing the progress to the user\n\t}\n\n\tonScratchDone = ({ isScratchDone, id }) =\u003e {\n\t\t// Do something\n\t}\n\n\tonScratchTouchStateChanged = ({ id, touchState }) =\u003e {\n\t\t// Example: change a state value to stop a containing\n\t\t// FlatList from scrolling while scratching\n\t\tthis.setState({ scrollEnabled: !touchState });\n\t}\n\n\trender() {\n\t\treturn (\u003cView style={{ width: 300, height: 300 }}\u003e\n\t\t\t\u003cComponentA\u003e // will be covered by the ScratchView\n\t\t\t\u003cComponentB\u003e // will be covered by the ScratchView\n\t\t\t\u003cScratchView\n\t\t\t\tid={1} // ScratchView id (Optional)\n\t\t\t\tbrushSize={10} // Default is 10% of the smallest dimension (width/height)\n\t\t\t\tthreshold={70} // Report full scratch after 70 percentage, change as you see fit. Default is 50\n\t\t\t\tfadeOut={false} // Disable the fade out animation when scratch is done. Default is true\n\t\t\t\tplaceholderColor=\"#AAAAAA\" // Scratch color while image is loading (or while image not present)\n\t\t\t\timageUrl=\"http://yourUrlToImage.jpg\" // A url to your image (Optional)\n\t\t\t\tresourceName=\"your_image\" // An image resource name (without the extension like '.png/jpg etc') in the native bundle of the app (drawble for Android, Images.xcassets in iOS) (Optional)\n\t\t\t\tresizeMode=\"cover|contain|stretch\" // Resize the image to fit or fill the scratch view. Default is stretch\n\t\t\t\tonImageLoadFinished={this.onImageLoadFinished} // Event to indicate that the image has done loading\n\t\t\t\tonTouchStateChanged={this.onTouchStateChangedMethod} // Touch event (to stop a containing FlatList for example)\n\t\t\t\tonScratchProgressChanged={this.onScratchProgressChanged} // Scratch progress event while scratching\n\t\t\t\tonScratchDone={this.onScratchDone} // Scratch is done event\n\t\t\t/\u003e}\n\t\t\u003c/View\u003e)\n\t}\n\nexport default MyView;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitmobilernd%2Freact-native-scratch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconduitmobilernd%2Freact-native-scratch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconduitmobilernd%2Freact-native-scratch/lists"}