@draftbit/core 46.11.1-99ce8e.2 → 46.11.1-c64d65.2
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/lib/commonjs/components/Checkbox/CheckboxGroup.js +3 -16
- package/lib/commonjs/components/Checkbox/CheckboxGroup.js.map +1 -1
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +5 -22
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
- package/lib/commonjs/components/Checkbox/context.js +1 -1
- package/lib/commonjs/components/Checkbox/context.js.map +1 -1
- package/lib/commonjs/components/Checkbox/index.js.map +1 -1
- package/lib/commonjs/components/StepIndicator.js +57 -18
- package/lib/commonjs/components/TabView/TabView.js +14 -7
- package/lib/commonjs/index.js +0 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/MapMarker.js +1 -10
- package/lib/commonjs/mappings/MapMarker.js.map +1 -1
- package/lib/module/components/ActionSheet/ActionSheetCancel.js.map +1 -1
- package/lib/module/components/Banner.js +23 -4
- package/lib/module/components/Banner.js.map +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.tsx.tmp +120 -0
- package/lib/module/components/BottomSheet/BottomSheetComponent.tsx.tmp +895 -0
- package/lib/module/components/Card.js.map +1 -1
- package/lib/module/components/CircleImage.js +15 -1
- package/lib/module/components/CircleImage.js.map +1 -1
- package/lib/module/components/Container.js +16 -4
- package/lib/module/components/Container.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +9 -13
- package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponent.web.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +21 -3
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/module/components/Portal/PortalHost.js +44 -14
- package/lib/module/components/Portal/PortalHost.js.map +1 -1
- package/lib/module/components/ProgressCircle.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +23 -5
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/components/RadioButton/index.js.map +1 -1
- package/lib/module/components/Row.js.map +1 -1
- package/lib/module/components/RowBodyIcon.js.map +1 -1
- package/lib/module/components/Swiper/SwiperItem.js.map +1 -1
- package/lib/module/components/Touchable.web.js.map +1 -1
- package/lib/module/components/YoutubePlayer/YoutubePlayerProps.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/AccordionItem.js.map +1 -1
- package/lib/module/mappings/AudioPlayer.js.map +1 -1
- package/lib/module/mappings/CardInline.js.map +1 -1
- package/lib/module/mappings/DeckSwiper.js.map +1 -1
- package/lib/module/mappings/Divider.js.map +1 -1
- package/lib/module/mappings/FlashList.js.map +1 -1
- package/lib/module/mappings/MapMarker.js +2 -11
- package/lib/module/mappings/MapMarker.js.map +1 -1
- package/lib/module/mappings/ProgressIndicator.js.map +1 -1
- package/lib/module/mappings/RadioButtonGroup.js.map +1 -1
- package/lib/module/styles/shadow.js.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/MapMarker.d.ts +0 -9
- package/lib/typescript/src/mappings/MapMarker.d.ts.map +1 -1
- package/package.json +3 -5
- package/src/components/BottomSheet/BottomSheet.tsx.tmp +120 -0
- package/src/components/BottomSheet/BottomSheetComponent.tsx.tmp +895 -0
- package/{lib/module/components/BottomSheet/index.js → src/components/BottomSheet/index.ts.tmp} +0 -1
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/src/mappings/MapMarker.js +1 -10
- package/src/mappings/MapMarker.ts +0 -11
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +0 -89
- package/lib/commonjs/components/BottomSheet/BottomSheet.js.map +0 -1
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +0 -424
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js.map +0 -1
- package/lib/commonjs/components/BottomSheet/index.js +0 -14
- package/lib/commonjs/components/BottomSheet/index.js.map +0 -1
- package/lib/module/components/BottomSheet/BottomSheet.js +0 -81
- package/lib/module/components/BottomSheet/BottomSheet.js.map +0 -1
- package/lib/module/components/BottomSheet/BottomSheetComponent.js +0 -430
- package/lib/module/components/BottomSheet/BottomSheetComponent.js.map +0 -1
- package/lib/module/components/BottomSheet/index.js.map +0 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +0 -20
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +0 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +0 -170
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +0 -1
- package/lib/typescript/src/components/BottomSheet/index.d.ts +0 -2
- package/lib/typescript/src/components/BottomSheet/index.d.ts.map +0 -1
- package/src/components/BottomSheet/BottomSheet.js +0 -56
- package/src/components/BottomSheet/BottomSheetComponent.js +0 -437
- /package/{src/components/BottomSheet/BottomSheet.tsx → lib/commonjs/components/BottomSheet/BottomSheet.tsx.tmp} +0 -0
- /package/{src/components/BottomSheet/BottomSheetComponent.tsx → lib/commonjs/components/BottomSheet/BottomSheetComponent.tsx.tmp} +0 -0
- /package/{src/components/BottomSheet/index.js → lib/commonjs/components/BottomSheet/index.ts.tmp} +0 -0
- /package/{src/components/BottomSheet/index.ts → lib/module/components/BottomSheet/index.ts.tmp} +0 -0
package/src/index.js
CHANGED
|
@@ -35,7 +35,6 @@ export { default as Shadow } from "./components/Shadow";
|
|
|
35
35
|
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
36
36
|
export { TabView, TabViewItem } from "./components/TabView";
|
|
37
37
|
export { default as Markdown } from "./components/Markdown";
|
|
38
|
-
export { BottomSheet } from "./components/BottomSheet";
|
|
39
38
|
export { YoutubePlayer } from "./components/YoutubePlayer";
|
|
40
39
|
export { Table, TableRow, TableCell } from "./components/Table";
|
|
41
40
|
/* Deprecated: Fix or Delete! */
|
package/src/index.tsx
CHANGED
|
@@ -58,8 +58,6 @@ export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
|
58
58
|
export { TabView, TabViewItem } from "./components/TabView";
|
|
59
59
|
export { default as Markdown } from "./components/Markdown";
|
|
60
60
|
|
|
61
|
-
export { BottomSheet } from "./components/BottomSheet";
|
|
62
|
-
|
|
63
61
|
export { YoutubePlayer } from "./components/YoutubePlayer";
|
|
64
62
|
|
|
65
63
|
export { Table, TableRow, TableCell } from "./components/Table";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createBoolProp, createColorProp, createNumberProp, createTextProp,
|
|
1
|
+
import { COMPONENT_TYPES, createBoolProp, createColorProp, createNumberProp, createTextProp, GROUPS, StylesPanelSections, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Map Marker",
|
|
4
4
|
tag: "MapMarker",
|
|
@@ -48,14 +48,5 @@ export const SEED_DATA = {
|
|
|
48
48
|
label: "Pin Color",
|
|
49
49
|
description: "Sets the color of the marker",
|
|
50
50
|
}),
|
|
51
|
-
pinImage: {
|
|
52
|
-
group: GROUPS.data,
|
|
53
|
-
label: "Pin image",
|
|
54
|
-
description: "Image to be used instead of the default pin",
|
|
55
|
-
editable: true,
|
|
56
|
-
required: false,
|
|
57
|
-
formType: FORM_TYPES.image,
|
|
58
|
-
propType: PROP_TYPES.ASSET,
|
|
59
|
-
},
|
|
60
51
|
},
|
|
61
52
|
};
|
|
@@ -4,9 +4,7 @@ import {
|
|
|
4
4
|
createColorProp,
|
|
5
5
|
createNumberProp,
|
|
6
6
|
createTextProp,
|
|
7
|
-
FORM_TYPES,
|
|
8
7
|
GROUPS,
|
|
9
|
-
PROP_TYPES,
|
|
10
8
|
StylesPanelSections,
|
|
11
9
|
} from "@draftbit/types";
|
|
12
10
|
|
|
@@ -60,14 +58,5 @@ export const SEED_DATA = {
|
|
|
60
58
|
label: "Pin Color",
|
|
61
59
|
description: "Sets the color of the marker",
|
|
62
60
|
}),
|
|
63
|
-
pinImage: {
|
|
64
|
-
group: GROUPS.data,
|
|
65
|
-
label: "Pin image",
|
|
66
|
-
description: "Image to be used instead of the default pin",
|
|
67
|
-
editable: true,
|
|
68
|
-
required: false,
|
|
69
|
-
formType: FORM_TYPES.image,
|
|
70
|
-
propType: PROP_TYPES.ASSET,
|
|
71
|
-
},
|
|
72
61
|
},
|
|
73
62
|
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _BottomSheetComponent = _interopRequireDefault(require("./BottomSheetComponent"));
|
|
10
|
-
var _theming = require("../../theming");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
|
-
const BottomSheet = _ref => {
|
|
14
|
-
let {
|
|
15
|
-
theme,
|
|
16
|
-
snapPoints = ["10%", "50%", "80%"],
|
|
17
|
-
initialSnapIndex = 0,
|
|
18
|
-
showHandle = true,
|
|
19
|
-
handleColor = theme.colors.divider,
|
|
20
|
-
topBorderRadius = 20,
|
|
21
|
-
borderWidth = 1,
|
|
22
|
-
borderColor = theme.colors.divider,
|
|
23
|
-
onSettle,
|
|
24
|
-
style,
|
|
25
|
-
children,
|
|
26
|
-
...rest
|
|
27
|
-
} = _ref;
|
|
28
|
-
const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background;
|
|
29
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
30
|
-
style: styles.parentContainer,
|
|
31
|
-
pointerEvents: "box-none"
|
|
32
|
-
}, /*#__PURE__*/_react.default.createElement(_BottomSheetComponent.default, _extends({
|
|
33
|
-
componentType: "ScrollView",
|
|
34
|
-
snapPoints: snapPoints,
|
|
35
|
-
initialSnapIndex: initialSnapIndex,
|
|
36
|
-
renderHandle: () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showHandle && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
37
|
-
style: [styles.handleContainer, {
|
|
38
|
-
backgroundColor,
|
|
39
|
-
borderTopLeftRadius: topBorderRadius,
|
|
40
|
-
borderTopRightRadius: topBorderRadius
|
|
41
|
-
}]
|
|
42
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
43
|
-
style: [styles.handle, {
|
|
44
|
-
backgroundColor: handleColor
|
|
45
|
-
}]
|
|
46
|
-
}))),
|
|
47
|
-
contentContainerStyle: [styles.contentContainerStyle, style],
|
|
48
|
-
containerStyle: _reactNative.StyleSheet.flatten([styles.containerStyle, {
|
|
49
|
-
backgroundColor,
|
|
50
|
-
borderTopLeftRadius: topBorderRadius,
|
|
51
|
-
borderTopRightRadius: topBorderRadius,
|
|
52
|
-
borderWidth,
|
|
53
|
-
borderColor
|
|
54
|
-
}]),
|
|
55
|
-
onSettle: onSettle
|
|
56
|
-
}, rest), children));
|
|
57
|
-
};
|
|
58
|
-
const styles = _reactNative.StyleSheet.create({
|
|
59
|
-
//Render on top of everything
|
|
60
|
-
parentContainer: {
|
|
61
|
-
position: "absolute",
|
|
62
|
-
left: 0,
|
|
63
|
-
right: 0,
|
|
64
|
-
top: 0,
|
|
65
|
-
bottom: 0,
|
|
66
|
-
zIndex: 10,
|
|
67
|
-
overflow: "hidden"
|
|
68
|
-
},
|
|
69
|
-
contentContainerStyle: {
|
|
70
|
-
paddingHorizontal: 16,
|
|
71
|
-
paddingVertical: 10
|
|
72
|
-
},
|
|
73
|
-
containerStyle: {
|
|
74
|
-
flex: 1,
|
|
75
|
-
overflow: "hidden"
|
|
76
|
-
},
|
|
77
|
-
handleContainer: {
|
|
78
|
-
alignItems: "center",
|
|
79
|
-
paddingVertical: 20
|
|
80
|
-
},
|
|
81
|
-
handle: {
|
|
82
|
-
width: 40,
|
|
83
|
-
height: 2,
|
|
84
|
-
borderRadius: 4
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
var _default = (0, _theming.withTheme)(BottomSheet);
|
|
88
|
-
exports.default = _default;
|
|
89
|
-
//# sourceMappingURL=BottomSheet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BottomSheet","theme","snapPoints","initialSnapIndex","showHandle","handleColor","colors","divider","topBorderRadius","borderWidth","borderColor","onSettle","style","children","rest","backgroundColor","background","styles","parentContainer","handleContainer","borderTopLeftRadius","borderTopRightRadius","handle","contentContainerStyle","StyleSheet","flatten","containerStyle","create","position","left","right","top","bottom","zIndex","overflow","paddingHorizontal","paddingVertical","flex","alignItems","width","height","borderRadius","withTheme"],"sourceRoot":"../../../../src","sources":["components/BottomSheet/BottomSheet.tsx"],"mappings":";;;;;;AAAA;AACA;AAQA;AAEA;AAA0C;AAAA;AAe1C,MAAMA,WAAgE,GAAG,QAanE;EAAA,IAboE;IACxEC,KAAK;IACLC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAClCC,gBAAgB,GAAG,CAAC;IACpBC,UAAU,GAAG,IAAI;IACjBC,WAAW,GAAGJ,KAAK,CAACK,MAAM,CAACC,OAAO;IAClCC,eAAe,GAAG,EAAE;IACpBC,WAAW,GAAG,CAAC;IACfC,WAAW,GAAGT,KAAK,CAACK,MAAM,CAACC,OAAO;IAClCI,QAAQ;IACRC,KAAK;IACLC,QAAQ;IACR,GAAGC;EACL,CAAC;EACC,MAAMC,eAAe,GACnB,CAACH,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAgBG,eAAe,KAAId,KAAK,CAACK,MAAM,CAACU,UAAU;EAElE,oBACE,6BAAC,iBAAI;IAAC,KAAK,EAAEC,MAAM,CAACC,eAAgB;IAAC,aAAa,EAAC;EAAU,gBAC3D,6BAAC,6BAAoB;IACnB,aAAa,EAAC,YAAY;IAC1B,UAAU,EAAEhB,UAAW;IACvB,gBAAgB,EAAEC,gBAAiB;IACnC,YAAY,EAAE,mBACZ,4DACGC,UAAU,iBACT,6BAAC,iBAAI;MACH,KAAK,EAAE,CACLa,MAAM,CAACE,eAAe,EACtB;QACEJ,eAAe;QACfK,mBAAmB,EAAEZ,eAAe;QACpCa,oBAAoB,EAAEb;MACxB,CAAC;IACD,gBAEF,6BAAC,iBAAI;MACH,KAAK,EAAE,CAACS,MAAM,CAACK,MAAM,EAAE;QAAEP,eAAe,EAAEV;MAAY,CAAC;IAAE,EACzD,CAEL,CAEH;IACF,qBAAqB,EAAE,CAACY,MAAM,CAACM,qBAAqB,EAAEX,KAAK,CAAE;IAC7D,cAAc,EAAEY,uBAAU,CAACC,OAAO,CAAC,CACjCR,MAAM,CAACS,cAAc,EACrB;MACEX,eAAe;MACfK,mBAAmB,EAAEZ,eAAe;MACpCa,oBAAoB,EAAEb,eAAe;MACrCC,WAAW;MACXC;IACF,CAAC,CACF,CAAE;IACH,QAAQ,EAAEC;EAAS,GACfG,IAAI,GAEPD,QAAQ,CACY,CAClB;AAEX,CAAC;AAED,MAAMI,MAAM,GAAGO,uBAAU,CAACG,MAAM,CAAC;EAC/B;EACAT,eAAe,EAAE;IACfU,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACTC,MAAM,EAAE,EAAE;IACVC,QAAQ,EAAE;EACZ,CAAC;EACDX,qBAAqB,EAAE;IACrBY,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE;EACnB,CAAC;EACDV,cAAc,EAAE;IACdW,IAAI,EAAE,CAAC;IACPH,QAAQ,EAAE;EACZ,CAAC;EACDf,eAAe,EAAE;IACfmB,UAAU,EAAE,QAAQ;IACpBF,eAAe,EAAE;EACnB,CAAC;EACDd,MAAM,EAAE;IACNiB,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAAC,eAEY,IAAAC,kBAAS,EAAC1C,WAAW,CAAC;AAAA"}
|
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ScrollBottomSheet = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
|
-
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
16
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
|
-
const {
|
|
18
|
-
//@ts-ignore
|
|
19
|
-
interpolate: interpolateDeprecated,
|
|
20
|
-
// @ts-ignore: this property is only present in Reanimated 2
|
|
21
|
-
interpolateNode
|
|
22
|
-
} = _reactNativeReanimated.default;
|
|
23
|
-
const interpolate = interpolateNode !== null && interpolateNode !== void 0 ? interpolateNode : interpolateDeprecated;
|
|
24
|
-
//@ts-ignore
|
|
25
|
-
const Easing = _reactNativeReanimated.EasingNode !== null && _reactNativeReanimated.EasingNode !== void 0 ? _reactNativeReanimated.EasingNode : _reactNativeReanimated.Easing;
|
|
26
|
-
const FlatListComponentType = "FlatList";
|
|
27
|
-
const ScrollViewComponentType = "ScrollView";
|
|
28
|
-
const SectionListComponentType = "SectionList";
|
|
29
|
-
const TimingAnimationType = "timing";
|
|
30
|
-
const SpringAnimationType = "spring";
|
|
31
|
-
const DEFAULT_SPRING_PARAMS = {
|
|
32
|
-
damping: 50,
|
|
33
|
-
mass: 0.3,
|
|
34
|
-
stiffness: 121.6,
|
|
35
|
-
overshootClamping: true,
|
|
36
|
-
restSpeedThreshold: 0.3,
|
|
37
|
-
restDisplacementThreshold: 0.3
|
|
38
|
-
};
|
|
39
|
-
const {
|
|
40
|
-
height: windowHeight
|
|
41
|
-
} = _reactNative.Dimensions.get("window");
|
|
42
|
-
const IOS_NORMAL_DECELERATION_RATE = 0.998;
|
|
43
|
-
const ANDROID_NORMAL_DECELERATION_RATE = 0.985;
|
|
44
|
-
const DEFAULT_ANIMATION_DURATION = 250;
|
|
45
|
-
const DEFAULT_EASING = Easing.inOut(Easing.linear);
|
|
46
|
-
const imperativeScrollOptions = {
|
|
47
|
-
[FlatListComponentType]: {
|
|
48
|
-
method: "scrollToIndex",
|
|
49
|
-
args: {
|
|
50
|
-
index: 0,
|
|
51
|
-
viewPosition: 0,
|
|
52
|
-
viewOffset: 1000,
|
|
53
|
-
animated: true
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
[ScrollViewComponentType]: {
|
|
57
|
-
method: "scrollTo",
|
|
58
|
-
args: {
|
|
59
|
-
x: 0,
|
|
60
|
-
y: 0,
|
|
61
|
-
animated: true
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
[SectionListComponentType]: {
|
|
65
|
-
method: "scrollToLocation",
|
|
66
|
-
args: {
|
|
67
|
-
itemIndex: 0,
|
|
68
|
-
sectionIndex: 0,
|
|
69
|
-
viewPosition: 0,
|
|
70
|
-
viewOffset: 1000,
|
|
71
|
-
animated: true
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
class ScrollBottomSheet extends _react.Component {
|
|
76
|
-
/**
|
|
77
|
-
* Gesture Handler references
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Flag to indicate imperative snapping
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Manual snapping amount
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
constructor(props) {
|
|
89
|
-
var _props$animationConfi, _this;
|
|
90
|
-
super(props);
|
|
91
|
-
_this = this;
|
|
92
|
-
_defineProperty(this, "masterDrawer", /*#__PURE__*/_react.default.createRef());
|
|
93
|
-
_defineProperty(this, "drawerHandleRef", /*#__PURE__*/_react.default.createRef());
|
|
94
|
-
_defineProperty(this, "drawerContentRef", /*#__PURE__*/_react.default.createRef());
|
|
95
|
-
_defineProperty(this, "scrollComponentRef", /*#__PURE__*/_react.default.createRef());
|
|
96
|
-
_defineProperty(this, "isManuallySetValue", new _reactNativeReanimated.Value(0));
|
|
97
|
-
_defineProperty(this, "manualYOffset", new _reactNativeReanimated.Value(0));
|
|
98
|
-
_defineProperty(this, "prevSnapIndex", -1);
|
|
99
|
-
_defineProperty(this, "dragY", new _reactNativeReanimated.Value(0));
|
|
100
|
-
_defineProperty(this, "prevDragY", new _reactNativeReanimated.Value(0));
|
|
101
|
-
_defineProperty(this, "tempDestSnapPoint", new _reactNativeReanimated.Value(0));
|
|
102
|
-
_defineProperty(this, "isAndroid", new _reactNativeReanimated.Value(Number(_reactNative.Platform.OS === "android")));
|
|
103
|
-
_defineProperty(this, "animationClock", new _reactNativeReanimated.Clock());
|
|
104
|
-
_defineProperty(this, "animationPosition", new _reactNativeReanimated.Value(0));
|
|
105
|
-
_defineProperty(this, "animationFinished", new _reactNativeReanimated.Value(0));
|
|
106
|
-
_defineProperty(this, "animationFrameTime", new _reactNativeReanimated.Value(0));
|
|
107
|
-
_defineProperty(this, "velocityY", new _reactNativeReanimated.Value(0));
|
|
108
|
-
_defineProperty(this, "lastStartScrollY", new _reactNativeReanimated.Value(0));
|
|
109
|
-
_defineProperty(this, "destSnapPoint", new _reactNativeReanimated.Value(0));
|
|
110
|
-
_defineProperty(this, "dragWithHandle", new _reactNativeReanimated.Value(0));
|
|
111
|
-
_defineProperty(this, "scrollUpAndPullDown", new _reactNativeReanimated.Value(0));
|
|
112
|
-
_defineProperty(this, "convertPercentageToDp", str => Number(str.split("%")[0]) * (windowHeight - this.props.topInset) / 100);
|
|
113
|
-
_defineProperty(this, "getNormalisedSnapPoints", () => {
|
|
114
|
-
return this.props.snapPoints.map(p => {
|
|
115
|
-
if (typeof p === "string") {
|
|
116
|
-
return this.convertPercentageToDp(p);
|
|
117
|
-
} else if (typeof p === "number") {
|
|
118
|
-
return p;
|
|
119
|
-
}
|
|
120
|
-
throw new Error("Invalid type for value ".concat(p, ": ").concat(typeof p, ". It should be either a percentage string or a number"));
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
_defineProperty(this, "getScrollComponent", () => {
|
|
124
|
-
switch (this.props.componentType) {
|
|
125
|
-
case "FlatList":
|
|
126
|
-
return _reactNative.FlatList;
|
|
127
|
-
case "ScrollView":
|
|
128
|
-
return _reactNative.ScrollView;
|
|
129
|
-
case "SectionList":
|
|
130
|
-
return _reactNative.SectionList;
|
|
131
|
-
default:
|
|
132
|
-
throw new Error("Component type not supported: it should be one of `FlatList`, `ScrollView` or `SectionList`");
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
_defineProperty(this, "snapTo", index => {
|
|
136
|
-
const snapPoints = this.getNormalisedSnapPoints();
|
|
137
|
-
this.isManuallySetValue.setValue(1);
|
|
138
|
-
this.manualYOffset.setValue(snapPoints[index]);
|
|
139
|
-
this.nextSnapIndex.setValue(index);
|
|
140
|
-
});
|
|
141
|
-
const {
|
|
142
|
-
initialSnapIndex,
|
|
143
|
-
animationType
|
|
144
|
-
} = props;
|
|
145
|
-
const animationDriver = animationType === "timing" ? 0 : 1;
|
|
146
|
-
const animationDuration = props.animationType === "timing" && ((_props$animationConfi = props.animationConfig) === null || _props$animationConfi === void 0 ? void 0 : _props$animationConfi.duration) || DEFAULT_ANIMATION_DURATION;
|
|
147
|
-
const ScrollComponent = this.getScrollComponent();
|
|
148
|
-
// @ts-ignore
|
|
149
|
-
this.scrollComponent = _reactNativeReanimated.default.createAnimatedComponent(ScrollComponent);
|
|
150
|
-
const _snapPoints = this.getNormalisedSnapPoints();
|
|
151
|
-
const openPosition = _snapPoints[0];
|
|
152
|
-
const closedPosition = this.props.enableOverScroll ? windowHeight : _snapPoints[_snapPoints.length - 1];
|
|
153
|
-
const initialSnap = _snapPoints[initialSnapIndex];
|
|
154
|
-
this.nextSnapIndex = new _reactNativeReanimated.Value(initialSnapIndex);
|
|
155
|
-
const initialDecelerationRate = _reactNative.Platform.select({
|
|
156
|
-
android: props.initialSnapIndex === 0 ? ANDROID_NORMAL_DECELERATION_RATE : 0,
|
|
157
|
-
ios: IOS_NORMAL_DECELERATION_RATE
|
|
158
|
-
});
|
|
159
|
-
this.decelerationRate = new _reactNativeReanimated.Value(initialDecelerationRate);
|
|
160
|
-
|
|
161
|
-
//@ts-ignore
|
|
162
|
-
const handleGestureState = new _reactNativeReanimated.Value(-1);
|
|
163
|
-
//@ts-ignore
|
|
164
|
-
const handleOldGestureState = new _reactNativeReanimated.Value(-1);
|
|
165
|
-
//@ts-ignore
|
|
166
|
-
const drawerGestureState = new _reactNativeReanimated.Value(-1);
|
|
167
|
-
//@ts-ignore
|
|
168
|
-
const drawerOldGestureState = new _reactNativeReanimated.Value(-1);
|
|
169
|
-
const lastSnapInRange = new _reactNativeReanimated.Value(1);
|
|
170
|
-
this.prevTranslateYOffset = new _reactNativeReanimated.Value(initialSnap);
|
|
171
|
-
this.translationY = new _reactNativeReanimated.Value(initialSnap);
|
|
172
|
-
this.lastSnap = new _reactNativeReanimated.Value(initialSnap);
|
|
173
|
-
this.onHandleGestureEvent = (0, _reactNativeReanimated.event)([{
|
|
174
|
-
nativeEvent: {
|
|
175
|
-
translationY: this.dragY,
|
|
176
|
-
oldState: handleOldGestureState,
|
|
177
|
-
state: handleGestureState,
|
|
178
|
-
velocityY: this.velocityY
|
|
179
|
-
}
|
|
180
|
-
}]);
|
|
181
|
-
this.onDrawerGestureEvent = (0, _reactNativeReanimated.event)([{
|
|
182
|
-
nativeEvent: {
|
|
183
|
-
translationY: this.dragY,
|
|
184
|
-
oldState: drawerOldGestureState,
|
|
185
|
-
state: drawerGestureState,
|
|
186
|
-
velocityY: this.velocityY
|
|
187
|
-
}
|
|
188
|
-
}]);
|
|
189
|
-
this.onScrollBeginDrag = (0, _reactNativeReanimated.event)([{
|
|
190
|
-
nativeEvent: {
|
|
191
|
-
contentOffset: {
|
|
192
|
-
y: this.lastStartScrollY
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}]);
|
|
196
|
-
const didHandleGestureBegin = (0, _reactNativeReanimated.eq)(handleGestureState, _reactNativeGestureHandler.State.ACTIVE);
|
|
197
|
-
const isAnimationInterrupted = (0, _reactNativeReanimated.and)((0, _reactNativeReanimated.or)((0, _reactNativeReanimated.eq)(handleGestureState, _reactNativeGestureHandler.State.BEGAN), (0, _reactNativeReanimated.eq)(drawerGestureState, _reactNativeGestureHandler.State.BEGAN), (0, _reactNativeReanimated.and)((0, _reactNativeReanimated.eq)(this.isAndroid, 0), (0, _reactNativeReanimated.eq)(animationDriver, 1), (0, _reactNativeReanimated.or)((0, _reactNativeReanimated.eq)(drawerGestureState, _reactNativeGestureHandler.State.ACTIVE), (0, _reactNativeReanimated.eq)(handleGestureState, _reactNativeGestureHandler.State.ACTIVE)))), (0, _reactNativeReanimated.clockRunning)(this.animationClock));
|
|
198
|
-
this.didGestureFinish = (0, _reactNativeReanimated.or)((0, _reactNativeReanimated.and)((0, _reactNativeReanimated.eq)(handleOldGestureState, _reactNativeGestureHandler.State.ACTIVE), (0, _reactNativeReanimated.eq)(handleGestureState, _reactNativeGestureHandler.State.END)), (0, _reactNativeReanimated.and)((0, _reactNativeReanimated.eq)(drawerOldGestureState, _reactNativeGestureHandler.State.ACTIVE), (0, _reactNativeReanimated.eq)(drawerGestureState, _reactNativeGestureHandler.State.END)));
|
|
199
|
-
|
|
200
|
-
// Function that determines if the last snap point is in the range {snapPoints}
|
|
201
|
-
// In the case of interruptions in the middle of an animation, we'll get
|
|
202
|
-
// lastSnap values outside the range
|
|
203
|
-
const isLastSnapPointInRange = function () {
|
|
204
|
-
let i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
205
|
-
return i === _snapPoints.length ? lastSnapInRange : (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(_this.lastSnap, _snapPoints[i]), [(0, _reactNativeReanimated.set)(lastSnapInRange, 1)], isLastSnapPointInRange(i + 1));
|
|
206
|
-
};
|
|
207
|
-
const scrollY = [(0, _reactNativeReanimated.set)(lastSnapInRange, 0), isLastSnapPointInRange(), (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.or)(didHandleGestureBegin, (0, _reactNativeReanimated.and)(this.isManuallySetValue, (0, _reactNativeReanimated.not)((0, _reactNativeReanimated.eq)(this.manualYOffset, _snapPoints[0])))), [(0, _reactNativeReanimated.set)(this.dragWithHandle, 1), 0]), (0, _reactNativeReanimated.cond)(
|
|
208
|
-
// This is to account for a continuous scroll on the drawer from a snap point
|
|
209
|
-
// Different than top, bringing the drawer to the top position, so that if we
|
|
210
|
-
// change scroll direction without releasing the gesture, it doesn't pull down the drawer again
|
|
211
|
-
(0, _reactNativeReanimated.and)((0, _reactNativeReanimated.eq)(this.dragWithHandle, 1), (0, _reactNativeReanimated.greaterThan)(_snapPoints[0], (0, _reactNativeReanimated.add)(this.lastSnap, this.dragY)), (0, _reactNativeReanimated.and)((0, _reactNativeReanimated.not)((0, _reactNativeReanimated.eq)(this.lastSnap, _snapPoints[0])), lastSnapInRange)), [(0, _reactNativeReanimated.set)(this.lastSnap, _snapPoints[0]), (0, _reactNativeReanimated.set)(this.dragWithHandle, 0), this.lastStartScrollY], (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(this.dragWithHandle, 1), 0, this.lastStartScrollY))];
|
|
212
|
-
this.didScrollUpAndPullDown = (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.and)((0, _reactNativeReanimated.greaterOrEq)(this.dragY, this.lastStartScrollY), (0, _reactNativeReanimated.greaterThan)(this.lastStartScrollY, 0)), (0, _reactNativeReanimated.set)(this.scrollUpAndPullDown, 1));
|
|
213
|
-
this.setTranslationY = (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.and)((0, _reactNativeReanimated.not)(this.dragWithHandle), (0, _reactNativeReanimated.not)((0, _reactNativeReanimated.greaterOrEq)(this.dragY, this.lastStartScrollY))), (0, _reactNativeReanimated.set)(this.translationY, (0, _reactNativeReanimated.sub)(this.dragY, this.lastStartScrollY)), (0, _reactNativeReanimated.set)(this.translationY, this.dragY));
|
|
214
|
-
this.extraOffset = (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(this.scrollUpAndPullDown, 1), this.lastStartScrollY, 0);
|
|
215
|
-
const endOffsetY = (0, _reactNativeReanimated.add)(this.lastSnap, this.translationY, (0, _reactNativeReanimated.multiply)(1 - props.friction, this.velocityY));
|
|
216
|
-
this.calculateNextSnapPoint = function () {
|
|
217
|
-
let i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
218
|
-
return i === _snapPoints.length ? _this.tempDestSnapPoint : (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.greaterThan)((0, _reactNativeReanimated.abs)((0, _reactNativeReanimated.sub)(_this.tempDestSnapPoint, endOffsetY)), (0, _reactNativeReanimated.abs)((0, _reactNativeReanimated.sub)((0, _reactNativeReanimated.add)(_snapPoints[i], _this.extraOffset), endOffsetY))), [(0, _reactNativeReanimated.set)(_this.tempDestSnapPoint, (0, _reactNativeReanimated.add)(_snapPoints[i], _this.extraOffset)), (0, _reactNativeReanimated.set)(_this.nextSnapIndex, i), _this.calculateNextSnapPoint(i + 1)], _this.calculateNextSnapPoint(i + 1));
|
|
219
|
-
};
|
|
220
|
-
const runAnimation = _ref => {
|
|
221
|
-
var _props$animationConfi2;
|
|
222
|
-
let {
|
|
223
|
-
clock,
|
|
224
|
-
from,
|
|
225
|
-
to,
|
|
226
|
-
position,
|
|
227
|
-
finished,
|
|
228
|
-
velocity,
|
|
229
|
-
frameTime
|
|
230
|
-
} = _ref;
|
|
231
|
-
const state = {
|
|
232
|
-
finished,
|
|
233
|
-
velocity: new _reactNativeReanimated.Value(0),
|
|
234
|
-
position,
|
|
235
|
-
time: new _reactNativeReanimated.Value(0),
|
|
236
|
-
frameTime
|
|
237
|
-
};
|
|
238
|
-
const timingConfig = {
|
|
239
|
-
duration: animationDuration,
|
|
240
|
-
easing: props.animationType === "timing" && ((_props$animationConfi2 = props.animationConfig) === null || _props$animationConfi2 === void 0 ? void 0 : _props$animationConfi2.easing) || DEFAULT_EASING,
|
|
241
|
-
toValue: new _reactNativeReanimated.Value(0)
|
|
242
|
-
};
|
|
243
|
-
const springConfig = {
|
|
244
|
-
...DEFAULT_SPRING_PARAMS,
|
|
245
|
-
...(props.animationType === "spring" && props.animationConfig || {}),
|
|
246
|
-
toValue: new _reactNativeReanimated.Value(0)
|
|
247
|
-
};
|
|
248
|
-
return [(0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.and)((0, _reactNativeReanimated.not)((0, _reactNativeReanimated.clockRunning)(clock)), (0, _reactNativeReanimated.not)((0, _reactNativeReanimated.eq)(finished, 1))), [
|
|
249
|
-
// If the clock isn't running, we reset all the animation params and start the clock
|
|
250
|
-
(0, _reactNativeReanimated.set)(state.finished, 0), (0, _reactNativeReanimated.set)(state.velocity, velocity), (0, _reactNativeReanimated.set)(state.time, 0), (0, _reactNativeReanimated.set)(state.position, from), (0, _reactNativeReanimated.set)(state.frameTime, 0), (0, _reactNativeReanimated.set)(timingConfig.toValue, to), (0, _reactNativeReanimated.set)(springConfig.toValue, to), (0, _reactNativeReanimated.startClock)(clock)]),
|
|
251
|
-
// We run the step here that is going to update position
|
|
252
|
-
(0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(animationDriver, 0),
|
|
253
|
-
//@ts-ignore
|
|
254
|
-
(0, _reactNativeReanimated.timing)(clock, state, timingConfig), (0, _reactNativeReanimated.spring)(clock, state, springConfig)), (0, _reactNativeReanimated.cond)(state.finished, [(0, _reactNativeReanimated.call)([this.nextSnapIndex], _ref2 => {
|
|
255
|
-
let [value] = _ref2;
|
|
256
|
-
if (value !== this.prevSnapIndex) {
|
|
257
|
-
var _this$props$onSettle, _this$props;
|
|
258
|
-
(_this$props$onSettle = (_this$props = this.props).onSettle) === null || _this$props$onSettle === void 0 ? void 0 : _this$props$onSettle.call(_this$props, value);
|
|
259
|
-
}
|
|
260
|
-
this.prevSnapIndex = value;
|
|
261
|
-
}),
|
|
262
|
-
// Resetting appropriate values
|
|
263
|
-
(0, _reactNativeReanimated.set)(drawerOldGestureState, _reactNativeGestureHandler.State.END), (0, _reactNativeReanimated.set)(handleOldGestureState, _reactNativeGestureHandler.State.END), (0, _reactNativeReanimated.set)(this.prevTranslateYOffset, state.position), (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(this.scrollUpAndPullDown, 1), [(0, _reactNativeReanimated.set)(this.prevTranslateYOffset, (0, _reactNativeReanimated.sub)(this.prevTranslateYOffset, this.lastStartScrollY)), (0, _reactNativeReanimated.set)(this.lastStartScrollY, 0), (0, _reactNativeReanimated.set)(this.scrollUpAndPullDown, 0)]), (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(this.destSnapPoint, _snapPoints[0]), [(0, _reactNativeReanimated.set)(this.dragWithHandle, 0)]), (0, _reactNativeReanimated.set)(this.isManuallySetValue, 0), (0, _reactNativeReanimated.set)(this.manualYOffset, 0), (0, _reactNativeReanimated.stopClock)(clock), this.prevTranslateYOffset],
|
|
264
|
-
// We made the block return the updated position,
|
|
265
|
-
state.position)];
|
|
266
|
-
};
|
|
267
|
-
const translateYOffset = (0, _reactNativeReanimated.cond)(isAnimationInterrupted, [
|
|
268
|
-
// set(prevTranslateYOffset, animationPosition) should only run if we are
|
|
269
|
-
// interrupting an animation when the drawer is currently in a different
|
|
270
|
-
// position than the top
|
|
271
|
-
(0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.or)(this.dragWithHandle, (0, _reactNativeReanimated.greaterOrEq)((0, _reactNativeReanimated.abs)(this.prevDragY), this.lastStartScrollY)), (0, _reactNativeReanimated.set)(this.prevTranslateYOffset, this.animationPosition)), (0, _reactNativeReanimated.set)(this.animationFinished, 1), (0, _reactNativeReanimated.set)(this.translationY, 0),
|
|
272
|
-
// Resetting appropriate values
|
|
273
|
-
(0, _reactNativeReanimated.set)(drawerOldGestureState, _reactNativeGestureHandler.State.END), (0, _reactNativeReanimated.set)(handleOldGestureState, _reactNativeGestureHandler.State.END),
|
|
274
|
-
// By forcing that frameTime exceeds duration, it has the effect of stopping the animation
|
|
275
|
-
(0, _reactNativeReanimated.set)(this.animationFrameTime, (0, _reactNativeReanimated.add)(animationDuration, 1000)), (0, _reactNativeReanimated.set)(this.velocityY, 0), (0, _reactNativeReanimated.stopClock)(this.animationClock), this.prevTranslateYOffset], (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.or)(this.didGestureFinish, this.isManuallySetValue, (0, _reactNativeReanimated.clockRunning)(this.animationClock)), [runAnimation({
|
|
276
|
-
clock: this.animationClock,
|
|
277
|
-
from: (0, _reactNativeReanimated.cond)(this.isManuallySetValue, this.prevTranslateYOffset, (0, _reactNativeReanimated.add)(this.prevTranslateYOffset, this.translationY)),
|
|
278
|
-
to: this.destSnapPoint,
|
|
279
|
-
position: this.animationPosition,
|
|
280
|
-
finished: this.animationFinished,
|
|
281
|
-
frameTime: this.animationFrameTime,
|
|
282
|
-
velocity: this.velocityY
|
|
283
|
-
})], [(0, _reactNativeReanimated.set)(this.animationFrameTime, 0), (0, _reactNativeReanimated.set)(this.animationFinished, 0),
|
|
284
|
-
// @ts-ignore
|
|
285
|
-
this.prevTranslateYOffset]));
|
|
286
|
-
this.translateY = interpolate((0, _reactNativeReanimated.add)(translateYOffset, this.dragY, (0, _reactNativeReanimated.multiply)(scrollY, -1)), {
|
|
287
|
-
inputRange: [openPosition, closedPosition],
|
|
288
|
-
outputRange: [openPosition, closedPosition],
|
|
289
|
-
extrapolate: _reactNativeReanimated.Extrapolate.CLAMP
|
|
290
|
-
});
|
|
291
|
-
this.position = interpolate(this.translateY, {
|
|
292
|
-
inputRange: [openPosition, _snapPoints[_snapPoints.length - 1]],
|
|
293
|
-
outputRange: [1, 0],
|
|
294
|
-
extrapolate: _reactNativeReanimated.Extrapolate.CLAMP
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
render() {
|
|
298
|
-
const {
|
|
299
|
-
renderHandle,
|
|
300
|
-
initialSnapIndex,
|
|
301
|
-
containerStyle,
|
|
302
|
-
...rest
|
|
303
|
-
} = this.props;
|
|
304
|
-
const AnimatedScrollableComponent = this.scrollComponent;
|
|
305
|
-
const normalisedSnapPoints = this.getNormalisedSnapPoints();
|
|
306
|
-
const initialSnap = normalisedSnapPoints[initialSnapIndex];
|
|
307
|
-
const Content = /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
308
|
-
style: [_reactNative.StyleSheet.absoluteFillObject, containerStyle,
|
|
309
|
-
// @ts-ignore
|
|
310
|
-
{
|
|
311
|
-
transform: [{
|
|
312
|
-
translateY: this.translateY
|
|
313
|
-
}]
|
|
314
|
-
}]
|
|
315
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.PanGestureHandler, {
|
|
316
|
-
ref: this.drawerHandleRef,
|
|
317
|
-
shouldCancelWhenOutside: false,
|
|
318
|
-
simultaneousHandlers: this.masterDrawer,
|
|
319
|
-
onGestureEvent: this.onHandleGestureEvent,
|
|
320
|
-
onHandlerStateChange: this.onHandleGestureEvent
|
|
321
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, null, renderHandle())), /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.PanGestureHandler, {
|
|
322
|
-
ref: this.drawerContentRef,
|
|
323
|
-
simultaneousHandlers: [this.scrollComponentRef, this.masterDrawer],
|
|
324
|
-
shouldCancelWhenOutside: false,
|
|
325
|
-
onGestureEvent: this.onDrawerGestureEvent,
|
|
326
|
-
onHandlerStateChange: this.onDrawerGestureEvent
|
|
327
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
328
|
-
style: styles.container
|
|
329
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.NativeViewGestureHandler, {
|
|
330
|
-
ref: this.scrollComponentRef,
|
|
331
|
-
waitFor: this.masterDrawer,
|
|
332
|
-
simultaneousHandlers: this.drawerContentRef
|
|
333
|
-
}, /*#__PURE__*/_react.default.createElement(AnimatedScrollableComponent, _extends({
|
|
334
|
-
overScrollMode: "never",
|
|
335
|
-
bounces: false
|
|
336
|
-
}, rest, {
|
|
337
|
-
ref: this.props.innerRef
|
|
338
|
-
// @ts-ignore
|
|
339
|
-
,
|
|
340
|
-
decelerationRate: this.decelerationRate,
|
|
341
|
-
onScrollBeginDrag: this.onScrollBeginDrag,
|
|
342
|
-
scrollEventThrottle: 1,
|
|
343
|
-
contentContainerStyle: [rest.contentContainerStyle, {
|
|
344
|
-
paddingBottom: this.getNormalisedSnapPoints()[0]
|
|
345
|
-
}]
|
|
346
|
-
}))))), this.props.animatedPosition && /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.Code, {
|
|
347
|
-
exec: (0, _reactNativeReanimated.onChange)(this.position, (0, _reactNativeReanimated.set)(this.props.animatedPosition, this.position))
|
|
348
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.Code, {
|
|
349
|
-
exec: (0, _reactNativeReanimated.onChange)(this.dragY, (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.not)((0, _reactNativeReanimated.eq)(this.dragY, 0)), (0, _reactNativeReanimated.set)(this.prevDragY, this.dragY)))
|
|
350
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.Code, {
|
|
351
|
-
exec: (0, _reactNativeReanimated.onChange)(this.didGestureFinish, (0, _reactNativeReanimated.cond)(this.didGestureFinish, [this.didScrollUpAndPullDown, this.setTranslationY, (0, _reactNativeReanimated.set)(this.tempDestSnapPoint, (0, _reactNativeReanimated.add)(normalisedSnapPoints[0], this.extraOffset)), (0, _reactNativeReanimated.set)(this.nextSnapIndex, 0), (0, _reactNativeReanimated.set)(this.destSnapPoint, this.calculateNextSnapPoint()), (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.and)((0, _reactNativeReanimated.greaterThan)(this.dragY, this.lastStartScrollY), this.isAndroid, (0, _reactNativeReanimated.not)(this.dragWithHandle)), (0, _reactNativeReanimated.call)([], () => {
|
|
352
|
-
var _this$props2, _this$props2$data;
|
|
353
|
-
// This prevents the scroll glide from happening on Android when pulling down with inertia.
|
|
354
|
-
// It's not perfect, but does the job for now
|
|
355
|
-
const {
|
|
356
|
-
method,
|
|
357
|
-
args
|
|
358
|
-
} = imperativeScrollOptions[this.props.componentType];
|
|
359
|
-
// @ts-ignore
|
|
360
|
-
const node = this.props.innerRef.current;
|
|
361
|
-
if (node && node[method] && (this.props.componentType === "FlatList" && (((_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$data = _this$props2.data) === null || _this$props2$data === void 0 ? void 0 : _this$props2$data.length) || 0) > 0 || this.props.componentType === "SectionList" && this.props.sections.length > 0 || this.props.componentType === "ScrollView")) {
|
|
362
|
-
node[method](args);
|
|
363
|
-
}
|
|
364
|
-
})), (0, _reactNativeReanimated.set)(this.dragY, 0), (0, _reactNativeReanimated.set)(this.velocityY, 0), (0, _reactNativeReanimated.set)(this.lastSnap, (0, _reactNativeReanimated.sub)(this.destSnapPoint, (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(this.scrollUpAndPullDown, 1), this.lastStartScrollY, 0))), (0, _reactNativeReanimated.call)([this.lastSnap], _ref3 => {
|
|
365
|
-
var _this$masterDrawer, _this$masterDrawer$cu;
|
|
366
|
-
let [value] = _ref3;
|
|
367
|
-
// This is the TapGHandler trick
|
|
368
|
-
// @ts-ignore
|
|
369
|
-
(_this$masterDrawer = this.masterDrawer) === null || _this$masterDrawer === void 0 ? void 0 : (_this$masterDrawer$cu = _this$masterDrawer.current) === null || _this$masterDrawer$cu === void 0 ? void 0 : _this$masterDrawer$cu.setNativeProps({
|
|
370
|
-
maxDeltaY: value - this.getNormalisedSnapPoints()[0]
|
|
371
|
-
});
|
|
372
|
-
}), (0, _reactNativeReanimated.set)(this.decelerationRate, (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(this.isAndroid, 1), (0, _reactNativeReanimated.cond)((0, _reactNativeReanimated.eq)(this.lastSnap, normalisedSnapPoints[0]), ANDROID_NORMAL_DECELERATION_RATE, 0), IOS_NORMAL_DECELERATION_RATE))]))
|
|
373
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.Code, {
|
|
374
|
-
exec: (0, _reactNativeReanimated.onChange)(this.isManuallySetValue, [(0, _reactNativeReanimated.cond)(this.isManuallySetValue, [(0, _reactNativeReanimated.set)(this.destSnapPoint, this.manualYOffset), (0, _reactNativeReanimated.set)(this.animationFinished, 0), (0, _reactNativeReanimated.set)(this.lastSnap, this.manualYOffset), (0, _reactNativeReanimated.call)([this.lastSnap], _ref4 => {
|
|
375
|
-
var _this$masterDrawer2, _this$masterDrawer2$c;
|
|
376
|
-
let [value] = _ref4;
|
|
377
|
-
// This is the TapGHandler trick
|
|
378
|
-
// @ts-ignore
|
|
379
|
-
(_this$masterDrawer2 = this.masterDrawer) === null || _this$masterDrawer2 === void 0 ? void 0 : (_this$masterDrawer2$c = _this$masterDrawer2.current) === null || _this$masterDrawer2$c === void 0 ? void 0 : _this$masterDrawer2$c.setNativeProps({
|
|
380
|
-
maxDeltaY: value - this.getNormalisedSnapPoints()[0]
|
|
381
|
-
});
|
|
382
|
-
})], [(0, _reactNativeReanimated.set)(this.nextSnapIndex, 0)])])
|
|
383
|
-
}));
|
|
384
|
-
|
|
385
|
-
// On Android, having an intermediary view with pointerEvents="box-none", breaks the
|
|
386
|
-
// waitFor logic
|
|
387
|
-
if (_reactNative.Platform.OS === "android") {
|
|
388
|
-
return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.TapGestureHandler, {
|
|
389
|
-
maxDurationMs: 100000,
|
|
390
|
-
ref: this.masterDrawer,
|
|
391
|
-
maxDeltaY: initialSnap - this.getNormalisedSnapPoints()[0],
|
|
392
|
-
shouldCancelWhenOutside: false
|
|
393
|
-
}, Content);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
// On iOS, We need to wrap the content on a view with PointerEvents box-none
|
|
397
|
-
// So that we can start scrolling automatically when reaching the top without
|
|
398
|
-
// Stopping the gesture
|
|
399
|
-
return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.TapGestureHandler, {
|
|
400
|
-
maxDurationMs: 100000,
|
|
401
|
-
ref: this.masterDrawer,
|
|
402
|
-
maxDeltaY: initialSnap - this.getNormalisedSnapPoints()[0]
|
|
403
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
404
|
-
style: _reactNative.StyleSheet.absoluteFillObject,
|
|
405
|
-
pointerEvents: "box-none"
|
|
406
|
-
}, Content));
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
exports.ScrollBottomSheet = ScrollBottomSheet;
|
|
410
|
-
_defineProperty(ScrollBottomSheet, "defaultProps", {
|
|
411
|
-
topInset: 0,
|
|
412
|
-
friction: 0.95,
|
|
413
|
-
animationType: "timing",
|
|
414
|
-
innerRef: /*#__PURE__*/_react.default.createRef(),
|
|
415
|
-
enableOverScroll: false
|
|
416
|
-
});
|
|
417
|
-
var _default = ScrollBottomSheet;
|
|
418
|
-
exports.default = _default;
|
|
419
|
-
const styles = _reactNative.StyleSheet.create({
|
|
420
|
-
container: {
|
|
421
|
-
flex: 1
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
//# sourceMappingURL=BottomSheetComponent.js.map
|