react-native-timer-picker 2.0.0 → 2.0.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.
- package/dist/commonjs/components/DurationScroll/index.js +1 -1
- package/dist/commonjs/components/DurationScroll/index.js.map +1 -1
- package/dist/commonjs/components/TimerPicker/index.js +7 -6
- package/dist/commonjs/components/TimerPicker/index.js.map +1 -1
- package/dist/commonjs/components/TimerPickerModal/index.js +10 -7
- package/dist/commonjs/components/TimerPickerModal/index.js.map +1 -1
- package/dist/commonjs/components/TimerPickerModal/styles.js +87 -54
- package/dist/commonjs/components/TimerPickerModal/styles.js.map +1 -1
- package/dist/commonjs/utils/getSafeInitialValue.js +13 -0
- package/dist/commonjs/utils/getSafeInitialValue.js.map +1 -0
- package/dist/module/components/DurationScroll/index.js +1 -1
- package/dist/module/components/DurationScroll/index.js.map +1 -1
- package/dist/module/components/TimerPicker/index.js +7 -6
- package/dist/module/components/TimerPicker/index.js.map +1 -1
- package/dist/module/components/TimerPickerModal/index.js +10 -7
- package/dist/module/components/TimerPickerModal/index.js.map +1 -1
- package/dist/module/components/TimerPickerModal/styles.js +87 -54
- package/dist/module/components/TimerPickerModal/styles.js.map +1 -1
- package/dist/module/utils/getSafeInitialValue.js +6 -0
- package/dist/module/utils/getSafeInitialValue.js.map +1 -0
- package/dist/typescript/components/TimerPickerModal/styles.d.ts +117 -8
- package/dist/typescript/utils/getSafeInitialValue.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","useCallback","useEffect","useImperativeHandle","useRef","useState","View","Text","TouchableOpacity","Modal","TimerPicker","generateStyles","TimerPickerModal","props","ref","buttonContainerProps","buttonTouchableOpacityProps","cancelButtonText","closeOnOverlayPress","confirmButtonText","containerProps","contentContainerProps","hideCancelButton","initialValue","modalProps","modalTitle","modalTitleProps","onCancel","onConfirm","onDurationChange","setIsVisible","styles","customStyles","visible","otherProps","timerPickerRef","safeInitialValue","hours","minutes","seconds","selectedDuration","setSelectedDuration","confirmedDuration","setConfirmedDuration","reset","options","_timerPickerRef$curre","current","hideModalHandler","confirmHandler","_timerPickerRef$curre2","_latestDuration$hours","_latestDuration$minut","_latestDuration$secon","latestDuration","newDuration","cancelHandler","durationChangeHandler","duration","_timerPickerRef$curre4","_timerPickerRef$curre5","_timerPickerRef$curre6","setValue","value","_timerPickerRef$curre3","createElement","_extends","isVisible","onOverlayPress","undefined","testID","style","container","contentContainer","aggressivelyGetLatestDuration","buttonContainer","onPress","button","cancelButton","confirmButton","memo"],"sources":["index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\n\nimport { View, Text, TouchableOpacity } from \"react-native\";\n\nimport Modal from \"../Modal\";\nimport TimerPicker from \"../TimerPicker\";\nimport type { TimerPickerRef } from \"../TimerPicker/types\";\n\nimport { generateStyles } from \"./styles\";\nimport type { TimerPickerModalRef, TimerPickerModalProps } from \"./types\";\n\nconst TimerPickerModal = forwardRef<TimerPickerModalRef, TimerPickerModalProps>(\n (props, ref) => {\n const {\n buttonContainerProps,\n buttonTouchableOpacityProps,\n cancelButtonText = \"Cancel\",\n closeOnOverlayPress,\n confirmButtonText = \"Confirm\",\n containerProps,\n contentContainerProps,\n hideCancelButton = false,\n initialValue,\n modalProps,\n modalTitle,\n modalTitleProps,\n onCancel,\n onConfirm,\n onDurationChange,\n setIsVisible,\n styles: customStyles,\n visible,\n ...otherProps\n } = props;\n\n const styles = generateStyles(customStyles);\n\n const timerPickerRef = useRef<TimerPickerRef>(null);\n\n const safeInitialValue = {\n hours: initialValue?.hours ?? 0,\n minutes: initialValue?.minutes ?? 0,\n seconds: initialValue?.seconds ?? 0,\n };\n\n const [selectedDuration, setSelectedDuration] =\n useState(safeInitialValue);\n const [confirmedDuration, setConfirmedDuration] =\n useState(safeInitialValue);\n\n const reset = (options?: { animated?: boolean }) => {\n setSelectedDuration(safeInitialValue);\n setConfirmedDuration(safeInitialValue);\n timerPickerRef.current?.reset(options);\n };\n\n // reset state if the initial value changes\n useEffect(() => {\n reset();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n safeInitialValue.hours,\n safeInitialValue.minutes,\n safeInitialValue.seconds,\n ]);\n\n const hideModalHandler = () => {\n setSelectedDuration({\n hours: confirmedDuration.hours,\n minutes: confirmedDuration.minutes,\n seconds: confirmedDuration.seconds,\n });\n setIsVisible(false);\n };\n\n const confirmHandler = () => {\n const latestDuration = timerPickerRef.current?.latestDuration;\n\n const newDuration = {\n hours: latestDuration?.hours?.current ?? selectedDuration.hours,\n minutes:\n latestDuration?.minutes?.current ??\n selectedDuration.minutes,\n seconds:\n latestDuration?.seconds?.current ??\n selectedDuration.seconds,\n };\n setConfirmedDuration(newDuration);\n onConfirm(newDuration);\n };\n\n const cancelHandler = () => {\n setIsVisible(false);\n setSelectedDuration(confirmedDuration);\n onCancel?.();\n };\n\n // wrapped in useCallback to avoid unnecessary re-renders of TimerPicker\n const durationChangeHandler = useCallback(\n (duration: { hours: number; minutes: number; seconds: number }) => {\n setSelectedDuration(duration);\n onDurationChange?.(duration);\n },\n [onDurationChange]\n );\n\n useImperativeHandle(ref, () => ({\n reset,\n setValue: (value, options) => {\n setSelectedDuration(value);\n setConfirmedDuration(value);\n timerPickerRef.current?.setValue(value, options);\n },\n latestDuration: {\n hours: timerPickerRef.current?.latestDuration?.hours,\n minutes: timerPickerRef.current?.latestDuration?.minutes,\n seconds: timerPickerRef.current?.latestDuration?.seconds,\n },\n }));\n\n return (\n <Modal\n isVisible={visible}\n onOverlayPress={\n closeOnOverlayPress ? hideModalHandler : undefined\n }\n {...modalProps}\n testID=\"timer-picker-modal\">\n <View {...containerProps} style={styles.container}>\n <View\n {...contentContainerProps}\n style={styles.contentContainer}>\n {modalTitle ? (\n <Text\n {...modalTitleProps}\n style={styles.modalTitle}>\n {modalTitle}\n </Text>\n ) : null}\n <TimerPicker\n ref={timerPickerRef}\n initialValue={confirmedDuration}\n {...otherProps}\n aggressivelyGetLatestDuration\n onDurationChange={durationChangeHandler}\n styles={customStyles}\n />\n <View\n {...buttonContainerProps}\n style={styles.buttonContainer}>\n {!hideCancelButton ? (\n <TouchableOpacity\n {...buttonTouchableOpacityProps}\n onPress={cancelHandler}>\n <Text\n style={[\n styles.button,\n styles.cancelButton,\n ]}>\n {cancelButtonText}\n </Text>\n </TouchableOpacity>\n ) : null}\n <TouchableOpacity\n {...buttonTouchableOpacityProps}\n onPress={confirmHandler}>\n <Text\n style={[\n styles.button,\n styles.confirmButton,\n ]}>\n {confirmButtonText}\n </Text>\n </TouchableOpacity>\n </View>\n </View>\n </View>\n </Modal>\n );\n }\n);\n\nexport default React.memo(TimerPickerModal);\n"],"mappings":";AAAA,OAAOA,KAAK,IACRC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACL,OAAO;AAEd,SAASC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAE3D,OAAOC,KAAK,MAAM,UAAU;AAC5B,OAAOC,WAAW,MAAM,gBAAgB;AAGxC,SAASC,cAAc,QAAQ,UAAU;AAGzC,MAAMC,gBAAgB,gBAAGZ,UAAU,CAC/B,CAACa,KAAK,EAAEC,GAAG,KAAK;EACZ,MAAM;IACFC,oBAAoB;IACpBC,2BAA2B;IAC3BC,gBAAgB,GAAG,QAAQ;IAC3BC,mBAAmB;IACnBC,iBAAiB,GAAG,SAAS;IAC7BC,cAAc;IACdC,qBAAqB;IACrBC,gBAAgB,GAAG,KAAK;IACxBC,YAAY;IACZC,UAAU;IACVC,UAAU;IACVC,eAAe;IACfC,QAAQ;IACRC,SAAS;IACTC,gBAAgB;IAChBC,YAAY;IACZC,MAAM,EAAEC,YAAY;IACpBC,OAAO;IACP,GAAGC;EACP,CAAC,GAAGrB,KAAK;EAET,MAAMkB,MAAM,GAAGpB,cAAc,CAACqB,YAAY,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,"names":["React","forwardRef","useCallback","useEffect","useImperativeHandle","useRef","useState","View","Text","TouchableOpacity","getSafeInitialValue","Modal","TimerPicker","generateStyles","TimerPickerModal","props","ref","buttonContainerProps","buttonTouchableOpacityProps","cancelButtonText","closeOnOverlayPress","confirmButtonText","containerProps","contentContainerProps","hideCancelButton","initialValue","modalProps","modalTitle","modalTitleProps","onCancel","onConfirm","onDurationChange","setIsVisible","styles","customStyles","visible","otherProps","hasModalTitle","Boolean","timerPickerRef","safeInitialValue","hours","minutes","seconds","selectedDuration","setSelectedDuration","confirmedDuration","setConfirmedDuration","reset","options","_timerPickerRef$curre","current","hideModalHandler","confirmHandler","_timerPickerRef$curre2","_latestDuration$hours","_latestDuration$minut","_latestDuration$secon","latestDuration","newDuration","cancelHandler","durationChangeHandler","duration","_timerPickerRef$curre4","_timerPickerRef$curre5","_timerPickerRef$curre6","setValue","value","_timerPickerRef$curre3","createElement","_extends","isVisible","onOverlayPress","undefined","testID","style","container","contentContainer","aggressivelyGetLatestDuration","timerPickerStyles","buttonContainer","onPress","button","cancelButton","confirmButton","memo"],"sources":["index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\n\nimport { View, Text, TouchableOpacity } from \"react-native\";\n\nimport { getSafeInitialValue } from \"../../utils/getSafeInitialValue\";\nimport Modal from \"../Modal\";\nimport TimerPicker from \"../TimerPicker\";\nimport type { TimerPickerRef } from \"../TimerPicker/types\";\n\nimport { generateStyles } from \"./styles\";\nimport type { TimerPickerModalRef, TimerPickerModalProps } from \"./types\";\n\nconst TimerPickerModal = forwardRef<TimerPickerModalRef, TimerPickerModalProps>(\n (props, ref) => {\n const {\n buttonContainerProps,\n buttonTouchableOpacityProps,\n cancelButtonText = \"Cancel\",\n closeOnOverlayPress,\n confirmButtonText = \"Confirm\",\n containerProps,\n contentContainerProps,\n hideCancelButton = false,\n initialValue,\n modalProps,\n modalTitle,\n modalTitleProps,\n onCancel,\n onConfirm,\n onDurationChange,\n setIsVisible,\n styles: customStyles,\n visible,\n ...otherProps\n } = props;\n\n const styles = generateStyles(customStyles, {\n hasModalTitle: Boolean(modalTitle),\n });\n\n const timerPickerRef = useRef<TimerPickerRef>(null);\n\n const safeInitialValue = getSafeInitialValue({\n hours: initialValue?.hours,\n minutes: initialValue?.minutes,\n seconds: initialValue?.seconds,\n });\n\n const [selectedDuration, setSelectedDuration] =\n useState(safeInitialValue);\n const [confirmedDuration, setConfirmedDuration] =\n useState(safeInitialValue);\n\n const reset = (options?: { animated?: boolean }) => {\n setSelectedDuration(safeInitialValue);\n setConfirmedDuration(safeInitialValue);\n timerPickerRef.current?.reset(options);\n };\n\n // reset state if the initial value changes\n useEffect(() => {\n reset();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n safeInitialValue.hours,\n safeInitialValue.minutes,\n safeInitialValue.seconds,\n ]);\n\n const hideModalHandler = () => {\n setSelectedDuration({\n hours: confirmedDuration.hours,\n minutes: confirmedDuration.minutes,\n seconds: confirmedDuration.seconds,\n });\n setIsVisible(false);\n };\n\n const confirmHandler = () => {\n const latestDuration = timerPickerRef.current?.latestDuration;\n\n const newDuration = {\n hours: latestDuration?.hours?.current ?? selectedDuration.hours,\n minutes:\n latestDuration?.minutes?.current ??\n selectedDuration.minutes,\n seconds:\n latestDuration?.seconds?.current ??\n selectedDuration.seconds,\n };\n setConfirmedDuration(newDuration);\n onConfirm(newDuration);\n };\n\n const cancelHandler = () => {\n setIsVisible(false);\n setSelectedDuration(confirmedDuration);\n onCancel?.();\n };\n\n // wrapped in useCallback to avoid unnecessary re-renders of TimerPicker\n const durationChangeHandler = useCallback(\n (duration: { hours: number; minutes: number; seconds: number }) => {\n setSelectedDuration(duration);\n onDurationChange?.(duration);\n },\n [onDurationChange]\n );\n\n useImperativeHandle(ref, () => ({\n reset,\n setValue: (value, options) => {\n setSelectedDuration(value);\n setConfirmedDuration(value);\n timerPickerRef.current?.setValue(value, options);\n },\n latestDuration: {\n hours: timerPickerRef.current?.latestDuration?.hours,\n minutes: timerPickerRef.current?.latestDuration?.minutes,\n seconds: timerPickerRef.current?.latestDuration?.seconds,\n },\n }));\n\n return (\n <Modal\n isVisible={visible}\n onOverlayPress={\n closeOnOverlayPress ? hideModalHandler : undefined\n }\n {...modalProps}\n testID=\"timer-picker-modal\">\n <View {...containerProps} style={styles.container}>\n <View\n {...contentContainerProps}\n style={styles.contentContainer}>\n {modalTitle ? (\n <Text\n {...modalTitleProps}\n style={styles.modalTitle}>\n {modalTitle}\n </Text>\n ) : null}\n <TimerPicker\n ref={timerPickerRef}\n initialValue={confirmedDuration}\n {...otherProps}\n aggressivelyGetLatestDuration\n onDurationChange={durationChangeHandler}\n styles={styles.timerPickerStyles}\n />\n <View\n {...buttonContainerProps}\n style={styles.buttonContainer}>\n {!hideCancelButton ? (\n <TouchableOpacity\n {...buttonTouchableOpacityProps}\n onPress={cancelHandler}>\n <Text\n style={[\n styles.button,\n styles.cancelButton,\n ]}>\n {cancelButtonText}\n </Text>\n </TouchableOpacity>\n ) : null}\n <TouchableOpacity\n {...buttonTouchableOpacityProps}\n onPress={confirmHandler}>\n <Text\n style={[\n styles.button,\n styles.confirmButton,\n ]}>\n {confirmButtonText}\n </Text>\n </TouchableOpacity>\n </View>\n </View>\n </View>\n </Modal>\n );\n }\n);\n\nexport default React.memo(TimerPickerModal);\n"],"mappings":";AAAA,OAAOA,KAAK,IACRC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACL,OAAO;AAEd,SAASC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AAE3D,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,OAAOC,KAAK,MAAM,UAAU;AAC5B,OAAOC,WAAW,MAAM,gBAAgB;AAGxC,SAASC,cAAc,QAAQ,UAAU;AAGzC,MAAMC,gBAAgB,gBAAGb,UAAU,CAC/B,CAACc,KAAK,EAA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AM,CAACiD,MAAM,EACbjD,MAAM,CAACkD,YAAY;EACrB,GACDhE,gBACC,CACQ,CAAC,GACnB,IAAI,eACRnB,KAAA,CAAAqE,aAAA,CAAC5D,gBAAgB,EAAA6D,QAAA,KACTpD,2BAA2B;IAC/B+D,OAAO,EAAE5B;EAAe,iBACxBrD,KAAA,CAAAqE,aAAA,CAAC7D,IAAI;IACDmE,KAAK,EAAE,CACH1C,MAAM,CAACiD,MAAM,EACbjD,MAAM,CAACmD,aAAa;EACtB,GACD/D,iBACC,CACQ,CAChB,CACJ,CACJ,CACH,CAAC;AAEhB,CACJ,CAAC;AAED,4BAAerB,KAAK,CAACqF,IAAI,CAACvE,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -3,58 +3,91 @@ const DARK_MODE_BACKGROUND_COLOR = "#232323";
|
|
|
3
3
|
const DARK_MODE_TEXT_COLOR = "#E9E9E9";
|
|
4
4
|
const LIGHT_MODE_BACKGROUND_COLOR = "#F1F1F1";
|
|
5
5
|
const LIGHT_MODE_TEXT_COLOR = "#1B1B1B";
|
|
6
|
-
export const generateStyles = customStyles =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
6
|
+
export const generateStyles = (customStyles, variables) => {
|
|
7
|
+
const {
|
|
8
|
+
button: customButtonStyle,
|
|
9
|
+
buttonContainer: customButtonContainerStyle,
|
|
10
|
+
cancelButton: customCancelButtonStyle,
|
|
11
|
+
confirmButton: customConfirmButtonStyle,
|
|
12
|
+
container: customContainerStyle,
|
|
13
|
+
contentContainer: customContentContainerStyle,
|
|
14
|
+
modalTitle: customModalTitleStyle,
|
|
15
|
+
...customTimerPickerStyles
|
|
16
|
+
} = customStyles ?? {};
|
|
17
|
+
return StyleSheet.create({
|
|
18
|
+
container: {
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
overflow: "hidden",
|
|
21
|
+
...customContainerStyle,
|
|
22
|
+
// disable setting alignItems here because it can affect
|
|
23
|
+
// the FlatList's ability to calculate its layout, which can
|
|
24
|
+
// stop snapToOffsets working properly
|
|
25
|
+
alignItems: undefined
|
|
26
|
+
},
|
|
27
|
+
contentContainer: {
|
|
28
|
+
backgroundColor: (customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.backgroundColor) ?? ((customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.theme) === "dark" ? DARK_MODE_BACKGROUND_COLOR : LIGHT_MODE_BACKGROUND_COLOR),
|
|
29
|
+
justifyContent: "center",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
borderRadius: 20,
|
|
32
|
+
overflow: "hidden",
|
|
33
|
+
...customContentContainerStyle,
|
|
34
|
+
// disable setting padding here because it can affect
|
|
35
|
+
// the FlatList's ability to calculate its layout, which can
|
|
36
|
+
// stop snapToOffsets working properly
|
|
37
|
+
paddingHorizontal: 0,
|
|
38
|
+
paddingVertical: 0
|
|
39
|
+
},
|
|
40
|
+
buttonContainer: {
|
|
41
|
+
flexDirection: "row",
|
|
42
|
+
marginTop: 25,
|
|
43
|
+
marginBottom: 20,
|
|
44
|
+
...customButtonContainerStyle
|
|
45
|
+
},
|
|
46
|
+
button: {
|
|
47
|
+
marginHorizontal: 12,
|
|
48
|
+
paddingVertical: 10,
|
|
49
|
+
paddingHorizontal: 20,
|
|
50
|
+
borderWidth: 1,
|
|
51
|
+
borderRadius: 10,
|
|
52
|
+
fontSize: 16,
|
|
53
|
+
overflow: "hidden",
|
|
54
|
+
...(customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.text),
|
|
55
|
+
...customButtonStyle
|
|
56
|
+
},
|
|
57
|
+
cancelButton: {
|
|
58
|
+
borderColor: "gray",
|
|
59
|
+
color: (customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.theme) === "dark" ? DARK_MODE_TEXT_COLOR : "gray",
|
|
60
|
+
backgroundColor: (customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.theme) === "dark" ? "gray" : undefined,
|
|
61
|
+
...(customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.text),
|
|
62
|
+
...customCancelButtonStyle
|
|
63
|
+
},
|
|
64
|
+
confirmButton: {
|
|
65
|
+
borderColor: "green",
|
|
66
|
+
color: (customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.theme) === "dark" ? DARK_MODE_TEXT_COLOR : "green",
|
|
67
|
+
backgroundColor: (customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.theme) === "dark" ? "green" : undefined,
|
|
68
|
+
...(customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.text),
|
|
69
|
+
...customConfirmButtonStyle
|
|
70
|
+
},
|
|
71
|
+
modalTitle: {
|
|
72
|
+
fontSize: 24,
|
|
73
|
+
fontWeight: "600",
|
|
74
|
+
marginTop: 20,
|
|
75
|
+
marginBottom: 15,
|
|
76
|
+
color: (customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.theme) === "dark" ? DARK_MODE_TEXT_COLOR : LIGHT_MODE_TEXT_COLOR,
|
|
77
|
+
...(customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.text),
|
|
78
|
+
...customModalTitleStyle
|
|
79
|
+
},
|
|
80
|
+
timerPickerStyles: {
|
|
81
|
+
...customTimerPickerStyles,
|
|
82
|
+
pickerContainer: {
|
|
83
|
+
// set padding here instead of on modal content container because it can affect
|
|
84
|
+
// the FlatList's ability to calculate its layout, which can
|
|
85
|
+
// stop snapToOffsets working properly
|
|
86
|
+
paddingHorizontal: 20,
|
|
87
|
+
paddingTop: !(variables !== null && variables !== void 0 && variables.hasModalTitle) ? 20 : 0,
|
|
88
|
+
...((customTimerPickerStyles === null || customTimerPickerStyles === void 0 ? void 0 : customTimerPickerStyles.pickerContainer) ?? {})
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
60
93
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","DARK_MODE_BACKGROUND_COLOR","DARK_MODE_TEXT_COLOR","LIGHT_MODE_BACKGROUND_COLOR","LIGHT_MODE_TEXT_COLOR","generateStyles","customStyles","
|
|
1
|
+
{"version":3,"names":["StyleSheet","DARK_MODE_BACKGROUND_COLOR","DARK_MODE_TEXT_COLOR","LIGHT_MODE_BACKGROUND_COLOR","LIGHT_MODE_TEXT_COLOR","generateStyles","customStyles","variables","button","customButtonStyle","buttonContainer","customButtonContainerStyle","cancelButton","customCancelButtonStyle","confirmButton","customConfirmButtonStyle","container","customContainerStyle","contentContainer","customContentContainerStyle","modalTitle","customModalTitleStyle","customTimerPickerStyles","create","justifyContent","overflow","alignItems","undefined","backgroundColor","theme","borderRadius","paddingHorizontal","paddingVertical","flexDirection","marginTop","marginBottom","marginHorizontal","borderWidth","fontSize","text","borderColor","color","fontWeight","timerPickerStyles","pickerContainer","paddingTop","hasModalTitle"],"sources":["styles.ts"],"sourcesContent":["import { StyleSheet } from \"react-native\";\nimport type { TextStyle, ViewStyle } from \"react-native\";\n\nimport type { CustomTimerPickerStyles } from \"../TimerPicker/styles\";\n\nexport interface CustomTimerPickerModalStyles extends CustomTimerPickerStyles {\n button?: TextStyle;\n buttonContainer?: ViewStyle;\n cancelButton?: TextStyle;\n confirmButton?: TextStyle;\n container?: ViewStyle;\n contentContainer?: ViewStyle;\n modalTitle?: TextStyle;\n}\n\nconst DARK_MODE_BACKGROUND_COLOR = \"#232323\";\nconst DARK_MODE_TEXT_COLOR = \"#E9E9E9\";\nconst LIGHT_MODE_BACKGROUND_COLOR = \"#F1F1F1\";\nconst LIGHT_MODE_TEXT_COLOR = \"#1B1B1B\";\n\nexport const generateStyles = (\n customStyles: CustomTimerPickerModalStyles | undefined,\n variables?: {\n hasModalTitle: boolean;\n }\n) => {\n const {\n button: customButtonStyle,\n buttonContainer: customButtonContainerStyle,\n cancelButton: customCancelButtonStyle,\n confirmButton: customConfirmButtonStyle,\n container: customContainerStyle,\n contentContainer: customContentContainerStyle,\n modalTitle: customModalTitleStyle,\n ...customTimerPickerStyles\n } = customStyles ?? {};\n\n return StyleSheet.create({\n container: {\n justifyContent: \"center\",\n overflow: \"hidden\",\n ...customContainerStyle,\n // disable setting alignItems here because it can affect\n // the FlatList's ability to calculate its layout, which can\n // stop snapToOffsets working properly\n alignItems: undefined,\n },\n contentContainer: {\n backgroundColor:\n customTimerPickerStyles?.backgroundColor ??\n (customTimerPickerStyles?.theme === \"dark\"\n ? DARK_MODE_BACKGROUND_COLOR\n : LIGHT_MODE_BACKGROUND_COLOR),\n justifyContent: \"center\",\n alignItems: \"center\",\n borderRadius: 20,\n overflow: \"hidden\",\n ...customContentContainerStyle,\n // disable setting padding here because it can affect\n // the FlatList's ability to calculate its layout, which can\n // stop snapToOffsets working properly\n paddingHorizontal: 0,\n paddingVertical: 0,\n },\n buttonContainer: {\n flexDirection: \"row\",\n marginTop: 25,\n marginBottom: 20,\n ...customButtonContainerStyle,\n },\n button: {\n marginHorizontal: 12,\n paddingVertical: 10,\n paddingHorizontal: 20,\n borderWidth: 1,\n borderRadius: 10,\n fontSize: 16,\n overflow: \"hidden\",\n ...customTimerPickerStyles?.text,\n ...customButtonStyle,\n },\n cancelButton: {\n borderColor: \"gray\",\n color:\n customTimerPickerStyles?.theme === \"dark\"\n ? DARK_MODE_TEXT_COLOR\n : \"gray\",\n backgroundColor:\n customTimerPickerStyles?.theme === \"dark\" ? \"gray\" : undefined,\n ...customTimerPickerStyles?.text,\n ...customCancelButtonStyle,\n },\n confirmButton: {\n borderColor: \"green\",\n color:\n customTimerPickerStyles?.theme === \"dark\"\n ? DARK_MODE_TEXT_COLOR\n : \"green\",\n backgroundColor:\n customTimerPickerStyles?.theme === \"dark\" ? \"green\" : undefined,\n ...customTimerPickerStyles?.text,\n ...customConfirmButtonStyle,\n },\n modalTitle: {\n fontSize: 24,\n fontWeight: \"600\",\n marginTop: 20,\n marginBottom: 15,\n color:\n customTimerPickerStyles?.theme === \"dark\"\n ? DARK_MODE_TEXT_COLOR\n : LIGHT_MODE_TEXT_COLOR,\n ...customTimerPickerStyles?.text,\n ...customModalTitleStyle,\n },\n timerPickerStyles: {\n ...customTimerPickerStyles,\n pickerContainer: {\n // set padding here instead of on modal content container because it can affect\n // the FlatList's ability to calculate its layout, which can\n // stop snapToOffsets working properly\n paddingHorizontal: 20,\n paddingTop: !variables?.hasModalTitle ? 20 : 0,\n ...(customTimerPickerStyles?.pickerContainer ?? {}),\n },\n },\n });\n};\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AAezC,MAAMC,0BAA0B,GAAG,SAAS;AAC5C,MAAMC,oBAAoB,GAAG,SAAS;AACtC,MAAMC,2BAA2B,GAAG,SAAS;AAC7C,MAAMC,qBAAqB,GAAG,SAAS;AAEvC,OAA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AAC;IACDsB,iBAAiB,EAAE;MACf,GAAGrB,uBAAuB;MAC1BsB,eAAe,EAAE;QACb;QACA;QACA;QACAb,iBAAiB,EAAE,EAAE;QACrBc,UAAU,EAAE,EAACtC,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEuC,aAAa,IAAG,EAAE,GAAG,CAAC;QAC9C,IAAI,CAAAxB,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAEsB,eAAe,KAAI,CAAC,CAAC;MACtD;IACJ;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const getSafeInitialValue = initialValue => ({
|
|
2
|
+
hours: typeof (initialValue === null || initialValue === void 0 ? void 0 : initialValue.hours) === "number" && !isNaN(initialValue === null || initialValue === void 0 ? void 0 : initialValue.hours) ? initialValue.hours : 0,
|
|
3
|
+
minutes: typeof (initialValue === null || initialValue === void 0 ? void 0 : initialValue.minutes) === "number" && !isNaN(initialValue === null || initialValue === void 0 ? void 0 : initialValue.minutes) ? initialValue.minutes : 0,
|
|
4
|
+
seconds: typeof (initialValue === null || initialValue === void 0 ? void 0 : initialValue.seconds) === "number" && !isNaN(initialValue === null || initialValue === void 0 ? void 0 : initialValue.seconds) ? initialValue.seconds : 0
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=getSafeInitialValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getSafeInitialValue","initialValue","hours","isNaN","minutes","seconds"],"sources":["getSafeInitialValue.ts"],"sourcesContent":["export const getSafeInitialValue = (\n initialValue:\n | {\n hours?: number;\n minutes?: number;\n seconds?: number;\n }\n | undefined\n) => ({\n hours:\n typeof initialValue?.hours === \"number\" && !isNaN(initialValue?.hours)\n ? initialValue.hours\n : 0,\n minutes:\n typeof initialValue?.minutes === \"number\" &&\n !isNaN(initialValue?.minutes)\n ? initialValue.minutes\n : 0,\n seconds:\n typeof initialValue?.seconds === \"number\" &&\n !isNaN(initialValue?.seconds)\n ? initialValue.seconds\n : 0,\n});\n"],"mappings":"AAAA,OAAO,MAAMA,mBAAmB,GAC5BC,YAMe,KACb;EACFC,KAAK,EACD,QAAOD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEC,KAAK,MAAK,QAAQ,IAAI,CAACC,KAAK,CAACF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEC,KAAK,CAAC,GAChED,YAAY,CAACC,KAAK,GAClB,CAAC;EACXE,OAAO,EACH,QAAOH,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,OAAO,MAAK,QAAQ,IACzC,CAACD,KAAK,CAACF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,OAAO,CAAC,GACvBH,YAAY,CAACG,OAAO,GACpB,CAAC;EACXC,OAAO,EACH,QAAOJ,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEI,OAAO,MAAK,QAAQ,IACzC,CAACF,KAAK,CAACF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEI,OAAO,CAAC,GACvBJ,YAAY,CAACI,OAAO,GACpB;AACd,CAAC,CAAC","ignoreList":[]}
|
|
@@ -9,8 +9,11 @@ export interface CustomTimerPickerModalStyles extends CustomTimerPickerStyles {
|
|
|
9
9
|
contentContainer?: ViewStyle;
|
|
10
10
|
modalTitle?: TextStyle;
|
|
11
11
|
}
|
|
12
|
-
export declare const generateStyles: (customStyles: CustomTimerPickerModalStyles | undefined
|
|
12
|
+
export declare const generateStyles: (customStyles: CustomTimerPickerModalStyles | undefined, variables?: {
|
|
13
|
+
hasModalTitle: boolean;
|
|
14
|
+
}) => {
|
|
13
15
|
container: {
|
|
16
|
+
alignItems: undefined;
|
|
14
17
|
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
15
18
|
backgroundColor?: import("react-native").ColorValue | undefined;
|
|
16
19
|
borderBottomColor?: import("react-native").ColorValue | undefined;
|
|
@@ -39,7 +42,6 @@ export declare const generateStyles: (customStyles: CustomTimerPickerModalStyles
|
|
|
39
42
|
testID?: string | undefined;
|
|
40
43
|
elevation?: number | undefined;
|
|
41
44
|
alignContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "stretch" | undefined;
|
|
42
|
-
alignItems: import("react-native").FlexAlignType;
|
|
43
45
|
alignSelf?: import("react-native").FlexAlignType | "auto" | undefined;
|
|
44
46
|
aspectRatio?: number | undefined;
|
|
45
47
|
borderEndWidth?: string | number | undefined;
|
|
@@ -102,6 +104,8 @@ export declare const generateStyles: (customStyles: CustomTimerPickerModalStyles
|
|
|
102
104
|
translateY?: number | undefined;
|
|
103
105
|
};
|
|
104
106
|
contentContainer: {
|
|
107
|
+
paddingHorizontal: number;
|
|
108
|
+
paddingVertical: number;
|
|
105
109
|
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
106
110
|
backgroundColor: import("react-native").ColorValue;
|
|
107
111
|
borderBottomColor?: import("react-native").ColorValue | undefined;
|
|
@@ -160,16 +164,14 @@ export declare const generateStyles: (customStyles: CustomTimerPickerModalStyles
|
|
|
160
164
|
maxWidth?: string | number | undefined;
|
|
161
165
|
minHeight?: string | number | undefined;
|
|
162
166
|
minWidth?: string | number | undefined;
|
|
163
|
-
overflow
|
|
164
|
-
padding
|
|
167
|
+
overflow: "visible" | "hidden" | "scroll";
|
|
168
|
+
padding?: string | number | undefined;
|
|
165
169
|
paddingBottom?: string | number | undefined;
|
|
166
170
|
paddingEnd?: string | number | undefined;
|
|
167
|
-
paddingHorizontal?: string | number | undefined;
|
|
168
171
|
paddingLeft?: string | number | undefined;
|
|
169
172
|
paddingRight?: string | number | undefined;
|
|
170
173
|
paddingStart?: string | number | undefined;
|
|
171
174
|
paddingTop?: string | number | undefined;
|
|
172
|
-
paddingVertical?: string | number | undefined;
|
|
173
175
|
position?: "absolute" | "relative" | undefined;
|
|
174
176
|
right?: string | number | undefined;
|
|
175
177
|
start?: string | number | undefined;
|
|
@@ -239,7 +241,7 @@ export declare const generateStyles: (customStyles: CustomTimerPickerModalStyles
|
|
|
239
241
|
justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
240
242
|
left?: string | number | undefined;
|
|
241
243
|
margin?: string | number | undefined;
|
|
242
|
-
marginBottom
|
|
244
|
+
marginBottom: string | number;
|
|
243
245
|
marginEnd?: string | number | undefined;
|
|
244
246
|
marginHorizontal?: string | number | undefined;
|
|
245
247
|
marginLeft?: string | number | undefined;
|
|
@@ -695,7 +697,7 @@ export declare const generateStyles: (customStyles: CustomTimerPickerModalStyles
|
|
|
695
697
|
marginLeft?: string | number | undefined;
|
|
696
698
|
marginRight?: string | number | undefined;
|
|
697
699
|
marginStart?: string | number | undefined;
|
|
698
|
-
marginTop
|
|
700
|
+
marginTop: string | number;
|
|
699
701
|
marginVertical?: string | number | undefined;
|
|
700
702
|
maxHeight?: string | number | undefined;
|
|
701
703
|
maxWidth?: string | number | undefined;
|
|
@@ -735,4 +737,111 @@ export declare const generateStyles: (customStyles: CustomTimerPickerModalStyles
|
|
|
735
737
|
textAlignVertical?: "center" | "auto" | "bottom" | "top" | undefined;
|
|
736
738
|
includeFontPadding?: boolean | undefined;
|
|
737
739
|
};
|
|
740
|
+
timerPickerStyles: {
|
|
741
|
+
pickerContainer: {
|
|
742
|
+
backfaceVisibility?: "visible" | "hidden" | undefined;
|
|
743
|
+
backgroundColor?: string | undefined;
|
|
744
|
+
borderBottomColor?: import("react-native").ColorValue | undefined;
|
|
745
|
+
borderBottomEndRadius?: number | undefined;
|
|
746
|
+
borderBottomLeftRadius?: number | undefined;
|
|
747
|
+
borderBottomRightRadius?: number | undefined;
|
|
748
|
+
borderBottomStartRadius?: number | undefined;
|
|
749
|
+
borderBottomWidth?: number | undefined;
|
|
750
|
+
borderColor?: import("react-native").ColorValue | undefined;
|
|
751
|
+
borderEndColor?: import("react-native").ColorValue | undefined;
|
|
752
|
+
borderLeftColor?: import("react-native").ColorValue | undefined;
|
|
753
|
+
borderLeftWidth?: number | undefined;
|
|
754
|
+
borderRadius?: number | undefined;
|
|
755
|
+
borderRightColor?: import("react-native").ColorValue | undefined;
|
|
756
|
+
borderRightWidth?: number | undefined;
|
|
757
|
+
borderStartColor?: import("react-native").ColorValue | undefined;
|
|
758
|
+
borderStyle?: "solid" | "dotted" | "dashed" | undefined;
|
|
759
|
+
borderTopColor?: import("react-native").ColorValue | undefined;
|
|
760
|
+
borderTopEndRadius?: number | undefined;
|
|
761
|
+
borderTopLeftRadius?: number | undefined;
|
|
762
|
+
borderTopRightRadius?: number | undefined;
|
|
763
|
+
borderTopStartRadius?: number | undefined;
|
|
764
|
+
borderTopWidth?: number | undefined;
|
|
765
|
+
borderWidth?: number | undefined;
|
|
766
|
+
opacity?: number | undefined;
|
|
767
|
+
testID?: string | undefined;
|
|
768
|
+
elevation?: number | undefined;
|
|
769
|
+
alignContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "stretch" | undefined;
|
|
770
|
+
alignItems?: import("react-native").FlexAlignType | undefined;
|
|
771
|
+
alignSelf?: import("react-native").FlexAlignType | "auto" | undefined;
|
|
772
|
+
aspectRatio?: number | undefined;
|
|
773
|
+
borderEndWidth?: string | number | undefined;
|
|
774
|
+
borderStartWidth?: string | number | undefined;
|
|
775
|
+
bottom?: string | number | undefined;
|
|
776
|
+
display?: "none" | "flex" | undefined;
|
|
777
|
+
end?: string | number | undefined;
|
|
778
|
+
flex?: number | undefined;
|
|
779
|
+
flexBasis?: string | number | undefined;
|
|
780
|
+
flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
|
|
781
|
+
flexGrow?: number | undefined;
|
|
782
|
+
flexShrink?: number | undefined;
|
|
783
|
+
flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
|
|
784
|
+
height?: string | number | undefined;
|
|
785
|
+
justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
786
|
+
left?: string | number | undefined;
|
|
787
|
+
margin?: string | number | undefined;
|
|
788
|
+
marginBottom?: string | number | undefined;
|
|
789
|
+
marginEnd?: string | number | undefined;
|
|
790
|
+
marginHorizontal?: string | number | undefined;
|
|
791
|
+
marginLeft?: string | number | undefined;
|
|
792
|
+
marginRight?: string | number | undefined;
|
|
793
|
+
marginStart?: string | number | undefined;
|
|
794
|
+
marginTop?: string | number | undefined;
|
|
795
|
+
marginVertical?: string | number | undefined;
|
|
796
|
+
maxHeight?: string | number | undefined;
|
|
797
|
+
maxWidth?: string | number | undefined;
|
|
798
|
+
minHeight?: string | number | undefined;
|
|
799
|
+
minWidth?: string | number | undefined;
|
|
800
|
+
overflow?: "visible" | "hidden" | "scroll" | undefined;
|
|
801
|
+
padding?: string | number | undefined;
|
|
802
|
+
paddingBottom?: string | number | undefined;
|
|
803
|
+
paddingEnd?: string | number | undefined;
|
|
804
|
+
paddingHorizontal: string | number;
|
|
805
|
+
paddingLeft?: string | number | undefined;
|
|
806
|
+
paddingRight?: string | number | undefined;
|
|
807
|
+
paddingStart?: string | number | undefined;
|
|
808
|
+
paddingTop: string | number;
|
|
809
|
+
paddingVertical?: string | number | undefined;
|
|
810
|
+
position?: "absolute" | "relative" | undefined;
|
|
811
|
+
right?: string | number | undefined;
|
|
812
|
+
start?: string | number | undefined;
|
|
813
|
+
top?: string | number | undefined;
|
|
814
|
+
width?: string | number | undefined;
|
|
815
|
+
zIndex?: number | undefined;
|
|
816
|
+
direction?: "inherit" | "ltr" | "rtl" | undefined;
|
|
817
|
+
shadowColor?: import("react-native").ColorValue | undefined;
|
|
818
|
+
shadowOffset?: {
|
|
819
|
+
width: number;
|
|
820
|
+
height: number;
|
|
821
|
+
} | undefined;
|
|
822
|
+
shadowOpacity?: number | undefined;
|
|
823
|
+
shadowRadius?: number | undefined;
|
|
824
|
+
transform?: (import("react-native").PerpectiveTransform | import("react-native").RotateTransform | import("react-native").RotateXTransform | import("react-native").RotateYTransform | import("react-native").RotateZTransform | import("react-native").ScaleTransform | import("react-native").ScaleXTransform | import("react-native").ScaleYTransform | import("react-native").TranslateXTransform | import("react-native").TranslateYTransform | import("react-native").SkewXTransform | import("react-native").SkewYTransform | import("react-native").MatrixTransform)[] | undefined;
|
|
825
|
+
transformMatrix?: number[] | undefined;
|
|
826
|
+
rotation?: number | undefined;
|
|
827
|
+
scaleX?: number | undefined;
|
|
828
|
+
scaleY?: number | undefined;
|
|
829
|
+
translateX?: number | undefined;
|
|
830
|
+
translateY?: number | undefined;
|
|
831
|
+
};
|
|
832
|
+
backgroundColor?: string | undefined;
|
|
833
|
+
disabledPickerContainer?: ViewStyle | undefined;
|
|
834
|
+
disabledPickerItem?: TextStyle | undefined;
|
|
835
|
+
pickerAmPmContainer?: ViewStyle | undefined;
|
|
836
|
+
pickerAmPmLabel?: TextStyle | undefined;
|
|
837
|
+
pickerGradientOverlay?: ViewStyle | undefined;
|
|
838
|
+
pickerItem?: TextStyle | undefined;
|
|
839
|
+
pickerItemContainer?: (ViewStyle & {
|
|
840
|
+
height?: number | undefined;
|
|
841
|
+
}) | undefined;
|
|
842
|
+
pickerLabel?: TextStyle | undefined;
|
|
843
|
+
pickerLabelContainer?: ViewStyle | undefined;
|
|
844
|
+
text?: TextStyle | undefined;
|
|
845
|
+
theme?: "light" | "dark" | undefined;
|
|
846
|
+
};
|
|
738
847
|
};
|