Skip to content

Commit 5a1bbbb

Browse files
authored
Merge pull request #19 from xendora/feature/react-native-changes
Added react native compatibility
2 parents 0bfa29e + 89c006f commit 5a1bbbb

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)