Skip to content

Commit 89c006f

Browse files
committed
added react native adaptibility
1 parent d39692e commit 89c006f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ const ReactTimer = ({
1414

1515
useEffect(() => {
1616
if (!timerRef.current) {
17-
timerRef.current = window.setInterval(() => {
17+
timerRef.current = setInterval(() => {
1818
setValue((val) => onTick(val));
1919
}, interval);
2020
}
2121
if (end(value)) {
22-
window.clearInterval(timerRef.current);
22+
clearInterval(timerRef.current);
2323
onEnd(value);
2424
}
2525
}, [end, interval, onEnd, onTick, value]);
2626

2727
useEffect(() => () => {
28-
window.clearInterval(timerRef.current);
28+
clearInterval(timerRef.current);
2929
}, []);
3030

3131
return children(value);

0 commit comments

Comments
 (0)