react-native-timer-picker 1.7.0 → 1.8.1

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 (121) hide show
  1. package/README.md +67 -24
  2. package/dist/commonjs/assets/select_click.mp3 +0 -0
  3. package/dist/commonjs/components/{TimerPicker/DurationScroll.js → DurationScroll/index.js} +113 -63
  4. package/dist/commonjs/components/DurationScroll/index.js.map +1 -0
  5. package/dist/commonjs/components/DurationScroll/types.js +6 -0
  6. package/dist/commonjs/components/DurationScroll/types.js.map +1 -0
  7. package/dist/commonjs/components/Modal/index.js +21 -20
  8. package/dist/commonjs/components/Modal/index.js.map +1 -1
  9. package/dist/commonjs/components/Modal/{Modal.styles.js → styles.js} +1 -1
  10. package/dist/commonjs/components/Modal/styles.js.map +1 -0
  11. package/dist/commonjs/components/Modal/types.js +6 -0
  12. package/dist/commonjs/components/Modal/types.js.map +1 -0
  13. package/dist/commonjs/components/TimerPicker/index.js +57 -71
  14. package/dist/commonjs/components/TimerPicker/index.js.map +1 -1
  15. package/dist/commonjs/components/TimerPicker/{TimerPicker.styles.js → styles.js} +1 -3
  16. package/dist/commonjs/components/TimerPicker/styles.js.map +1 -0
  17. package/dist/commonjs/components/TimerPicker/types.js +6 -0
  18. package/dist/commonjs/components/TimerPicker/types.js.map +1 -0
  19. package/dist/commonjs/components/{index.js → TimerPickerModal/index.js} +35 -78
  20. package/dist/commonjs/components/TimerPickerModal/index.js.map +1 -0
  21. package/dist/commonjs/components/{TimerPickerModal.styles.js → TimerPickerModal/styles.js} +3 -5
  22. package/dist/commonjs/components/TimerPickerModal/styles.js.map +1 -0
  23. package/dist/commonjs/components/TimerPickerModal/types.js +6 -0
  24. package/dist/commonjs/components/TimerPickerModal/types.js.map +1 -0
  25. package/dist/commonjs/index.js +14 -13
  26. package/dist/commonjs/index.js.map +1 -1
  27. package/dist/commonjs/tests/DurationScroll.test.js +1 -1
  28. package/dist/commonjs/tests/DurationScroll.test.js.map +1 -1
  29. package/dist/commonjs/tests/Modal.test.js +7 -7
  30. package/dist/commonjs/tests/Modal.test.js.map +1 -1
  31. package/dist/commonjs/tests/TimerPicker.test.js.map +1 -1
  32. package/dist/commonjs/tests/TimerPickerModal.test.js +2 -2
  33. package/dist/commonjs/tests/TimerPickerModal.test.js.map +1 -1
  34. package/dist/commonjs/utils/generateNumbers.js.map +1 -1
  35. package/dist/commonjs/utils/getAdjustedLimit.js.map +1 -1
  36. package/dist/commonjs/utils/getScrollIndex.js +2 -2
  37. package/dist/commonjs/utils/getScrollIndex.js.map +1 -1
  38. package/dist/module/assets/select_click.mp3 +0 -0
  39. package/dist/module/components/{TimerPicker/DurationScroll.js → DurationScroll/index.js} +114 -64
  40. package/dist/module/components/DurationScroll/index.js.map +1 -0
  41. package/dist/module/components/DurationScroll/types.js +2 -0
  42. package/dist/module/components/DurationScroll/types.js.map +1 -0
  43. package/dist/module/components/Modal/index.js +19 -19
  44. package/dist/module/components/Modal/index.js.map +1 -1
  45. package/dist/module/components/Modal/{Modal.styles.js → styles.js} +1 -1
  46. package/dist/module/components/Modal/styles.js.map +1 -0
  47. package/dist/module/components/Modal/types.js +2 -0
  48. package/dist/module/components/Modal/types.js.map +1 -0
  49. package/dist/module/components/TimerPicker/index.js +56 -70
  50. package/dist/module/components/TimerPicker/index.js.map +1 -1
  51. package/dist/module/components/TimerPicker/{TimerPicker.styles.js → styles.js} +1 -2
  52. package/dist/module/components/TimerPicker/styles.js.map +1 -0
  53. package/dist/module/components/TimerPicker/types.js +2 -0
  54. package/dist/module/components/TimerPicker/types.js.map +1 -0
  55. package/dist/module/components/{index.js → TimerPickerModal/index.js} +34 -77
  56. package/dist/module/components/TimerPickerModal/index.js.map +1 -0
  57. package/dist/module/components/{TimerPickerModal.styles.js → TimerPickerModal/styles.js} +3 -4
  58. package/dist/module/components/TimerPickerModal/styles.js.map +1 -0
  59. package/dist/module/components/TimerPickerModal/types.js +2 -0
  60. package/dist/module/components/TimerPickerModal/types.js.map +1 -0
  61. package/dist/module/index.js +6 -4
  62. package/dist/module/index.js.map +1 -1
  63. package/dist/module/tests/DurationScroll.test.js +1 -1
  64. package/dist/module/tests/DurationScroll.test.js.map +1 -1
  65. package/dist/module/tests/Modal.test.js +1 -1
  66. package/dist/module/tests/Modal.test.js.map +1 -1
  67. package/dist/module/tests/TimerPicker.test.js.map +1 -1
  68. package/dist/module/tests/TimerPickerModal.test.js +2 -2
  69. package/dist/module/tests/TimerPickerModal.test.js.map +1 -1
  70. package/dist/module/utils/generateNumbers.js.map +1 -1
  71. package/dist/module/utils/getAdjustedLimit.js.map +1 -1
  72. package/dist/module/utils/getScrollIndex.js +2 -2
  73. package/dist/module/utils/getScrollIndex.js.map +1 -1
  74. package/dist/typescript/components/DurationScroll/index.d.ts +4 -0
  75. package/dist/typescript/components/{TimerPicker/DurationScroll.d.ts → DurationScroll/types.d.ts} +36 -29
  76. package/dist/typescript/components/Modal/index.d.ts +3 -14
  77. package/dist/typescript/components/Modal/types.d.ts +15 -0
  78. package/dist/typescript/components/TimerPicker/index.d.ts +2 -59
  79. package/dist/typescript/components/TimerPicker/styles.d.ts +1022 -0
  80. package/dist/typescript/components/TimerPicker/types.d.ts +61 -0
  81. package/dist/typescript/components/TimerPickerModal/index.d.ts +4 -0
  82. package/dist/typescript/components/TimerPickerModal/styles.d.ts +738 -0
  83. package/dist/typescript/components/{index.d.ts → TimerPickerModal/types.d.ts} +24 -26
  84. package/dist/typescript/index.d.ts +6 -4
  85. package/dist/typescript/utils/generateNumbers.d.ts +4 -4
  86. package/dist/typescript/utils/getAdjustedLimit.d.ts +1 -1
  87. package/dist/typescript/utils/getScrollIndex.d.ts +2 -2
  88. package/package.json +14 -11
  89. package/src/assets/select_click.mp3 +0 -0
  90. package/src/components/{TimerPicker/DurationScroll.tsx → DurationScroll/index.tsx} +126 -110
  91. package/src/components/DurationScroll/types.ts +63 -0
  92. package/src/components/Modal/index.tsx +20 -30
  93. package/src/components/Modal/types.ts +17 -0
  94. package/src/components/TimerPicker/index.tsx +52 -132
  95. package/src/components/TimerPicker/{TimerPicker.styles.ts → styles.ts} +11 -11
  96. package/src/components/TimerPicker/types.ts +72 -0
  97. package/src/components/{index.tsx → TimerPickerModal/index.tsx} +31 -126
  98. package/src/components/{TimerPickerModal.styles.ts → TimerPickerModal/styles.ts} +10 -9
  99. package/src/components/TimerPickerModal/types.ts +52 -0
  100. package/src/index.ts +6 -7
  101. package/src/tests/DurationScroll.test.tsx +3 -1
  102. package/src/tests/Modal.test.tsx +3 -1
  103. package/src/tests/TimerPicker.test.tsx +2 -0
  104. package/src/tests/TimerPickerModal.test.tsx +3 -1
  105. package/src/utils/generateNumbers.ts +4 -4
  106. package/src/utils/getAdjustedLimit.ts +1 -1
  107. package/src/utils/getScrollIndex.ts +3 -3
  108. package/dist/commonjs/components/Modal/Modal.styles.js.map +0 -1
  109. package/dist/commonjs/components/TimerPicker/DurationScroll.js.map +0 -1
  110. package/dist/commonjs/components/TimerPicker/TimerPicker.styles.js.map +0 -1
  111. package/dist/commonjs/components/TimerPickerModal.styles.js.map +0 -1
  112. package/dist/commonjs/components/index.js.map +0 -1
  113. package/dist/module/components/Modal/Modal.styles.js.map +0 -1
  114. package/dist/module/components/TimerPicker/DurationScroll.js.map +0 -1
  115. package/dist/module/components/TimerPicker/TimerPicker.styles.js.map +0 -1
  116. package/dist/module/components/TimerPickerModal.styles.js.map +0 -1
  117. package/dist/module/components/index.js.map +0 -1
  118. package/dist/typescript/components/TimerPicker/TimerPicker.styles.d.ts +0 -3100
  119. package/dist/typescript/components/TimerPickerModal.styles.d.ts +0 -2195
  120. /package/dist/typescript/components/Modal/{Modal.styles.d.ts → styles.d.ts} +0 -0
  121. /package/src/components/Modal/{Modal.styles.ts → styles.ts} +0 -0
