@rific/timer 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ var Timer = ({ children, color, duration, onStart, onStop, radius, startProgress
46
46
  const progressRef = (0, import_react.useRef)(startProgress);
47
47
  const startedRef = (0, import_react.useRef)(null);
48
48
  const circumference = 2 * Math.PI * radius;
49
- const animation = (0, import_react.useRef)(new import_react_native.Animated.Value(0)).current;
49
+ const [animation] = (0, import_react.useState)(() => new import_react_native.Animated.Value(0));
50
50
  const animatedProps = {
51
51
  strokeDashoffset: animation.interpolate({
52
52
  inputRange: [0, 1],
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/Timer.tsx
2
- import { useCallback, useEffect, useRef } from "react";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
3
  import { Animated, Easing, StyleSheet, View } from "react-native";
4
4
  import Svg, { Circle, G } from "react-native-svg";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -10,7 +10,7 @@ var Timer = ({ children, color, duration, onStart, onStop, radius, startProgress
10
10
  const progressRef = useRef(startProgress);
11
11
  const startedRef = useRef(null);
12
12
  const circumference = 2 * Math.PI * radius;
13
- const animation = useRef(new Animated.Value(0)).current;
13
+ const [animation] = useState(() => new Animated.Value(0));
14
14
  const animatedProps = {
15
15
  strokeDashoffset: animation.interpolate({
16
16
  inputRange: [0, 1],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rific/timer",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Animated SVG progress ring timer for React Native",
5
5
  "keywords": [
6
6
  "react-native",
@@ -43,32 +43,33 @@
43
43
  "!src/__mocks__"
44
44
  ],
45
45
  "scripts": {
46
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
47
- "build:watch": "tsup src/index.ts --format cjs,esm --dts --watch",
46
+ "build": "tsup",
47
+ "build:watch": "tsup --watch",
48
48
  "fix": "eslint --fix",
49
49
  "lint": "eslint",
50
50
  "prepublishOnly": "npm run build",
51
51
  "release": "git push --follow-tags",
52
- "release:major": "npm version major && git push --follow-tags",
53
- "release:minor": "npm version minor && git push --follow-tags",
54
- "release:patch": "npm version patch && git push --follow-tags",
52
+ "release:major": "npm version major && npm run release",
53
+ "release:minor": "npm version minor && npm run release",
54
+ "release:patch": "npm version patch && npm run release",
55
55
  "test": "jest",
56
56
  "test:watch": "jest --watchAll",
57
57
  "typecheck": "tsc --noEmit",
58
- "preversion": "npm run lint && npm test && npm run build"
58
+ "verify": "npm run lint && npm test && npm run typecheck && npm run build",
59
+ "preversion": "npm run verify"
59
60
  },
61
+ "prettier": "@infinitetoken/eslint-config/prettier",
60
62
  "devDependencies": {
63
+ "@infinitetoken/eslint-config": "^0.1.8",
64
+ "@infinitetoken/jest-config": "^0.2.0",
65
+ "@infinitetoken/tsconfig": "^0.3.0",
61
66
  "@testing-library/dom": "^10.4.1",
62
67
  "@testing-library/react": "^16.3.2",
63
68
  "@types/jest": "^30.0.0",
64
69
  "@types/react": "^19.0.0",
65
- "@typescript-eslint/parser": "^8.59.3",
66
70
  "eslint": "^9.39.4",
67
- "eslint-config-prettier": "^10.1.8",
68
- "eslint-plugin-package-json": "^1.0.0",
69
- "eslint-plugin-prettier": "^5.5.5",
71
+ "eslint-plugin-react-hooks": "^7.1.1",
70
72
  "eslint-plugin-react-native": "^5.0.0",
71
- "eslint-plugin-simple-import-sort": "^13.0.0",
72
73
  "jest": "^30.4.2",
73
74
  "jest-environment-jsdom": "^30.4.1",
74
75
  "prettier": "^3.8.3",
@@ -76,11 +77,8 @@
76
77
  "react-dom": "^19.0.0",
77
78
  "react-native": "^0.85.3",
78
79
  "react-native-svg": "^15.15.5",
79
- "ts-jest": "^29.4.9",
80
- "ts-node": "^10.9.2",
81
80
  "tsup": "^8.0.0",
82
- "typescript": "^6.0.3",
83
- "typescript-eslint": "^8.59.3"
81
+ "typescript": "^6.0.3"
84
82
  },
85
83
  "peerDependencies": {
86
84
  "react": ">=19.0.0",
package/src/Timer.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { type ReactNode, useCallback, useEffect, useRef } from 'react'
1
+ import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react'
2
2
  import { Animated, Easing, StyleSheet, View, ViewStyle } from 'react-native'
3
3
  import Svg, { Circle, G } from 'react-native-svg'
4
4
 
@@ -24,7 +24,7 @@ export const Timer = ({ children, color, duration, onStart, onStop, radius, star
24
24
  const progressRef = useRef(startProgress)
25
25
  const startedRef = useRef<string | null>(null)
26
26
  const circumference = 2 * Math.PI * radius
27
- const animation = useRef(new Animated.Value(0)).current
27
+ const [animation] = useState(() => new Animated.Value(0))
28
28
  const animatedProps = {
29
29
  strokeDashoffset: animation.interpolate({
30
30
  inputRange: [0, 1],