@forthtilliath/react-native-kit 0.17.1 → 0.19.0

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.
Files changed (34) hide show
  1. package/README.md +54 -15
  2. package/dist/components/picker/PhotoPicker.d.ts +16 -29
  3. package/dist/components/picker/PhotoPicker.d.ts.map +1 -1
  4. package/dist/components/picker/PhotoPicker.js +48 -81
  5. package/dist/components/picker/PhotoPicker.styles.d.ts +63 -0
  6. package/dist/components/picker/PhotoPicker.styles.d.ts.map +1 -0
  7. package/dist/components/picker/PhotoPicker.styles.js +59 -0
  8. package/dist/components/picker/QuantityStepper.d.ts +38 -29
  9. package/dist/components/picker/QuantityStepper.d.ts.map +1 -1
  10. package/dist/components/picker/QuantityStepper.js +101 -74
  11. package/dist/components/picker/QuantityStepper.styles.d.ts +59 -0
  12. package/dist/components/picker/QuantityStepper.styles.d.ts.map +1 -0
  13. package/dist/components/picker/QuantityStepper.styles.js +46 -0
  14. package/dist/components/settings/UpdateSettingsScreen.d.ts +5 -1
  15. package/dist/components/settings/UpdateSettingsScreen.d.ts.map +1 -1
  16. package/dist/components/settings/UpdateSettingsScreen.js +3 -3
  17. package/dist/components/settings/UpdateSettingsScreen.styles.d.ts +2 -0
  18. package/dist/components/settings/UpdateSettingsScreen.styles.d.ts.map +1 -1
  19. package/dist/components/theme/BackgroundPicker.d.ts +46 -0
  20. package/dist/components/theme/BackgroundPicker.d.ts.map +1 -0
  21. package/dist/components/theme/BackgroundPicker.js +79 -0
  22. package/dist/components/theme/findBackground.d.ts +20 -0
  23. package/dist/components/theme/findBackground.d.ts.map +1 -0
  24. package/dist/components/theme/findBackground.js +12 -0
  25. package/dist/components/theme/index.d.ts +2 -0
  26. package/dist/components/theme/index.d.ts.map +1 -1
  27. package/dist/components/theme/index.js +2 -0
  28. package/dist/hooks/index.d.ts +1 -0
  29. package/dist/hooks/index.d.ts.map +1 -1
  30. package/dist/hooks/index.js +1 -0
  31. package/dist/hooks/usePressRepeat.d.ts +31 -0
  32. package/dist/hooks/usePressRepeat.d.ts.map +1 -0
  33. package/dist/hooks/usePressRepeat.js +47 -0
  34. package/package.json +5 -5
@@ -0,0 +1,47 @@
1
+ import { useEffect, useRef } from "react";
2
+ function clearTimers(timers) {
3
+ clearTimeout(timers.delay);
4
+ clearInterval(timers.repeat);
5
+ clearTimeout(timers.accelerate);
6
+ }
7
+ /**
8
+ * Repeats an action while a button is held, faster and faster — the way a
9
+ * counter's −/+ reach large values quickly. `start` runs the action at once,
10
+ * then again every `interval` after `initialDelay`, every `fastInterval`
11
+ * after `accelerateAfter`; `stop` ends it (also done on unmount).
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const repeat = usePressRepeat();
16
+ * <Pressable
17
+ * onPressIn={() => repeat.start(() => setCount((n) => n + 1))}
18
+ * onPressOut={repeat.stop}
19
+ * />
20
+ * ```
21
+ */
22
+ export function usePressRepeat({ initialDelay = 450, interval = 180, accelerateAfter = 1200, fastInterval = 60, } = {}) {
23
+ const timersRef = useRef({});
24
+ useEffect(() => {
25
+ const timers = timersRef;
26
+ return () => {
27
+ clearTimers(timers.current);
28
+ };
29
+ }, []);
30
+ function stop() {
31
+ clearTimers(timersRef.current);
32
+ timersRef.current = {};
33
+ }
34
+ function start(action) {
35
+ stop();
36
+ action();
37
+ const timers = timersRef.current;
38
+ timers.delay = setTimeout(() => {
39
+ timers.repeat = setInterval(action, interval);
40
+ timers.accelerate = setTimeout(() => {
41
+ clearInterval(timers.repeat);
42
+ timers.repeat = setInterval(action, fastInterval);
43
+ }, accelerateAfter);
44
+ }, initialDelay);
45
+ }
46
+ return { start, stop };
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forthtilliath/react-native-kit",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  "./*": "./dist/*.js"
23
23
  },
24
24
  "dependencies": {
25
- "@forthtilliath/ts-kit": "^0.13.0"
25
+ "@forthtilliath/ts-kit": "^0.14.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@expo/vector-icons": ">=15.0.0",
@@ -102,15 +102,15 @@
102
102
  "size-limit": "^14.1.0",
103
103
  "typescript": "^5.9.3",
104
104
  "vitest": "^5.0.2",
105
- "@forthtilliath/eslint-config": "0.9.0",
105
+ "@forthtilliath/expo-release-updates-ui": "^0.5.0",
106
106
  "@forthtilliath/typescript-config": "0.1.1",
107
- "@forthtilliath/expo-release-updates-ui": "^0.4.1"
107
+ "@forthtilliath/eslint-config": "0.9.0"
108
108
  },
109
109
  "size-limit": [
110
110
  {
111
111
  "name": "dist (all modules, brotli)",
112
112
  "path": "dist/**/*.js",
113
- "limit": "44 KB"
113
+ "limit": "47 KB"
114
114
  }
115
115
  ],
116
116
  "scripts": {