@@ -1,14 +1,39 @@
1
- import React, { MutableRefObject } from "react";
2
- import { View } from "react-native";
3
- import { generateStyles } from "./TimerPicker.styles";
1
+ import type { MutableRefObject } from "react";
2
+ import type { View } from "react-native";
3
+ import type { generateStyles } from "../TimerPicker/styles";
4
+ export interface DurationScrollProps {
5
+ Audio?: any;
6
+ Haptics?: any;
7
+ LinearGradient?: any;
8
+ aggressivelyGetLatestDuration: boolean;
9
+ allowFontScaling?: boolean;
10
+ amLabel?: string;
11
+ bottomPickerGradientOverlayProps?: Partial<LinearGradientProps>;
12
+ clickSoundAsset?: SoundAssetType;
13
+ disableInfiniteScroll?: boolean;
14
+ initialValue?: number;
15
+ is12HourPicker?: boolean;
16
+ isDisabled?: boolean;
17
+ label?: string | React.ReactElement;
18
+ limit?: LimitType;
19
+ numberOfItems: number;
20
+ onDurationChange: (duration: number) => void;
21
+ padNumbersWithZero?: boolean;
22
+ padWithNItems: number;
23
+ pickerGradientOverlayProps?: Partial<LinearGradientProps>;
24
+ pmLabel?: string;
25
+ styles: ReturnType<typeof generateStyles>;
26
+ testID?: string;
27
+ topPickerGradientOverlayProps?: Partial<LinearGradientProps>;
28
+ }
4
29
  export interface DurationScrollRef {
30
+ latestDuration: MutableRefObject<number>;
5
31
  reset: (options?: {
6
32
  animated?: boolean;
7
33
  }) => void;
8
34
  setValue: (value: number, options?: {
9
35
  animated?: boolean;
10
36
  }) => void;
11
- latestDuration: MutableRefObject<number>;
12
37
  }
