@wavemaker/app-rn-runtime 11.14.1-32.647748 → 11.14.1-33.647787
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/components/advanced/carousel/carousel.component.js +1 -1
- package/components/advanced/carousel/carousel.component.js.map +1 -1
- package/components/advanced/webview/webview.component.js +1 -1
- package/components/advanced/webview/webview.component.js.map +1 -1
- package/components/basic/bottomsheet/bottomsheet.component.js +240 -33
- package/components/basic/bottomsheet/bottomsheet.component.js.map +1 -1
- package/components/basic/bottomsheet/bottomsheet.styles.js +0 -3
- package/components/basic/bottomsheet/bottomsheet.styles.js.map +1 -1
- package/components/basic/label/label.component.js +13 -24
- package/components/basic/label/label.component.js.map +1 -1
- package/components/basic/label/label.props.js +1 -0
- package/components/basic/label/label.props.js.map +1 -1
- package/components/basic/progress-circle/progress-circle.component.js +3 -3
- package/components/basic/progress-circle/progress-circle.component.js.map +1 -1
- package/components/chart/area-chart/area-chart.component.js +27 -10
- package/components/chart/area-chart/area-chart.component.js.map +1 -1
- package/components/chart/bar-chart/bar-chart.component.js +39 -7
- package/components/chart/bar-chart/bar-chart.component.js.map +1 -1
- package/components/chart/bar-chart/bar-chart.props.js +1 -0
- package/components/chart/bar-chart/bar-chart.props.js.map +1 -1
- package/components/chart/basechart.component.js +8 -15
- package/components/chart/basechart.component.js.map +1 -1
- package/components/chart/basechart.props.js +1 -0
- package/components/chart/basechart.props.js.map +1 -1
- package/components/chart/bubble-chart/bubble-chart.component.js +23 -6
- package/components/chart/bubble-chart/bubble-chart.component.js.map +1 -1
- package/components/chart/line-chart/line-chart.component.js +22 -5
- package/components/chart/line-chart/line-chart.component.js.map +1 -1
- package/components/chart/pie-chart/pie-chart.component.js +15 -4
- package/components/chart/pie-chart/pie-chart.component.js.map +1 -1
- package/components/chart/stack-chart/stack-chart.component.js +1 -1
- package/components/chart/stack-chart/stack-chart.component.js.map +1 -1
- package/components/container/accordion/accordionpane/accordionpane.component.js +6 -4
- package/components/container/accordion/accordionpane/accordionpane.component.js.map +1 -1
- package/components/container/container.component.js +207 -14
- package/components/container/container.component.js.map +1 -1
- package/components/container/container.props.js +6 -0
- package/components/container/container.props.js.map +1 -1
- package/components/container/linearlayout/linearlayoutitem/linearlayoutitem.component.js +32 -4
- package/components/container/linearlayout/linearlayoutitem/linearlayoutitem.component.js.map +1 -1
- package/components/container/linearlayout/linearlayoutitem/linearlayoutitem.props.js +1 -0
- package/components/container/linearlayout/linearlayoutitem/linearlayoutitem.props.js.map +1 -1
- package/components/container/panel/panel.component.js +1 -1
- package/components/container/panel/panel.component.js.map +1 -1
- package/components/container/tabs/tabpane/tabpane.component.js +1 -1
- package/components/container/tabs/tabpane/tabpane.component.js.map +1 -1
- package/components/container/tabs/tabs.component.js +62 -29
- package/components/container/tabs/tabs.component.js.map +1 -1
- package/components/container/tabs/tabs.props.js +1 -0
- package/components/container/tabs/tabs.props.js.map +1 -1
- package/components/container/wizard/wizard.component.js +3 -5
- package/components/container/wizard/wizard.component.js.map +1 -1
- package/components/container/wizard/wizard.props.js +0 -1
- package/components/container/wizard/wizard.props.js.map +1 -1
- package/components/container/wizard/wizard.styles.js +3 -1
- package/components/container/wizard/wizard.styles.js.map +1 -1
- package/components/container/wizard/wizardstep/wizardstep.component.js +4 -23
- package/components/container/wizard/wizardstep/wizardstep.component.js.map +1 -1
- package/components/container/wizard/wizardstep/wizardstep.props.js +0 -2
- package/components/container/wizard/wizardstep/wizardstep.props.js.map +1 -1
- package/components/data/form/form-field/form-field.component.js +26 -1
- package/components/data/form/form-field/form-field.component.js.map +1 -1
- package/components/data/form/form-field/form-field.props.js +3 -0
- package/components/data/form/form-field/form-field.props.js.map +1 -1
- package/components/data/form/form.component.js +11 -3
- package/components/data/form/form.component.js.map +1 -1
- package/components/data/form/form.props.js +1 -0
- package/components/data/form/form.props.js.map +1 -1
- package/components/data/list/list.component.js +6 -3
- package/components/data/list/list.component.js.map +1 -1
- package/components/dialogs/dialog/dialog.component.js +1 -1
- package/components/dialogs/dialog/dialog.component.js.map +1 -1
- package/components/dialogs/dialogcontent/dialogcontent.component.js +1 -2
- package/components/dialogs/dialogcontent/dialogcontent.component.js.map +1 -1
- package/components/input/baseinput/baseinput.component.js +30 -3
- package/components/input/baseinput/baseinput.component.js.map +1 -1
- package/components/input/baseinput/baseinput.props.js +1 -0
- package/components/input/baseinput/baseinput.props.js.map +1 -1
- package/components/input/basenumber/basenumber.component.js +18 -3
- package/components/input/basenumber/basenumber.component.js.map +1 -1
- package/components/input/basenumber/basenumber.props.js +2 -0
- package/components/input/basenumber/basenumber.props.js.map +1 -1
- package/components/input/calendar/calendar.component.js +5 -1
- package/components/input/calendar/calendar.component.js.map +1 -1
- package/components/input/calendar/views/month-view.js +8 -1
- package/components/input/calendar/views/month-view.js.map +1 -1
- package/components/input/checkboxset/checkboxset.component.js +2 -2
- package/components/input/checkboxset/checkboxset.component.js.map +1 -1
- package/components/input/currency/currency.component.js +2 -0
- package/components/input/currency/currency.component.js.map +1 -1
- package/components/input/currency/currency.styles.js +10 -1
- package/components/input/currency/currency.styles.js.map +1 -1
- package/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js +6 -1
- package/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js.map +1 -1
- package/components/input/epoch/wheelpickermodal/time/time-picker-modal.component.js +6 -1
- package/components/input/epoch/wheelpickermodal/time/time-picker-modal.component.js.map +1 -1
- package/components/input/number/number.component.js +2 -0
- package/components/input/number/number.component.js.map +1 -1
- package/components/input/number/number.styles.js +4 -0
- package/components/input/number/number.styles.js.map +1 -1
- package/components/input/radioset/radioset.component.js +4 -6
- package/components/input/radioset/radioset.component.js.map +1 -1
- package/components/input/text/text.component.js +13 -2
- package/components/input/text/text.component.js.map +1 -1
- package/components/input/text/text.props.js +1 -1
- package/components/input/text/text.props.js.map +1 -1
- package/components/input/text/text.styles.js +17 -0
- package/components/input/text/text.styles.js.map +1 -1
- package/components/input/textarea/textarea.component.js +3 -2
- package/components/input/textarea/textarea.component.js.map +1 -1
- package/components/input/textarea/textarea.styles.js +4 -0
- package/components/input/textarea/textarea.styles.js.map +1 -1
- package/components/page/left-panel/left-panel.component.js +1 -1
- package/components/page/left-panel/left-panel.component.js.map +1 -1
- package/components/page/page-content/page-content.component.js +157 -17
- package/components/page/page-content/page-content.component.js.map +1 -1
- package/components/page/page-content/page-content.props.js +4 -0
- package/components/page/page-content/page-content.props.js.map +1 -1
- package/components/page/page-content/pull-to-refresh.component.js +288 -0
- package/components/page/page-content/pull-to-refresh.component.js.map +1 -0
- package/core/AppConfig.js.map +1 -1
- package/core/base.component.js +37 -5
- package/core/base.component.js.map +1 -1
- package/core/components/error-fallback/error-fallback.component.js +18 -50
- package/core/components/error-fallback/error-fallback.component.js.map +1 -1
- package/core/components/error-fallback/error-fallback.styles.js +1 -4
- package/core/components/error-fallback/error-fallback.styles.js.map +1 -1
- package/core/components/textinput.component.js +27 -8
- package/core/components/textinput.component.js.map +1 -1
- package/core/environment.js +25 -0
- package/core/environment.js.map +1 -0
- package/core/error-boundary.component.js +2 -46
- package/core/error-boundary.component.js.map +1 -1
- package/core/fixed-view.component.js +19 -2
- package/core/fixed-view.component.js.map +1 -1
- package/core/sticky-wrapper.js +37 -34
- package/core/sticky-wrapper.js.map +1 -1
- package/core/tappable.component.js +110 -16
- package/core/tappable.component.js.map +1 -1
- package/core/viewport.js +13 -8
- package/core/viewport.js.map +1 -1
- package/gestures/carousel-swipe.animation.js +1 -1
- package/gestures/carousel-swipe.animation.js.map +1 -1
- package/npm-shrinkwrap.json +383 -219
- package/package-lock.json +383 -219
- package/package.json +5 -6
- package/runtime/App.js +31 -181
- package/runtime/App.js.map +1 -1
- package/runtime/App.navigator.js +1 -4
- package/runtime/App.navigator.js.map +1 -1
- package/runtime/base-fragment.component.js +29 -5
- package/runtime/base-fragment.component.js.map +1 -1
- package/runtime/base-page.component.js +4 -12
- package/runtime/base-page.component.js.map +1 -1
- package/runtime/navigator/drawer.navigator.js +2 -0
- package/runtime/navigator/drawer.navigator.js.map +1 -1
- package/runtime/navigator/stack.navigator.js +17 -2
- package/runtime/navigator/stack.navigator.js.map +1 -1
- package/runtime/services/app-security.service.js +19 -40
- package/runtime/services/app-security.service.js.map +1 -1
- package/runtime/services/device/scan-service.js +12 -34
- package/runtime/services/device/scan-service.js.map +1 -1
- package/runtime/services/webprocess.service.js +3 -8
- package/runtime/services/webprocess.service.js.map +1 -1
- package/styles/background.component.js +61 -2
- package/styles/background.component.js.map +1 -1
- package/styles/style-prop.validator.js +4 -0
- package/styles/style-prop.validator.js.map +1 -1
- package/styles/style-props.js +2 -0
- package/styles/style-props.js.map +1 -1
- package/styles/theme.js +27 -2
- package/styles/theme.js.map +1 -1
- package/styles/theme.variables.js +2 -0
- package/styles/theme.variables.js.map +1 -1
- package/core/advanced-promise-rejection-tracker.js +0 -207
- package/core/advanced-promise-rejection-tracker.js.map +0 -1
- package/core/global-error-handler.service.js +0 -177
- package/core/global-error-handler.service.js.map +0 -1
- package/runtime/services/browser.constants.js +0 -3
- package/runtime/services/browser.constants.js.map +0 -1
- package/runtime/services/browser.service.js +0 -321
- package/runtime/services/browser.service.js.map +0 -1
- package/runtime/services/external-auth-callback.service.js +0 -44
- package/runtime/services/external-auth-callback.service.js.map +0 -1
|
@@ -5,14 +5,45 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
5
5
|
import React, { createRef } from 'react';
|
|
6
6
|
import { BaseComponent, BaseComponentState } from '@wavemaker/app-rn-runtime/core/base.component';
|
|
7
7
|
import { View, PanResponder, Dimensions, TouchableWithoutFeedback, Platform, StatusBar, BackHandler, KeyboardAvoidingView, Keyboard, Modal, Pressable } from 'react-native';
|
|
8
|
-
import { ScrollView } from 'react-native-gesture-handler';
|
|
8
|
+
import { Gesture, GestureDetector, GestureHandlerRootView, ScrollView } from 'react-native-gesture-handler';
|
|
9
9
|
import Animated, { useAnimatedStyle, withTiming, runOnJS, Easing, makeMutable, cancelAnimation } from 'react-native-reanimated';
|
|
10
|
+
import * as Animatable from 'react-native-animatable';
|
|
10
11
|
import WmBottomsheetProps from './bottomsheet.props';
|
|
11
12
|
import { DEFAULT_CLASS } from './bottomsheet.styles';
|
|
12
13
|
import { createSkeleton } from '../skeleton/skeleton.component';
|
|
13
14
|
import { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker/app-rn-runtime/core/accessibility';
|
|
14
15
|
import { ModalProvider } from '@wavemaker/app-rn-runtime/core/modal.service';
|
|
15
|
-
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
16
|
+
import { SafeAreaInsetsContext, SafeAreaView } from 'react-native-safe-area-context';
|
|
17
|
+
|
|
18
|
+
// Web-only: Runs all bottom sheet animations on the JS thread (sets useNativeDriver to false)
|
|
19
|
+
// Prevents errors on web where native driver animations are not supported
|
|
20
|
+
// Web - Animated api is used from animation
|
|
21
|
+
if (Platform.OS === 'web') {
|
|
22
|
+
try {
|
|
23
|
+
const RN = require('react-native');
|
|
24
|
+
const RNAnimated = RN && RN.Animated;
|
|
25
|
+
if (RNAnimated && !RNAnimated.__wmPatchedNoNativeDriver) {
|
|
26
|
+
const wrap = name => {
|
|
27
|
+
const original = RNAnimated[name];
|
|
28
|
+
if (typeof original === 'function') {
|
|
29
|
+
RNAnimated[name] = (value, config) => {
|
|
30
|
+
const patched = {
|
|
31
|
+
...(config || {}),
|
|
32
|
+
useNativeDriver: false
|
|
33
|
+
};
|
|
34
|
+
return original(value, patched);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
wrap('timing');
|
|
39
|
+
wrap('spring');
|
|
40
|
+
wrap('decay');
|
|
41
|
+
RNAnimated.__wmPatchedNoNativeDriver = true;
|
|
42
|
+
}
|
|
43
|
+
} catch (_) {
|
|
44
|
+
// noop
|
|
45
|
+
}
|
|
46
|
+
}
|
|
16
47
|
const {
|
|
17
48
|
height: SCREEN_HEIGHT
|
|
18
49
|
} = Dimensions.get('screen');
|
|
@@ -27,6 +58,8 @@ export class WmBottomsheetState extends BaseComponentState {
|
|
|
27
58
|
_defineProperty(this, "keyboardHeight", 0);
|
|
28
59
|
_defineProperty(this, "localModalsOpened", []);
|
|
29
60
|
_defineProperty(this, "lastGestureDy", 0);
|
|
61
|
+
_defineProperty(this, "contentAnimationId", 0);
|
|
62
|
+
_defineProperty(this, "contentAnimatableProps", undefined);
|
|
30
63
|
}
|
|
31
64
|
}
|
|
32
65
|
|
|
@@ -44,8 +77,32 @@ const AnimatedBottomsheetContent = ({
|
|
|
44
77
|
onBackdropPress,
|
|
45
78
|
onDragHandlePress,
|
|
46
79
|
getTestProps,
|
|
47
|
-
enabledragsettle
|
|
80
|
+
enabledragsettle,
|
|
81
|
+
scrollRef,
|
|
82
|
+
containerScrollRef,
|
|
83
|
+
configurePanGesture
|
|
48
84
|
}) => {
|
|
85
|
+
// Simple RNGH GestureDetector attached to the same view as the PanResponder (panHandlers).
|
|
86
|
+
// No thresholds/validation: logs translationY directly during pan.
|
|
87
|
+
const panGesture = React.useMemo(() => {
|
|
88
|
+
// Create base Pan gesture
|
|
89
|
+
const pan = Gesture.Pan().runOnJS(true);
|
|
90
|
+
|
|
91
|
+
// Add external gestures for ScrollViews (container widget scrollview)
|
|
92
|
+
if (scrollRef && containerScrollRef) {
|
|
93
|
+
pan.simultaneousWithExternalGesture(scrollRef, containerScrollRef);
|
|
94
|
+
} else if (scrollRef) {
|
|
95
|
+
pan.simultaneousWithExternalGesture(scrollRef);
|
|
96
|
+
} else if (containerScrollRef) {
|
|
97
|
+
pan.simultaneousWithExternalGesture(containerScrollRef);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Apply custom logic from parent BottomSheet class
|
|
101
|
+
if (configurePanGesture) {
|
|
102
|
+
configurePanGesture(pan);
|
|
103
|
+
}
|
|
104
|
+
return pan;
|
|
105
|
+
}, [scrollRef, containerScrollRef, configurePanGesture]);
|
|
49
106
|
const backdropAnimatedStyle = useAnimatedStyle(() => ({
|
|
50
107
|
opacity: backdropOpacity.value
|
|
51
108
|
}));
|
|
@@ -67,15 +124,18 @@ const AnimatedBottomsheetContent = ({
|
|
|
67
124
|
onPress: onBackdropPress
|
|
68
125
|
}, /*#__PURE__*/React.createElement(Animated.View, _extends({
|
|
69
126
|
style: [styles.backdrop, backdropAnimatedStyle]
|
|
70
|
-
}, getTestProps('backdrop'), getAccessibilityProps(AccessibilityWidgetType.BOTTOMSHEET, props)))), /*#__PURE__*/React.createElement(Animated.View,
|
|
127
|
+
}, getTestProps('backdrop'), getAccessibilityProps(AccessibilityWidgetType.BOTTOMSHEET, props)))), /*#__PURE__*/React.createElement(Animated.View, {
|
|
71
128
|
style: [styles.container, containerAnimatedStyle]
|
|
72
|
-
|
|
129
|
+
// {...panHandlers}
|
|
130
|
+
}, /*#__PURE__*/React.createElement(View, _extends({
|
|
73
131
|
style: styles.dragHandleContainer
|
|
74
132
|
}, dragHandlePanHandlers), /*#__PURE__*/React.createElement(Pressable, {
|
|
75
133
|
onPress: onDragHandlePress
|
|
76
134
|
}, /*#__PURE__*/React.createElement(View, _extends({
|
|
77
135
|
style: styles.dragIconHandle
|
|
78
|
-
}, getTestProps('draghandle'))))),
|
|
136
|
+
}, getTestProps('draghandle'))))), /*#__PURE__*/React.createElement(GestureDetector, {
|
|
137
|
+
gesture: panGesture
|
|
138
|
+
}, children(contentStyle))));
|
|
79
139
|
};
|
|
80
140
|
export default class WmBottomsheet extends BaseComponent {
|
|
81
141
|
// Helper method to calculate animation duration based on distance and velocity
|
|
@@ -116,6 +176,12 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
116
176
|
this.closeSheet();
|
|
117
177
|
}
|
|
118
178
|
}
|
|
179
|
+
animate(props) {
|
|
180
|
+
this.updateState({
|
|
181
|
+
contentAnimationId: Date.now(),
|
|
182
|
+
contentAnimatableProps: props
|
|
183
|
+
});
|
|
184
|
+
}
|
|
119
185
|
constructor(_props) {
|
|
120
186
|
super(_props, DEFAULT_CLASS, new WmBottomsheetProps(), new WmBottomsheetState());
|
|
121
187
|
_defineProperty(this, "calculatedHeight", void 0);
|
|
@@ -138,6 +204,9 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
138
204
|
_defineProperty(this, "isIosKeyboardHeightSet", false);
|
|
139
205
|
_defineProperty(this, "sheetModalService", void 0);
|
|
140
206
|
_defineProperty(this, "isDragHandleExpanding", false);
|
|
207
|
+
//container widget scrollview ref and y offset value
|
|
208
|
+
_defineProperty(this, "containerscrollViewRef", null);
|
|
209
|
+
_defineProperty(this, "containerscrollYoffset", 0);
|
|
141
210
|
// Reanimated shared values - created once and reused
|
|
142
211
|
_defineProperty(this, "translateY", void 0);
|
|
143
212
|
_defineProperty(this, "backdropOpacity", void 0);
|
|
@@ -292,6 +361,20 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
292
361
|
if (this.state.isExpanded || this.props.disableswipedownclose) {
|
|
293
362
|
if (gestureState.dy < this.expandedHeight / 4 || this.props.disableswipedownclose) {
|
|
294
363
|
var _this$sheetHeight;
|
|
364
|
+
//reseting bottom sheet scrollview offset value to fix scrollview automatic scroll issue while collpsing the bottom sheet
|
|
365
|
+
setTimeout(() => {
|
|
366
|
+
var _this$state$scrollVie;
|
|
367
|
+
if ((_this$state$scrollVie = this.state.scrollViewRef) !== null && _this$state$scrollVie !== void 0 && _this$state$scrollVie.current) {
|
|
368
|
+
this.state.scrollViewRef.current.scrollTo({
|
|
369
|
+
x: 0,
|
|
370
|
+
y: 0,
|
|
371
|
+
animated: false
|
|
372
|
+
});
|
|
373
|
+
this.updateState({
|
|
374
|
+
scrollOffset: 0
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}, this.animationDuration);
|
|
295
378
|
let sheetMinimumHeight = this.props.bottomsheetminimumheight || 0.1;
|
|
296
379
|
const targetHeight = this.props.disableswipedownclose ? sheetMinimumHeight * SCREEN_HEIGHT : this.calculatedHeight;
|
|
297
380
|
const currentHeight = ((_this$sheetHeight = this.sheetHeight) === null || _this$sheetHeight === void 0 ? void 0 : _this$sheetHeight.value) || this.expandedHeight;
|
|
@@ -333,13 +416,60 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
333
416
|
}
|
|
334
417
|
}
|
|
335
418
|
});
|
|
419
|
+
_defineProperty(this, "configurePanGesture", pan => {
|
|
420
|
+
pan.enabled(true).onUpdate(event => {
|
|
421
|
+
// ← Add : any
|
|
422
|
+
const gestureState = {
|
|
423
|
+
dy: event.translationY,
|
|
424
|
+
vy: event.velocityY,
|
|
425
|
+
moveX: event.x,
|
|
426
|
+
moveY: event.y,
|
|
427
|
+
vx: event.velocityX
|
|
428
|
+
};
|
|
429
|
+
if (gestureState.dy > 0 && this.translateY && this.lastGestureDyShared && this.state.scrollOffset <= 0 && this.containerscrollYoffset <= 0) {
|
|
430
|
+
const newTranslateY = Math.max(0, this.lastGestureDyShared.value + gestureState.dy);
|
|
431
|
+
this.translateY.value = newTranslateY;
|
|
432
|
+
// Reset expand flag if dragging down
|
|
433
|
+
this.isDragHandleExpanding = false;
|
|
434
|
+
} else if (gestureState.dy < 0 && this.props.expand && this.props.bottomsheetheightratio !== 1 && !this.isDragHandleExpanding && !this.state.isExpanded && this.props.disablescrollonrest) {
|
|
435
|
+
// Only trigger expand once with threshold of -50px upward drag
|
|
436
|
+
this.isDragHandleExpanding = true;
|
|
437
|
+
this.expandBottomSheet();
|
|
438
|
+
}
|
|
439
|
+
// ... rest of logic
|
|
440
|
+
}).onEnd(event => {
|
|
441
|
+
// ← Add : any
|
|
442
|
+
const gestureState = {
|
|
443
|
+
dy: event.translationY,
|
|
444
|
+
vy: event.velocityY,
|
|
445
|
+
moveX: event.x,
|
|
446
|
+
moveY: event.y,
|
|
447
|
+
vx: event.velocityX
|
|
448
|
+
};
|
|
449
|
+
if (gestureState.dy > 0 && this.state.scrollOffset <= 0 && this.containerscrollYoffset <= 0) {
|
|
450
|
+
this.handleSwipeGesture(gestureState);
|
|
451
|
+
}
|
|
452
|
+
}).onFinalize((event, success) => {
|
|
453
|
+
// ← Add types
|
|
454
|
+
if (!success) {
|
|
455
|
+
this.openSheet();
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
return pan;
|
|
459
|
+
});
|
|
336
460
|
// panResponder for bottom sheet scroll view
|
|
337
461
|
_defineProperty(this, "panResponder", PanResponder.create({
|
|
338
462
|
onStartShouldSetPanResponder: (_, gestureState) => {
|
|
463
|
+
if (this.props.disablescrollonrest && !this.state.isExpanded) {
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
339
466
|
// Only handle the gesture if we're at the top and swiping down
|
|
340
467
|
return gestureState.dy > 0 && this.state.scrollOffset <= 0;
|
|
341
468
|
},
|
|
342
469
|
onMoveShouldSetPanResponder: (_, gestureState) => {
|
|
470
|
+
if (this.props.disablescrollonrest && !this.state.isExpanded) {
|
|
471
|
+
return Math.abs(gestureState.dy) > 2;
|
|
472
|
+
}
|
|
343
473
|
// Only handle the gesture if we're at the top and swiping down
|
|
344
474
|
return gestureState.dy > 0 && this.state.scrollOffset <= 0;
|
|
345
475
|
},
|
|
@@ -353,6 +483,12 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
353
483
|
if (gestureState.dy > 0 && this.translateY && this.lastGestureDyShared) {
|
|
354
484
|
const newTranslateY = Math.max(0, this.lastGestureDyShared.value + gestureState.dy);
|
|
355
485
|
this.translateY.value = newTranslateY;
|
|
486
|
+
// Reset expand flag if dragging down
|
|
487
|
+
this.isDragHandleExpanding = false;
|
|
488
|
+
} else if (gestureState.dy < 0 && this.props.expand && this.props.bottomsheetheightratio !== 1 && !this.isDragHandleExpanding && !this.state.isExpanded) {
|
|
489
|
+
// Only trigger expand once with threshold of -50px upward drag
|
|
490
|
+
this.isDragHandleExpanding = true;
|
|
491
|
+
this.expandBottomSheet();
|
|
356
492
|
}
|
|
357
493
|
},
|
|
358
494
|
onPanResponderRelease: (_, gestureState) => {
|
|
@@ -441,8 +577,12 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
441
577
|
}
|
|
442
578
|
this.updateState({
|
|
443
579
|
isExpanded: false,
|
|
444
|
-
localModalsOpened: []
|
|
580
|
+
localModalsOpened: [],
|
|
581
|
+
scrollOffset: 0,
|
|
582
|
+
contentAnimationId: 0,
|
|
583
|
+
contentAnimatableProps: undefined
|
|
445
584
|
});
|
|
585
|
+
this.containerscrollYoffset = 0;
|
|
446
586
|
this.handleClose();
|
|
447
587
|
};
|
|
448
588
|
if (this.translateY && this.backdropOpacity) {
|
|
@@ -471,7 +611,9 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
471
611
|
lastGestureDy: 0,
|
|
472
612
|
isExpanded: false,
|
|
473
613
|
isBottomsheetVisible: false,
|
|
474
|
-
localModalsOpened: []
|
|
614
|
+
localModalsOpened: [],
|
|
615
|
+
contentAnimationId: 0,
|
|
616
|
+
contentAnimatableProps: undefined
|
|
475
617
|
});
|
|
476
618
|
requestAnimationFrame(() => {
|
|
477
619
|
if (this.sheetHeight) {
|
|
@@ -488,6 +630,14 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
488
630
|
_defineProperty(this, "handleDragHandlePress", () => {
|
|
489
631
|
this.invokeEventCallback('onDraghandleiconclick', [null, this]);
|
|
490
632
|
});
|
|
633
|
+
_defineProperty(this, "renderAnimatedSheetChildren", children => {
|
|
634
|
+
if (!this.state.contentAnimatableProps) {
|
|
635
|
+
return children;
|
|
636
|
+
}
|
|
637
|
+
return /*#__PURE__*/React.createElement(Animatable.View, _extends({
|
|
638
|
+
key: this.state.contentAnimationId
|
|
639
|
+
}, this.state.contentAnimatableProps), children);
|
|
640
|
+
});
|
|
491
641
|
_defineProperty(this, "renderContent", props => {
|
|
492
642
|
// Don't render if shared values aren't initialized yet
|
|
493
643
|
if (!this.translateY || !this.backdropOpacity || !this.sheetHeight || !this.lastGestureDyShared) {
|
|
@@ -501,14 +651,21 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
501
651
|
}) => {
|
|
502
652
|
// Store topInset for later use (avoid mutation during render)
|
|
503
653
|
const topInset = (insets === null || insets === void 0 ? void 0 : insets.top) || 0;
|
|
654
|
+
const bottomInset = (insets === null || insets === void 0 ? void 0 : insets.bottom) || 0;
|
|
504
655
|
// Update the instance variable outside of render cycle
|
|
505
656
|
if (this.topInset !== topInset) {
|
|
506
657
|
requestAnimationFrame(() => {
|
|
507
658
|
this.topInset = topInset;
|
|
508
659
|
});
|
|
509
660
|
}
|
|
661
|
+
const absoluteStyle = {
|
|
662
|
+
top: 0,
|
|
663
|
+
left: 0,
|
|
664
|
+
right: 0
|
|
665
|
+
};
|
|
666
|
+
const rootStyle = props.modal ? [this.styles.root, absoluteStyle] : this.styles.root;
|
|
510
667
|
return /*#__PURE__*/React.createElement(View, _extends({
|
|
511
|
-
style:
|
|
668
|
+
style: rootStyle
|
|
512
669
|
}, this.getTestProps('keyboardview')), this._background, /*#__PURE__*/React.createElement(AnimatedBottomsheetContent, {
|
|
513
670
|
translateY: this.translateY,
|
|
514
671
|
backdropOpacity: this.backdropOpacity,
|
|
@@ -521,8 +678,21 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
521
678
|
onBackdropPress: this.handleBackdropPress,
|
|
522
679
|
onDragHandlePress: this.handleDragHandlePress,
|
|
523
680
|
getTestProps: this.getTestProps.bind(this),
|
|
524
|
-
enabledragsettle: props.enabledragsettle
|
|
525
|
-
|
|
681
|
+
enabledragsettle: props.enabledragsettle,
|
|
682
|
+
scrollRef: this.state.scrollViewRef,
|
|
683
|
+
containerScrollRef: this.containerscrollViewRef,
|
|
684
|
+
configurePanGesture: this.configurePanGesture
|
|
685
|
+
}, contentStyle => props.issticky ? props.enablemodalsupport ? /*#__PURE__*/React.createElement(ModalProvider, {
|
|
686
|
+
value: this.sheetModalService
|
|
687
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
688
|
+
style: [contentStyle, this.styles.sheetContentContainer, {
|
|
689
|
+
overflow: 'hidden'
|
|
690
|
+
}]
|
|
691
|
+
}, props.children)) : /*#__PURE__*/React.createElement(Animated.View, {
|
|
692
|
+
style: [contentStyle, this.styles.sheetContentContainer, {
|
|
693
|
+
overflow: 'hidden'
|
|
694
|
+
}]
|
|
695
|
+
}, props.children) : /*#__PURE__*/React.createElement(ScrollView, _extends({
|
|
526
696
|
ref: this.state.scrollViewRef,
|
|
527
697
|
style: this.styles.sheetContentContainer,
|
|
528
698
|
contentContainerStyle: [this.styles.sheetScrollContent],
|
|
@@ -540,7 +710,9 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
540
710
|
style: contentStyle
|
|
541
711
|
}, props.children)) : /*#__PURE__*/React.createElement(Animated.View, {
|
|
542
712
|
style: contentStyle
|
|
543
|
-
}, props.children))),
|
|
713
|
+
}, props.children))), Platform.OS === 'android' && !this.props.modal && bottomInset > 40 && /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
714
|
+
edges: ['bottom']
|
|
715
|
+
}), props.enablemodalsupport && this.state.localModalsOpened && this.state.localModalsOpened.map((o, i) => /*#__PURE__*/React.createElement(View, {
|
|
544
716
|
key: (o.name || '') + i,
|
|
545
717
|
onStartShouldSetResponder: () => true,
|
|
546
718
|
onResponderEnd: () => o.isModal && this.sheetModalService.hideModal(o),
|
|
@@ -556,7 +728,18 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
556
728
|
});
|
|
557
729
|
});
|
|
558
730
|
this.calculatedHeight = this.calculateSheetHeight(_props.bottomsheetheightratio);
|
|
559
|
-
|
|
731
|
+
//container srollview ref
|
|
732
|
+
this.subscribe('containerScrollViewReady', ref => {
|
|
733
|
+
if (ref && ref.current && this.containerscrollViewRef !== ref) {
|
|
734
|
+
this.containerscrollViewRef = ref;
|
|
735
|
+
this.forceUpdate();
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
//container scrollview y offset value
|
|
739
|
+
this.subscribe('scroll', e => {
|
|
740
|
+
const offsetY = e.nativeEvent.contentOffset.y;
|
|
741
|
+
this.containerscrollYoffset = offsetY;
|
|
742
|
+
});
|
|
560
743
|
// Use bottomsheetexpandedheightratio if provided, otherwise use expandedDefaultHeight
|
|
561
744
|
const expandedRatio = _props.bottomsheetexpandedheightratio || this.expandedDefaultHeight;
|
|
562
745
|
const effectiveExpandedRatio = Math.max(this.minimumExpandedHeight, Math.min(expandedRatio, this.maxHeight));
|
|
@@ -681,27 +864,51 @@ export default class WmBottomsheet extends BaseComponent {
|
|
|
681
864
|
}
|
|
682
865
|
renderWidget(props) {
|
|
683
866
|
if (!this.state.isBottomsheetVisible) return null;
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
867
|
+
return /*#__PURE__*/React.createElement(SafeAreaInsetsContext.Consumer, null, (insets = {
|
|
868
|
+
top: 0,
|
|
869
|
+
bottom: 0,
|
|
870
|
+
left: 0,
|
|
871
|
+
right: 0
|
|
872
|
+
}) => {
|
|
873
|
+
// Use SafeAreaView on Android with button navigation to render the bottom sheet above the nav bar (when modal props is true)
|
|
874
|
+
// Button navigation is identified when bottom inset >= 40
|
|
875
|
+
const hasButtonNavigation = Platform.OS === 'android' && ((insets === null || insets === void 0 ? void 0 : insets.bottom) || 0) >= 40;
|
|
876
|
+
const wrapWithSafeArea = children => {
|
|
877
|
+
if (hasButtonNavigation) {
|
|
878
|
+
return /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
879
|
+
style: {
|
|
880
|
+
flex: 1
|
|
881
|
+
}
|
|
882
|
+
}, children);
|
|
883
|
+
}
|
|
884
|
+
return children;
|
|
885
|
+
};
|
|
886
|
+
if (props.modal) {
|
|
887
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
888
|
+
visible: this.state.isBottomsheetVisible,
|
|
889
|
+
transparent: true,
|
|
890
|
+
animationType: "none",
|
|
891
|
+
onRequestClose: () => {
|
|
892
|
+
if (!this.props.disableswipedownclose && this.props.autoclose !== 'disabled') {
|
|
893
|
+
this.closeSheet();
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
statusBarTranslucent: false
|
|
897
|
+
}, /*#__PURE__*/React.createElement(GestureHandlerRootView, {
|
|
898
|
+
style: {
|
|
899
|
+
flex: 1
|
|
692
900
|
}
|
|
693
|
-
},
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
}
|
|
901
|
+
}, wrapWithSafeArea(/*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
|
902
|
+
style: {
|
|
903
|
+
flex: 1
|
|
904
|
+
},
|
|
905
|
+
behavior: Platform.OS === 'android' ? this.state.keyboardHeight > 0 ? 'padding' : undefined : 'padding',
|
|
906
|
+
keyboardVerticalOffset: Platform.OS === 'ios' ? 0 : undefined
|
|
907
|
+
}, this.renderContent(props)))));
|
|
908
|
+
} else {
|
|
909
|
+
return this.renderContent(props);
|
|
910
|
+
}
|
|
911
|
+
});
|
|
705
912
|
}
|
|
706
913
|
}
|
|
707
914
|
//# sourceMappingURL=bottomsheet.component.js.map
|