
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
react-scratchcard-v2
Advanced tools
A scratchcard component for React
This is a clone of https://github.com/aleksik/react-scratchcard
npm install --save react-scratchcard-v2
or
yarn add react-scratchcard-v2
import React, { useRef } from 'react';
import ScratchCard from 'react-scratchcard-v2';
import * as IMG from './img.jpg';
const App = () => {
const ref = useRef<ScratchCard>(null);
const onClickReset = () => {
ref.current && ref.current.reset();
}
return (
<div>
<button onClick={onClickReset}>Reset</button>
<ScratchCard
width={320}
height={226}
image={IMG}
finishPercent={80}
onComplete={() => console.log('complete')}
>
<div style={{
display: 'flex',
width: '100%',
height: '100%',
alignItems: 'center',
justifyContent: 'center'
}}
>
<h1>Scratch card</h1>
</div>
</ScratchCard>
</div>
);
};
const App = () => {
return (
<div>
<ScratchCard
width={320}
height={226}
image={IMG}
finishPercent={80}
customBrush={{
image: require('./brush.img'),
width: 15,
height: 15
}}
>
<h1>Scratch card</h1>
</ScratchCard>
</div>
);
};
or you can use CUSTOM_BRUSH_PRESET object
import { CUSTOM_BRUSH_PRESET } from 'react-scratchcard-v2';
const App = () => {
return (
<div>
<ScratchCard
width={320}
height={226}
image={IMG}
finishPercent={80}
customBrush={CUSTOM_BRUSH_PRESET}
>
<h1>Scratch card</h1>
</ScratchCard>
</div>
)
}
name | type | default |
---|---|---|
width | number | |
height | number | |
image | File or Base64 | |
finishPercent | ?number | 70 |
brushSize | ?number | 20 |
fadeOutOnComplete | ?boolean | true |
onComplete | ?callback | |
customBrush | ?CustomBrush | |
customCheckZone | ?CustomCheckZone |
name | type |
---|---|
width | number |
height | number |
image | File or Base64 |
name | type |
---|---|
x | number |
y | number |
width | number |
height | number |
MIT © dopey2
FAQs
A scratchcard component for React
The npm package react-scratchcard-v2 receives a total of 590 weekly downloads. As such, react-scratchcard-v2 popularity was classified as not popular.
We found that react-scratchcard-v2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.