13
38
  type LinearGradientPoint = {
14
39
  x: number;
@@ -16,35 +41,17 @@ type LinearGradientPoint = {
16
41
  };
17
42
  export type LinearGradientProps = React.ComponentProps<typeof View> & {
18
43
  colors: string[];
44
+ end?: LinearGradientPoint | null;
19
45
  locations?: number[] | null;
20
46
  start?: LinearGradientPoint | null;
21
- end?: LinearGradientPoint | null;
22
47
  };
23
48
  export type LimitType = {
24
49
  max?: number;
25
50
  min?: number;
26
51
  };
27
- interface DurationScrollProps {
28
- allowFontScaling?: boolean;
29
- numberOfItems: number;
30
- label?: string | React.ReactElement;
31
- initialValue?: number;
32
- onDurationChange: (duration: number) => void;
33
- padNumbersWithZero?: boolean;
34
- disableInfiniteScroll?: boolean;
35
- isDisabled?: boolean;
36
- limit?: LimitType;
37
- aggressivelyGetLatestDuration: boolean;
38
- is12HourPicker?: boolean;
39
- amLabel?: string;
40
- pmLabel?: string;
41
- padWithNItems: number;
42
- pickerGradientOverlayProps?: Partial<LinearGradientProps>;
43
- topPickerGradientOverlayProps?: Partial<LinearGradientProps>;
44
- bottomPickerGradientOverlayProps?: Partial<LinearGradientProps>;
45
- LinearGradient?: any;
46
- testID?: string;
47
- styles: ReturnType<typeof generateStyles>;
48
- }
49
- declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<DurationScrollProps & React.RefAttributes<DurationScrollRef>>>;
50
- export default _default;
52
+ export type SoundAssetType = number | {
53
+ headers?: Record<string, string>;
54
+ overrideFileExtensionAndroid?: string;
55
+ uri: string;
56
+ };
57
+ export {};
@@ -1,16 +1,5 @@
1
1
  import React from "react";
2
- interface ModalProps {
3
- children?: React.ReactElement;
4
- onOverlayPress?: () => void;
5
- onHide?: () => void;
6
- isVisible?: boolean;
7
- animationDuration?: number;
8
- overlayOpacity?: number;
9
- modalProps?: any;
10
- contentStyle?: any;
11
- overlayStyle?: any;
12
- testID?: string;
13
- }
14
- export declare const Modal: ({ children, onOverlayPress, onHide, isVisible, animationDuration, overlayOpacity, modalProps, contentStyle, overlayStyle, testID, }: ModalProps) => React.ReactElement;
15
- declare const _default: React.MemoExoticComponent<({ children, onOverlayPress, onHide, isVisible, animationDuration, overlayOpacity, modalProps, contentStyle, overlayStyle, testID, }: ModalProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>>;
2
+ import type { ModalProps } from "./types";
3
+ export declare const Modal: (props: ModalProps) => React.JSX.Element;
4
+ declare const _default: React.MemoExoticComponent<(props: ModalProps) => React.JSX.Element>;
16
5
  export default _default;
@@ -0,0 +1,15 @@
1
+ import type { ComponentProps } from "react";
2
+ import type { ViewStyle } from "react-native";
3
+ import type { Modal as ReactNativeModal } from "react-native";
4
+ export interface ModalProps {
5
+ animationDuration?: number;
6
+ children?: React.ReactElement;
7
+ contentStyle?: ViewStyle;
8
+ isVisible?: boolean;
9
+ modalProps?: ComponentProps<typeof ReactNativeModal>;
10
+ onHide?: () => void;
11
+ onOverlayPress?: () => void;
12
+ overlayOpacity?: number;
13
+ overlayStyle?: ViewStyle;
14
+ testID?: string;
15
+ }
@@ -1,61 +1,4 @@
1
- import React, { MutableRefObject } from "react";
2
- import { View } from "react-native";
3
- import { LimitType } from "./DurationScroll";
4
- import { CustomTimerPickerStyles } from "./TimerPicker.styles";
5
- import { LinearGradientProps } from "./DurationScroll";
6
- export interface TimerPickerRef {
7
- reset: (options?: {
8
- animated?: boolean;
9
- }) => void;
10
- setValue: (value: {
11
- hours: number;
12
- minutes: number;
13
- seconds: number;
14
- }, options?: {
15
- animated?: boolean;
16
- }) => void;
17
- latestDuration: {
18
- hours: MutableRefObject<number> | undefined;
19
- minutes: MutableRefObject<number> | undefined;
20
- seconds: MutableRefObject<number> | undefined;
21
- };
22
- }
23
- export interface TimerPickerProps {
24
- allowFontScaling?: boolean;
25
- onDurationChange?: (duration: {
26
- hours: number;
27
- minutes: number;
28
- seconds: number;
29
- }) => void;
30
- initialValue?: {
31
- hours?: number;
32
- minutes?: number;
33
- seconds?: number;
34
- };
35
- aggressivelyGetLatestDuration?: boolean;
36
- use12HourPicker?: boolean;
37
- amLabel?: string;
38
- pmLabel?: string;
39
- hideHours?: boolean;
40
- hideMinutes?: boolean;
41
- hideSeconds?: boolean;
42
- hoursPickerIsDisabled?: boolean;
43
- minutesPickerIsDisabled?: boolean;
44
- secondsPickerIsDisabled?: boolean;
45
- hourLimit?: LimitType;
46
- minuteLimit?: LimitType;
47
- secondLimit?: LimitType;
48
- hourLabel?: string | React.ReactElement;
49
- minuteLabel?: string | React.ReactElement;
50
- secondLabel?: string | React.ReactElement;
51
- padWithNItems?: number;
52
- disableInfiniteScroll?: boolean;
53
- LinearGradient?: any;
54
- pickerContainerProps?: React.ComponentProps<typeof View>;
55
- pickerGradientOverlayProps?: Partial<LinearGradientProps>;
56
- topPickerGradientOverlayProps?: Partial<LinearGradientProps>;
57
- bottomPickerGradientOverlayProps?: Partial<LinearGradientProps>;
58
- styles?: CustomTimerPickerStyles;
59
- }
1
+ import React from "react";
2
+ import type { TimerPickerProps, TimerPickerRef } from "./types";
60
3
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<TimerPickerProps & React.RefAttributes<TimerPickerRef>>>;
61
4
  export default _default;