react-native-timer-picker 1.2.4 → 1.2.6
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.
|
@@ -30,27 +30,15 @@ var react_native_1 = require("react-native");
|
|
|
30
30
|
var Modal_styles_1 = require("./Modal.styles");
|
|
31
31
|
var Modal = function (_a) {
|
|
32
32
|
var children = _a.children, onOverlayPress = _a.onOverlayPress, onHide = _a.onHide, _b = _a.isVisible, isVisible = _b === void 0 ? false : _b, _c = _a.animationDuration, animationDuration = _c === void 0 ? 300 : _c, _d = _a.overlayOpacity, overlayOpacity = _d === void 0 ? 0.4 : _d, modalProps = _a.modalProps, contentStyle = _a.contentStyle, overlayStyle = _a.overlayStyle, testID = _a.testID;
|
|
33
|
-
var _e = (0,
|
|
34
|
-
var _f = (0, react_1.useState)(react_native_1.Dimensions.get("window").width), screenWidth = _f[0], setScreenWidth = _f[1];
|
|
33
|
+
var _e = (0, react_native_1.useWindowDimensions)(), screenWidth = _e.width, screenHeight = _e.height;
|
|
35
34
|
var isMounted = (0, react_1.useRef)(false);
|
|
36
35
|
var animatedOpacity = (0, react_1.useRef)(new react_native_1.Animated.Value(0));
|
|
37
|
-
var handleDimensionsUpdate = function (dimensionsUpdate) {
|
|
38
|
-
var updatedScreenWidth = dimensionsUpdate.window.width;
|
|
39
|
-
var updateadScreenHeight = dimensionsUpdate.window.height;
|
|
40
|
-
if (updatedScreenWidth !== screenWidth ||
|
|
41
|
-
updateadScreenHeight !== screenHeight) {
|
|
42
|
-
setScreenHeight(updateadScreenHeight);
|
|
43
|
-
setScreenWidth(updatedScreenWidth);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
36
|
(0, react_1.useEffect)(function () {
|
|
47
37
|
isMounted.current = true;
|
|
48
38
|
if (isVisible) {
|
|
49
39
|
show();
|
|
50
40
|
}
|
|
51
|
-
var deviceEventEmitter = react_native_1.DeviceEventEmitter.addListener("didUpdateDimensions", handleDimensionsUpdate);
|
|
52
41
|
return function () {
|
|
53
|
-
deviceEventEmitter.remove();
|
|
54
42
|
isMounted.current = false;
|
|
55
43
|
};
|
|
56
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -177,12 +177,12 @@ var DurationScroll = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
177
177
|
height: styles.pickerItemContainer.height * numberOfItemsToShow,
|
|
178
178
|
overflow: "hidden",
|
|
179
179
|
}}>
|
|
180
|
-
<react_native_1.FlatList ref={flatListRef} data={data} getItemLayout={getItemLayout} initialScrollIndex={initialScrollIndex} windowSize={numberOfItemsToShow} renderItem={renderItem} keyExtractor={KEY_EXTRACTOR} showsVerticalScrollIndicator={false} decelerationRate=
|
|
180
|
+
<react_native_1.FlatList ref={flatListRef} data={data} getItemLayout={getItemLayout} initialScrollIndex={initialScrollIndex} windowSize={numberOfItemsToShow} renderItem={renderItem} keyExtractor={KEY_EXTRACTOR} showsVerticalScrollIndicator={false} decelerationRate={0.9} scrollEventThrottle={16} snapToAlignment="start"
|
|
181
181
|
// used in place of snapToOffset due to bug on Android
|
|
182
182
|
snapToOffsets={__spreadArray([], Array(data.length), true).map(function (_, i) { return i * styles.pickerItemContainer.height; })} viewabilityConfigCallbackPairs={!disableInfiniteScroll
|
|
183
183
|
? viewabilityConfigCallbackPairs === null || viewabilityConfigCallbackPairs === void 0 ? void 0 : viewabilityConfigCallbackPairs.current
|
|
184
184
|
: undefined} onMomentumScrollEnd={onMomentumScrollEnd} testID="duration-scroll-flatlist"/>
|
|
185
|
-
<react_native_1.View style={styles.pickerLabelContainer}>
|
|
185
|
+
<react_native_1.View style={styles.pickerLabelContainer} pointerEvents="none">
|
|
186
186
|
{typeof label === "string" ? (<react_native_1.Text style={styles.pickerLabel}>{label}</react_native_1.Text>) : (label !== null && label !== void 0 ? label : null)}
|
|
187
187
|
</react_native_1.View>
|
|
188
188
|
{LinearGradient ? (<>
|
|
@@ -193,7 +193,7 @@ var DurationScroll = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
193
193
|
.backgroundColor) !== null && _c !== void 0 ? _c : "white",
|
|
194
194
|
opacity: 0,
|
|
195
195
|
}),
|
|
196
|
-
]} start={{ x: 1, y: 0.3 }} end={{ x: 1, y: 1 }} {...pickerGradientOverlayProps} {...topPickerGradientOverlayProps} style={[styles.pickerGradientOverlay, { top: 0 }]}/>
|
|
196
|
+
]} start={{ x: 1, y: 0.3 }} end={{ x: 1, y: 1 }} pointerEvents="none" {...pickerGradientOverlayProps} {...topPickerGradientOverlayProps} style={[styles.pickerGradientOverlay, { top: 0 }]}/>
|
|
197
197
|
<LinearGradient colors={[
|
|
198
198
|
(0, colorToRgba_1.colorToRgba)({
|
|
199
199
|
color: (_d = styles.pickerContainer
|
|
@@ -201,7 +201,7 @@ var DurationScroll = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
201
201
|
opacity: 0,
|
|
202
202
|
}),
|
|
203
203
|
(_e = styles.pickerContainer.backgroundColor) !== null && _e !== void 0 ? _e : "white",
|
|
204
|
-
]} start={{ x: 1, y: 0 }} end={{ x: 1, y: 0.7 }} {...pickerGradientOverlayProps} {...bottomPickerGradientOverlayProps} style={[
|
|
204
|
+
]} start={{ x: 1, y: 0 }} end={{ x: 1, y: 0.7 }} pointerEvents="none" {...pickerGradientOverlayProps} {...bottomPickerGradientOverlayProps} style={[
|
|
205
205
|
styles.pickerGradientOverlay,
|
|
206
206
|
{ bottom: -1 },
|
|
207
207
|
]}/>
|
|
@@ -21,7 +21,7 @@ var LIGHT_MODE_TEXT_COLOR = "#1B1B1B";
|
|
|
21
21
|
var generateStyles = function (customStyles) {
|
|
22
22
|
var _a;
|
|
23
23
|
return react_native_1.StyleSheet.create({
|
|
24
|
-
container: __assign({
|
|
24
|
+
container: __assign({ justifyContent: "center", alignItems: "center" }, customStyles === null || customStyles === void 0 ? void 0 : customStyles.container),
|
|
25
25
|
contentContainer: __assign({ backgroundColor: ((_a = customStyles === null || customStyles === void 0 ? void 0 : customStyles.backgroundColor) !== null && _a !== void 0 ? _a : (customStyles === null || customStyles === void 0 ? void 0 : customStyles.theme) === "dark")
|
|
26
26
|
? DARK_MODE_BACKGROUND_COLOR
|
|
27
27
|
: LIGHT_MODE_BACKGROUND_COLOR, justifyContent: "center", alignItems: "center", borderRadius: 20, padding: 20 }, customStyles === null || customStyles === void 0 ? void 0 : customStyles.contentContainer),
|