@draftbit/core 46.11.1-c64d65.2 → 46.11.1-d3b79d.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/Accordion/index.js.map +1 -1
- package/lib/commonjs/components/ActionSheet/ActionSheetItem.js.map +1 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +89 -0
- package/lib/commonjs/components/BottomSheet/BottomSheet.js.map +1 -0
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +424 -0
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js.map +1 -0
- package/lib/commonjs/components/BottomSheet/index.js +14 -0
- package/lib/commonjs/components/BottomSheet/index.js.map +1 -0
- package/lib/commonjs/components/Checkbox/CheckboxGroup.js +16 -3
- package/lib/commonjs/components/Checkbox/CheckboxGroup.js.map +1 -1
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +22 -5
- 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/CircleImage.js +16 -2
- package/lib/commonjs/components/CircleImage.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +9 -13
- package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +16 -10
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +21 -4
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +14 -2
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RowBodyIcon.js.map +1 -1
- package/lib/commonjs/components/StepIndicator.js +18 -57
- package/lib/commonjs/components/Swiper/SwiperItem.js.map +1 -1
- package/lib/commonjs/components/TabView/TabView.js +8 -15
- package/lib/commonjs/components/TabView/TabView.js.map +1 -1
- package/lib/commonjs/components/useAuthState.js.map +1 -1
- package/lib/commonjs/hooks.js +1 -3
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/Icon.js.map +1 -1
- package/lib/commonjs/mappings/CardBlock.js.map +1 -1
- package/lib/commonjs/mappings/CardContainerRating.js.map +1 -1
- package/lib/commonjs/mappings/CardContainerShortImage.js.map +1 -1
- package/lib/commonjs/mappings/CircleImage.js.map +1 -1
- package/lib/commonjs/mappings/Container.js.map +1 -1
- package/lib/commonjs/mappings/Divider.js.map +1 -1
- package/lib/commonjs/mappings/FieldSearchBarFull.js +1 -1
- package/lib/commonjs/mappings/FieldSearchBarFull.js.map +1 -1
- package/lib/commonjs/mappings/Layout.js.map +1 -1
- package/lib/commonjs/mappings/RowBodyIcon.js.map +1 -1
- package/lib/commonjs/mappings/StarRating.js +6 -2
- package/lib/commonjs/mappings/StarRating.js.map +1 -1
- package/lib/commonjs/mappings/TextInput.js.map +1 -1
- package/lib/commonjs/mappings/ToggleButton.js.map +1 -1
- package/lib/module/components/ActionSheet/ActionSheetCancel.js.map +1 -1
- package/lib/module/components/Banner.js +4 -23
- package/lib/module/components/Banner.js.map +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.js +81 -0
- package/lib/module/components/BottomSheet/BottomSheet.js.map +1 -0
- package/lib/module/components/BottomSheet/BottomSheetComponent.js +430 -0
- package/lib/module/components/BottomSheet/BottomSheetComponent.js.map +1 -0
- package/{src/components/BottomSheet/index.ts.tmp → lib/module/components/BottomSheet/index.js} +1 -0
- package/lib/module/components/BottomSheet/index.js.map +1 -0
- package/lib/module/components/Card.js.map +1 -1
- package/lib/module/components/CircleImage.js +1 -15
- package/lib/module/components/CircleImage.js.map +1 -1
- package/lib/module/components/Container.js +4 -16
- package/lib/module/components/Container.js.map +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +13 -9
- 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/Picker.js +13 -4
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +3 -21
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/module/components/Portal/PortalHost.js +14 -44
- 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 +5 -23
- 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/TabView/TabView.js +1 -1
- package/lib/module/components/TabView/TabView.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 +1 -0
- 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/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/components/BottomSheet/BottomSheet.d.ts +20 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +170 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/BottomSheet/index.d.ts +2 -0
- package/lib/typescript/src/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/components/BottomSheet/BottomSheet.js +56 -0
- package/src/components/BottomSheet/BottomSheetComponent.js +437 -0
- package/src/components/Picker/Picker.js +16 -4
- package/src/components/Picker/Picker.tsx +25 -5
- package/src/components/TabView/TabView.js +1 -1
- package/src/components/TabView/TabView.tsx +1 -1
- package/src/index.js +1 -0
- package/src/index.tsx +2 -0
- package/lib/module/components/BottomSheet/BottomSheet.tsx.tmp +0 -120
- package/lib/module/components/BottomSheet/BottomSheetComponent.tsx.tmp +0 -895
- package/src/components/BottomSheet/BottomSheet.tsx.tmp +0 -120
- package/src/components/BottomSheet/BottomSheetComponent.tsx.tmp +0 -895
- /package/{lib/commonjs/components/BottomSheet/BottomSheet.tsx.tmp → src/components/BottomSheet/BottomSheet.tsx} +0 -0
- /package/{lib/commonjs/components/BottomSheet/BottomSheetComponent.tsx.tmp → src/components/BottomSheet/BottomSheetComponent.tsx} +0 -0
- /package/{lib/commonjs/components/BottomSheet/index.ts.tmp → src/components/BottomSheet/index.js} +0 -0
- /package/{lib/module/components/BottomSheet/index.ts.tmp → src/components/BottomSheet/index.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","deprecated","stylesPanelSections","StylesPanelSections","Margins","Effects","Position","layout","triggers","Triggers","OnPress","props","onPress","createActionProp","icon","createIconProp","required","iconSize","createIconSizeProp","fieldName","createFieldNameProp","defaultValue","valuePropName","disabled","createBoolProp","label","description","group","GROUPS","basic","color","createColorProp","colorSecondary","borderColor","width","createStaticNumberProp","height"],"sourceRoot":"../../../src","sources":["mappings/ToggleButton.
|
|
1
|
+
{"version":3,"names":["SEED_DATA","name","tag","category","COMPONENT_TYPES","deprecated","stylesPanelSections","StylesPanelSections","Margins","Effects","Position","layout","triggers","Triggers","OnPress","props","onPress","createActionProp","icon","createIconProp","required","iconSize","createIconSizeProp","fieldName","createFieldNameProp","defaultValue","valuePropName","disabled","createBoolProp","label","description","group","GROUPS","basic","color","createColorProp","colorSecondary","borderColor","width","createStaticNumberProp","height"],"sourceRoot":"../../../src","sources":["mappings/ToggleButton.js"],"mappings":";;;;;;AAAA;AACO,MAAMA,SAAS,GAAG;EACrBC,IAAI,EAAE,eAAe;EACrBC,GAAG,EAAE,cAAc;EACnBC,QAAQ,EAAEC,sBAAe,CAACC,UAAU;EACpCC,mBAAmB,EAAE,CACjBC,0BAAmB,CAACC,OAAO,EAC3BD,0BAAmB,CAACE,OAAO,EAC3BF,0BAAmB,CAACG,QAAQ,CAC/B;EACDC,MAAM,EAAE,CAAC,CAAC;EACVC,QAAQ,EAAE,CAACC,eAAQ,CAACC,OAAO,CAAC;EAC5BC,KAAK,EAAE;IACHC,OAAO,EAAE,IAAAC,uBAAgB,GAAE;IAC3BC,IAAI,EAAE,IAAAC,qBAAc,EAAC;MACjBC,QAAQ,EAAE;IACd,CAAC,CAAC;IACFC,QAAQ,EAAE,IAAAC,yBAAkB,GAAE;IAC9BC,SAAS,EAAE,IAAAC,0BAAmB,EAAC;MAC3BC,YAAY,EAAE,KAAK;MACnBC,aAAa,EAAE;IACnB,CAAC,CAAC;IACFC,QAAQ,EAAE,IAAAC,qBAAc,EAAC;MACrBC,KAAK,EAAE,UAAU;MACjBC,WAAW,EAAE,uCAAuC;MACpDC,KAAK,EAAEC,aAAM,CAACC;IAClB,CAAC,CAAC;IACFC,KAAK,EAAE,IAAAC,sBAAe,EAAC;MACnBJ,KAAK,EAAEC,aAAM,CAACC;IAClB,CAAC,CAAC;IACFG,cAAc,EAAE,IAAAD,sBAAe,EAAC;MAC5BN,KAAK,EAAE,iBAAiB;MACxBE,KAAK,EAAEC,aAAM,CAACC;IAClB,CAAC,CAAC;IACFI,WAAW,EAAE,IAAAF,sBAAe,EAAC;MACzBN,KAAK,EAAE,cAAc;MACrBE,KAAK,EAAEC,aAAM,CAACC;IAClB,CAAC,CAAC;IACFK,KAAK,EAAE,IAAAC,6BAAsB,EAAC;MAC1BV,KAAK,EAAE,OAAO;MACdC,WAAW,EAAE,OAAO;MACpBL,YAAY,EAAE;IAClB,CAAC,CAAC;IACFe,MAAM,EAAE,IAAAD,6BAAsB,EAAC;MAC3BV,KAAK,EAAE,QAAQ;MACfC,WAAW,EAAE,QAAQ;MACrBL,YAAY,EAAE;IAClB,CAAC;EACL;AACJ,CAAC;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ActionSheetItem","ActionSheetCancel","label","color","style","onPress"
|
|
1
|
+
{"version":3,"names":["React","ActionSheetItem","ActionSheetCancel","label","color","style","onPress"],"sourceRoot":"../../../../src","sources":["components/ActionSheet/ActionSheetCancel.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,eAAe,MAAM,mBAAmB;AAS/C,MAAMC,iBAA2D,GAAG,QAK9D;EAAA,IAL+D;IACnEC,KAAK,GAAG,QAAQ;IAChBC,KAAK;IACLC,KAAK;IACLC;EACF,CAAC;EACC,oBACE,oBAAC,eAAe;IACd,KAAK,EAAEH,KAAM;IACb,KAAK,EAAEC,KAAK,IAAI,SAAU;IAC1B,KAAK,EAAE,CAACC,KAAK,CAAE;IACf,OAAO,EAAEC;EAAQ,EACjB;AAEN,CAAC;AAED,eAAeJ,iBAAiB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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); }
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { Button, Text, View, StyleSheet, Animated } from "react-native";
|
|
3
4
|
import Surface from "./Surface";
|
|
@@ -60,6 +61,7 @@ const Banner = _ref => {
|
|
|
60
61
|
measured: true
|
|
61
62
|
});
|
|
62
63
|
};
|
|
64
|
+
|
|
63
65
|
// The banner animation has 2 parts:
|
|
64
66
|
// 1. Blank spacer element which animates its height to move the content
|
|
65
67
|
// 2. Actual banner which animates its translateY
|
|
@@ -69,10 +71,9 @@ const Banner = _ref => {
|
|
|
69
71
|
// However we can't animated banner's height directly as it'll also resize the content inside
|
|
70
72
|
const height = Animated.multiply(position, layout.height);
|
|
71
73
|
const translateY = Animated.multiply(Animated.add(position, -1), layout.height);
|
|
72
|
-
return /*#__PURE__*/React.createElement(Surface, {
|
|
73
|
-
...rest,
|
|
74
|
+
return /*#__PURE__*/React.createElement(Surface, _extends({}, rest, {
|
|
74
75
|
style: [styles.container, shadow(ELEVATION), style]
|
|
75
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
76
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
76
77
|
style: [styles.wrapper, contentStyle]
|
|
77
78
|
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
78
79
|
style: {
|
|
@@ -154,24 +155,4 @@ const styles = StyleSheet.create({
|
|
|
154
155
|
}
|
|
155
156
|
});
|
|
156
157
|
export default withTheme(Banner);
|
|
157
|
-
//# sourceMappingURL=Banner.js.mapn: "row",
|
|
158
|
-
justifyContent: "flex-start",
|
|
159
|
-
marginHorizontal: 8,
|
|
160
|
-
marginTop: 16,
|
|
161
|
-
marginBottom: 0
|
|
162
|
-
},
|
|
163
|
-
icon: {
|
|
164
|
-
margin: 8
|
|
165
|
-
},
|
|
166
|
-
message: {
|
|
167
|
-
flex: 1,
|
|
168
|
-
margin: 8
|
|
169
|
-
},
|
|
170
|
-
actions: {
|
|
171
|
-
flexDirection: "row",
|
|
172
|
-
justifyContent: "flex-end",
|
|
173
|
-
margin: 8
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
export default withTheme(Banner);
|
|
177
158
|
//# sourceMappingURL=Banner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Button","Text","View","StyleSheet","Animated","Surface","shadow","withTheme","ELEVATION","DEFAULT_MAX_WIDTH","Banner","initiallyVisible","dismissable","icon","buttonColor","content","contentStyle","style","theme","Icon","rest","visible","setVisible","useState","useEffect","current","position","useRef","Value","layout","setLayout","height","measured","timing","duration","toValue","useNativeDriver","start","handleLayout","nativeEvent","multiply","translateY","add","
|
|
1
|
+
{"version":3,"names":["React","Button","Text","View","StyleSheet","Animated","Surface","shadow","withTheme","ELEVATION","DEFAULT_MAX_WIDTH","Banner","initiallyVisible","dismissable","icon","buttonColor","content","contentStyle","style","theme","Icon","rest","visible","setVisible","useState","useEffect","current","position","useRef","Value","layout","setLayout","height","measured","timing","duration","toValue","useNativeDriver","start","handleLayout","nativeEvent","multiply","translateY","add","styles","container","wrapper","absolute","transform","opacity","marginBottom","message","color","colors","text","actions","primary","create","elevation","overflow","alignSelf","width","maxWidth","top","flexDirection","justifyContent","marginHorizontal","marginTop","margin","flex"],"sourceRoot":"../../../src","sources":["components/Banner.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,MAAM,EACNC,IAAI,EACJC,IAAI,EAEJC,UAAU,EAEVC,QAAQ,QACH,cAAc;AACrB,OAAOC,OAAO,MAAM,WAAW;AAE/B,OAAOC,MAAM,MAAM,kBAAkB;AACrC,SAASC,SAAS,QAAQ,YAAY;AAGtC,MAAMC,SAAS,GAAG,CAAC;AACnB,MAAMC,iBAAiB,GAAG,GAAG;AA4B7B,MAAMC,MAAgD,GAAG,QAWnD;EAAA,IAXoD;IACxDC,gBAAgB,GAAG,IAAI;IACvBC,WAAW,GAAG,IAAI;IAClBC,IAAI;IACJC,WAAW;IACXC,OAAO;IACPC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,IAAI;IACJ,GAAGC;EACL,CAAC;EACC,MAAM,CAACC,OAAO,EAAEC,UAAU,C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 -0,0 +1,81 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { StyleSheet, View } from "react-native";
|
|
4
|
+
import BottomSheetComponent from "./BottomSheetComponent";
|
|
5
|
+
import { withTheme } from "../../theming";
|
|
6
|
+
const BottomSheet = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
theme,
|
|
9
|
+
snapPoints = ["10%", "50%", "80%"],
|
|
10
|
+
initialSnapIndex = 0,
|
|
11
|
+
showHandle = true,
|
|
12
|
+
handleColor = theme.colors.divider,
|
|
13
|
+
topBorderRadius = 20,
|
|
14
|
+
borderWidth = 1,
|
|
15
|
+
borderColor = theme.colors.divider,
|
|
16
|
+
onSettle,
|
|
17
|
+
style,
|
|
18
|
+
children,
|
|
19
|
+
...rest
|
|
20
|
+
} = _ref;
|
|
21
|
+
const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background;
|
|
22
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
23
|
+
style: styles.parentContainer,
|
|
24
|
+
pointerEvents: "box-none"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(BottomSheetComponent, _extends({
|
|
26
|
+
componentType: "ScrollView",
|
|
27
|
+
snapPoints: snapPoints,
|
|
28
|
+
initialSnapIndex: initialSnapIndex,
|
|
29
|
+
renderHandle: () => /*#__PURE__*/React.createElement(React.Fragment, null, showHandle && /*#__PURE__*/React.createElement(View, {
|
|
30
|
+
style: [styles.handleContainer, {
|
|
31
|
+
backgroundColor,
|
|
32
|
+
borderTopLeftRadius: topBorderRadius,
|
|
33
|
+
borderTopRightRadius: topBorderRadius
|
|
34
|
+
}]
|
|
35
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
36
|
+
style: [styles.handle, {
|
|
37
|
+
backgroundColor: handleColor
|
|
38
|
+
}]
|
|
39
|
+
}))),
|
|
40
|
+
contentContainerStyle: [styles.contentContainerStyle, style],
|
|
41
|
+
containerStyle: StyleSheet.flatten([styles.containerStyle, {
|
|
42
|
+
backgroundColor,
|
|
43
|
+
borderTopLeftRadius: topBorderRadius,
|
|
44
|
+
borderTopRightRadius: topBorderRadius,
|
|
45
|
+
borderWidth,
|
|
46
|
+
borderColor
|
|
47
|
+
}]),
|
|
48
|
+
onSettle: onSettle
|
|
49
|
+
}, rest), children));
|
|
50
|
+
};
|
|
51
|
+
const styles = StyleSheet.create({
|
|
52
|
+
//Render on top of everything
|
|
53
|
+
parentContainer: {
|
|
54
|
+
position: "absolute",
|
|
55
|
+
left: 0,
|
|
56
|
+
right: 0,
|
|
57
|
+
top: 0,
|
|
58
|
+
bottom: 0,
|
|
59
|
+
zIndex: 10,
|
|
60
|
+
overflow: "hidden"
|
|
61
|
+
},
|
|
62
|
+
contentContainerStyle: {
|
|
63
|
+
paddingHorizontal: 16,
|
|
64
|
+
paddingVertical: 10
|
|
65
|
+
},
|
|
66
|
+
containerStyle: {
|
|
67
|
+
flex: 1,
|
|
68
|
+
overflow: "hidden"
|
|
69
|
+
},
|
|
70
|
+
handleContainer: {
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
paddingVertical: 20
|
|
73
|
+
},
|
|
74
|
+
handle: {
|
|
75
|
+
width: 40,
|
|
76
|
+
height: 2,
|
|
77
|
+
borderRadius: 4
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
export default withTheme(BottomSheet);
|
|
81
|
+
//# sourceMappingURL=BottomSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","BottomSheetComponent","withTheme","BottomSheet","theme","snapPoints","initialSnapIndex","showHandle","handleColor","colors","divider","topBorderRadius","borderWidth","borderColor","onSettle","style","children","rest","backgroundColor","background","styles","parentContainer","handleContainer","borderTopLeftRadius","borderTopRightRadius","handle","contentContainerStyle","flatten","containerStyle","create","position","left","right","top","bottom","zIndex","overflow","paddingHorizontal","paddingVertical","flex","alignItems","width","height","borderRadius"],"sourceRoot":"../../../../src","sources":["components/BottomSheet/BottomSheet.tsx"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,UAAU,EACVC,IAAI,QAIC,cAAc;AAErB,OAAOC,oBAAoB,MAAM,wBAAwB;AAEzD,SAASC,SAAS,QAAQ,eAAe;AAezC,MAAMC,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,oBAAC,IAAI;IAAC,KAAK,EAAEC,MAAM,CAACC,eAAgB;IAAC,aAAa,EAAC;EAAU,gBAC3D,oBAAC,oBAAoB;IACnB,aAAa,EAAC,YAAY;IAC1B,UAAU,EAAEhB,UAAW;IACvB,gBAAgB,EAAEC,gBAAiB;IACnC,YAAY,EAAE,mBACZ,0CACGC,UAAU,iBACT,oBAAC,IAAI;MACH,KAAK,EAAE,CACLa,MAAM,CAACE,eAAe,EACtB;QACEJ,eAAe;QACfK,mBAAmB,EAAEZ,eAAe;QACpCa,oBAAoB,EAAEb;MACxB,CAAC;IACD,gBAEF,oBAAC,IAAI;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,EAAEhB,UAAU,CAAC4B,OAAO,CAAC,CACjCP,MAAM,CAACQ,cAAc,EACrB;MACEV,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,GAAGrB,UAAU,CAAC8B,MAAM,CAAC;EAC/B;EACAR,eAAe,EAAE;IACfS,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;EACDV,qBAAqB,EAAE;IACrBW,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE;EACnB,CAAC;EACDV,cAAc,EAAE;IACdW,IAAI,EAAE,CAAC;IACPH,QAAQ,EAAE;EACZ,CAAC;EACDd,eAAe,EAAE;IACfkB,UAAU,EAAE,QAAQ;IACpBF,eAAe,EAAE;EACnB,CAAC;EACDb,MAAM,EAAE;IACNgB,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,eAAezC,SAAS,CAACC,WAAW,CAAC"}
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
|
+
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); }
|
|
5
|
+
/**
|
|
6
|
+
* Slightly modfied version as taken from https://github.com/rgommezz/react-native-scroll-bottom-sheet
|
|
7
|
+
* Main previously breaking change:
|
|
8
|
+
* const node = this.props.innerRef.current?.getNode() ==> const node = this.props.innerRef.current as any
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Copyright (c) 2020 Raul Gomez Acuna
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import React, { Component } from "react";
|
|
20
|
+
import { Dimensions, FlatList, Platform, ScrollView, SectionList, StyleSheet, View } from "react-native";
|
|
21
|
+
import Animated, { abs, add, and, call, Clock, clockRunning, cond, Easing as EasingDeprecated,
|
|
22
|
+
// @ts-ignore: this property is only present in Reanimated 2
|
|
23
|
+
EasingNode, eq, event, Extrapolate, greaterOrEq, greaterThan, multiply, not, onChange, or, set, startClock, stopClock, sub, spring, timing, Value } from "react-native-reanimated";
|
|
24
|
+
import { NativeViewGestureHandler, PanGestureHandler, State as GestureState, TapGestureHandler } from "react-native-gesture-handler";
|
|
25
|
+
const {
|
|
26
|
+
//@ts-ignore
|
|
27
|
+
interpolate: interpolateDeprecated,
|
|
28
|
+
// @ts-ignore: this property is only present in Reanimated 2
|
|
29
|
+
interpolateNode
|
|
30
|
+
} = Animated;
|
|
31
|
+
const interpolate = interpolateNode !== null && interpolateNode !== void 0 ? interpolateNode : interpolateDeprecated;
|
|
32
|
+
//@ts-ignore
|
|
33
|
+
const Easing = EasingNode !== null && EasingNode !== void 0 ? EasingNode : EasingDeprecated;
|
|
34
|
+
const FlatListComponentType = "FlatList";
|
|
35
|
+
const ScrollViewComponentType = "ScrollView";
|
|
36
|
+
const SectionListComponentType = "SectionList";
|
|
37
|
+
const TimingAnimationType = "timing";
|
|
38
|
+
const SpringAnimationType = "spring";
|
|
39
|
+
const DEFAULT_SPRING_PARAMS = {
|
|
40
|
+
damping: 50,
|
|
41
|
+
mass: 0.3,
|
|
42
|
+
stiffness: 121.6,
|
|
43
|
+
overshootClamping: true,
|
|
44
|
+
restSpeedThreshold: 0.3,
|
|
45
|
+
restDisplacementThreshold: 0.3
|
|
46
|
+
};
|
|
47
|
+
const {
|
|
48
|
+
height: windowHeight
|
|
49
|
+
} = Dimensions.get("window");
|
|
50
|
+
const IOS_NORMAL_DECELERATION_RATE = 0.998;
|
|
51
|
+
const ANDROID_NORMAL_DECELERATION_RATE = 0.985;
|
|
52
|
+
const DEFAULT_ANIMATION_DURATION = 250;
|
|
53
|
+
const DEFAULT_EASING = Easing.inOut(Easing.linear);
|
|
54
|
+
const imperativeScrollOptions = {
|
|
55
|
+
[FlatListComponentType]: {
|
|
56
|
+
method: "scrollToIndex",
|
|
57
|
+
args: {
|
|
58
|
+
index: 0,
|
|
59
|
+
viewPosition: 0,
|
|
60
|
+
viewOffset: 1000,
|
|
61
|
+
animated: true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[ScrollViewComponentType]: {
|
|
65
|
+
method: "scrollTo",
|
|
66
|
+
args: {
|
|
67
|
+
x: 0,
|
|
68
|
+
y: 0,
|
|
69
|
+
animated: true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
[SectionListComponentType]: {
|
|
73
|
+
method: "scrollToLocation",
|
|
74
|
+
args: {
|
|
75
|
+
itemIndex: 0,
|
|
76
|
+
sectionIndex: 0,
|
|
77
|
+
viewPosition: 0,
|
|
78
|
+
viewOffset: 1000,
|
|
79
|
+
animated: true
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
export class ScrollBottomSheet extends Component {
|
|
84
|
+
/**
|
|
85
|
+
* Gesture Handler references
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Flag to indicate imperative snapping
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Manual snapping amount
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
constructor(props) {
|
|
97
|
+
var _props$animationConfi, _this;
|
|
98
|
+
super(props);
|
|
99
|
+
_this = this;
|
|
100
|
+
_defineProperty(this, "masterDrawer", /*#__PURE__*/React.createRef());
|
|
101
|
+
_defineProperty(this, "drawerHandleRef", /*#__PURE__*/React.createRef());
|
|
102
|
+
_defineProperty(this, "drawerContentRef", /*#__PURE__*/React.createRef());
|
|
103
|
+
_defineProperty(this, "scrollComponentRef", /*#__PURE__*/React.createRef());
|
|
104
|
+
_defineProperty(this, "isManuallySetValue", new Value(0));
|
|
105
|
+
_defineProperty(this, "manualYOffset", new Value(0));
|
|
106
|
+
_defineProperty(this, "prevSnapIndex", -1);
|
|
107
|
+
_defineProperty(this, "dragY", new Value(0));
|
|
108
|
+
_defineProperty(this, "prevDragY", new Value(0));
|
|
109
|
+
_defineProperty(this, "tempDestSnapPoint", new Value(0));
|
|
110
|
+
_defineProperty(this, "isAndroid", new Value(Number(Platform.OS === "android")));
|
|
111
|
+
_defineProperty(this, "animationClock", new Clock());
|
|
112
|
+
_defineProperty(this, "animationPosition", new Value(0));
|
|
113
|
+
_defineProperty(this, "animationFinished", new Value(0));
|
|
114
|
+
_defineProperty(this, "animationFrameTime", new Value(0));
|
|
115
|
+
_defineProperty(this, "velocityY", new Value(0));
|
|
116
|
+
_defineProperty(this, "lastStartScrollY", new Value(0));
|
|
117
|
+
_defineProperty(this, "destSnapPoint", new Value(0));
|
|
118
|
+
_defineProperty(this, "dragWithHandle", new Value(0));
|
|
119
|
+
_defineProperty(this, "scrollUpAndPullDown", new Value(0));
|
|
120
|
+
_defineProperty(this, "convertPercentageToDp", str => Number(str.split("%")[0]) * (windowHeight - this.props.topInset) / 100);
|
|
121
|
+
_defineProperty(this, "getNormalisedSnapPoints", () => {
|
|
122
|
+
return this.props.snapPoints.map(p => {
|
|
123
|
+
if (typeof p === "string") {
|
|
124
|
+
return this.convertPercentageToDp(p);
|
|
125
|
+
} else if (typeof p === "number") {
|
|
126
|
+
return p;
|
|
127
|
+
}
|
|
128
|
+
throw new Error("Invalid type for value ".concat(p, ": ").concat(typeof p, ". It should be either a percentage string or a number"));
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
_defineProperty(this, "getScrollComponent", () => {
|
|
132
|
+
switch (this.props.componentType) {
|
|
133
|
+
case "FlatList":
|
|
134
|
+
return FlatList;
|
|
135
|
+
case "ScrollView":
|
|
136
|
+
return ScrollView;
|
|
137
|
+
case "SectionList":
|
|
138
|
+
return SectionList;
|
|
139
|
+
default:
|
|
140
|
+
throw new Error("Component type not supported: it should be one of `FlatList`, `ScrollView` or `SectionList`");
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
_defineProperty(this, "snapTo", index => {
|
|
144
|
+
const snapPoints = this.getNormalisedSnapPoints();
|
|
145
|
+
this.isManuallySetValue.setValue(1);
|
|
146
|
+
this.manualYOffset.setValue(snapPoints[index]);
|
|
147
|
+
this.nextSnapIndex.setValue(index);
|
|
148
|
+
});
|
|
149
|
+
const {
|
|
150
|
+
initialSnapIndex,
|
|
151
|
+
animationType
|
|
152
|
+
} = props;
|
|
153
|
+
const animationDriver = animationType === "timing" ? 0 : 1;
|
|
154
|
+
const animationDuration = props.animationType === "timing" && ((_props$animationConfi = props.animationConfig) === null || _props$animationConfi === void 0 ? void 0 : _props$animationConfi.duration) || DEFAULT_ANIMATION_DURATION;
|
|
155
|
+
const ScrollComponent = this.getScrollComponent();
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
this.scrollComponent = Animated.createAnimatedComponent(ScrollComponent);
|
|
158
|
+
const _snapPoints = this.getNormalisedSnapPoints();
|
|
159
|
+
const openPosition = _snapPoints[0];
|
|
160
|
+
const closedPosition = this.props.enableOverScroll ? windowHeight : _snapPoints[_snapPoints.length - 1];
|
|
161
|
+
const initialSnap = _snapPoints[initialSnapIndex];
|
|
162
|
+
this.nextSnapIndex = new Value(initialSnapIndex);
|
|
163
|
+
const initialDecelerationRate = Platform.select({
|
|
164
|
+
android: props.initialSnapIndex === 0 ? ANDROID_NORMAL_DECELERATION_RATE : 0,
|
|
165
|
+
ios: IOS_NORMAL_DECELERATION_RATE
|
|
166
|
+
});
|
|
167
|
+
this.decelerationRate = new Value(initialDecelerationRate);
|
|
168
|
+
|
|
169
|
+
//@ts-ignore
|
|
170
|
+
const handleGestureState = new Value(-1);
|
|
171
|
+
//@ts-ignore
|
|
172
|
+
const handleOldGestureState = new Value(-1);
|
|
173
|
+
//@ts-ignore
|
|
174
|
+
const drawerGestureState = new Value(-1);
|
|
175
|
+
//@ts-ignore
|
|
176
|
+
const drawerOldGestureState = new Value(-1);
|
|
177
|
+
const lastSnapInRange = new Value(1);
|
|
178
|
+
this.prevTranslateYOffset = new Value(initialSnap);
|
|
179
|
+
this.translationY = new Value(initialSnap);
|
|
180
|
+
this.lastSnap = new Value(initialSnap);
|
|
181
|
+
this.onHandleGestureEvent = event([{
|
|
182
|
+
nativeEvent: {
|
|
183
|
+
translationY: this.dragY,
|
|
184
|
+
oldState: handleOldGestureState,
|
|
185
|
+
state: handleGestureState,
|
|
186
|
+
velocityY: this.velocityY
|
|
187
|
+
}
|
|
188
|
+
}]);
|
|
189
|
+
this.onDrawerGestureEvent = event([{
|
|
190
|
+
nativeEvent: {
|
|
191
|
+
translationY: this.dragY,
|
|
192
|
+
oldState: drawerOldGestureState,
|
|
193
|
+
state: drawerGestureState,
|
|
194
|
+
velocityY: this.velocityY
|
|
195
|
+
}
|
|
196
|
+
}]);
|
|
197
|
+
this.onScrollBeginDrag = event([{
|
|
198
|
+
nativeEvent: {
|
|
199
|
+
contentOffset: {
|
|
200
|
+
y: this.lastStartScrollY
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}]);
|
|
204
|
+
const didHandleGestureBegin = eq(handleGestureState, GestureState.ACTIVE);
|
|
205
|
+
const isAnimationInterrupted = and(or(eq(handleGestureState, GestureState.BEGAN), eq(drawerGestureState, GestureState.BEGAN), and(eq(this.isAndroid, 0), eq(animationDriver, 1), or(eq(drawerGestureState, GestureState.ACTIVE), eq(handleGestureState, GestureState.ACTIVE)))), clockRunning(this.animationClock));
|
|
206
|
+
this.didGestureFinish = or(and(eq(handleOldGestureState, GestureState.ACTIVE), eq(handleGestureState, GestureState.END)), and(eq(drawerOldGestureState, GestureState.ACTIVE), eq(drawerGestureState, GestureState.END)));
|
|
207
|
+
|
|
208
|
+
// Function that determines if the last snap point is in the range {snapPoints}
|
|
209
|
+
// In the case of interruptions in the middle of an animation, we'll get
|
|
210
|
+
// lastSnap values outside the range
|
|
211
|
+
const isLastSnapPointInRange = function () {
|
|
212
|
+
let i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
213
|
+
return i === _snapPoints.length ? lastSnapInRange : cond(eq(_this.lastSnap, _snapPoints[i]), [set(lastSnapInRange, 1)], isLastSnapPointInRange(i + 1));
|
|
214
|
+
};
|
|
215
|
+
const scrollY = [set(lastSnapInRange, 0), isLastSnapPointInRange(), cond(or(didHandleGestureBegin, and(this.isManuallySetValue, not(eq(this.manualYOffset, _snapPoints[0])))), [set(this.dragWithHandle, 1), 0]), cond(
|
|
216
|
+
// This is to account for a continuous scroll on the drawer from a snap point
|
|
217
|
+
// Different than top, bringing the drawer to the top position, so that if we
|
|
218
|
+
// change scroll direction without releasing the gesture, it doesn't pull down the drawer again
|
|
219
|
+
and(eq(this.dragWithHandle, 1), greaterThan(_snapPoints[0], add(this.lastSnap, this.dragY)), and(not(eq(this.lastSnap, _snapPoints[0])), lastSnapInRange)), [set(this.lastSnap, _snapPoints[0]), set(this.dragWithHandle, 0), this.lastStartScrollY], cond(eq(this.dragWithHandle, 1), 0, this.lastStartScrollY))];
|
|
220
|
+
this.didScrollUpAndPullDown = cond(and(greaterOrEq(this.dragY, this.lastStartScrollY), greaterThan(this.lastStartScrollY, 0)), set(this.scrollUpAndPullDown, 1));
|
|
221
|
+
this.setTranslationY = cond(and(not(this.dragWithHandle), not(greaterOrEq(this.dragY, this.lastStartScrollY))), set(this.translationY, sub(this.dragY, this.lastStartScrollY)), set(this.translationY, this.dragY));
|
|
222
|
+
this.extraOffset = cond(eq(this.scrollUpAndPullDown, 1), this.lastStartScrollY, 0);
|
|
223
|
+
const endOffsetY = add(this.lastSnap, this.translationY, multiply(1 - props.friction, this.velocityY));
|
|
224
|
+
this.calculateNextSnapPoint = function () {
|
|
225
|
+
let i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
226
|
+
return i === _snapPoints.length ? _this.tempDestSnapPoint : cond(greaterThan(abs(sub(_this.tempDestSnapPoint, endOffsetY)), abs(sub(add(_snapPoints[i], _this.extraOffset), endOffsetY))), [set(_this.tempDestSnapPoint, add(_snapPoints[i], _this.extraOffset)), set(_this.nextSnapIndex, i), _this.calculateNextSnapPoint(i + 1)], _this.calculateNextSnapPoint(i + 1));
|
|
227
|
+
};
|
|
228
|
+
const runAnimation = _ref => {
|
|
229
|
+
var _props$animationConfi2;
|
|
230
|
+
let {
|
|
231
|
+
clock,
|
|
232
|
+
from,
|
|
233
|
+
to,
|
|
234
|
+
position,
|
|
235
|
+
finished,
|
|
236
|
+
velocity,
|
|
237
|
+
frameTime
|
|
238
|
+
} = _ref;
|
|
239
|
+
const state = {
|
|
240
|
+
finished,
|
|
241
|
+
velocity: new Value(0),
|
|
242
|
+
position,
|
|
243
|
+
time: new Value(0),
|
|
244
|
+
frameTime
|
|
245
|
+
};
|
|
246
|
+
const timingConfig = {
|
|
247
|
+
duration: animationDuration,
|
|
248
|
+
easing: props.animationType === "timing" && ((_props$animationConfi2 = props.animationConfig) === null || _props$animationConfi2 === void 0 ? void 0 : _props$animationConfi2.easing) || DEFAULT_EASING,
|
|
249
|
+
toValue: new Value(0)
|
|
250
|
+
};
|
|
251
|
+
const springConfig = {
|
|
252
|
+
...DEFAULT_SPRING_PARAMS,
|
|
253
|
+
...(props.animationType === "spring" && props.animationConfig || {}),
|
|
254
|
+
toValue: new Value(0)
|
|
255
|
+
};
|
|
256
|
+
return [cond(and(not(clockRunning(clock)), not(eq(finished, 1))), [
|
|
257
|
+
// If the clock isn't running, we reset all the animation params and start the clock
|
|
258
|
+
set(state.finished, 0), set(state.velocity, velocity), set(state.time, 0), set(state.position, from), set(state.frameTime, 0), set(timingConfig.toValue, to), set(springConfig.toValue, to), startClock(clock)]),
|
|
259
|
+
// We run the step here that is going to update position
|
|
260
|
+
cond(eq(animationDriver, 0),
|
|
261
|
+
//@ts-ignore
|
|
262
|
+
timing(clock, state, timingConfig), spring(clock, state, springConfig)), cond(state.finished, [call([this.nextSnapIndex], _ref2 => {
|
|
263
|
+
let [value] = _ref2;
|
|
264
|
+
if (value !== this.prevSnapIndex) {
|
|
265
|
+
var _this$props$onSettle, _this$props;
|
|
266
|
+
(_this$props$onSettle = (_this$props = this.props).onSettle) === null || _this$props$onSettle === void 0 ? void 0 : _this$props$onSettle.call(_this$props, value);
|
|
267
|
+
}
|
|
268
|
+
this.prevSnapIndex = value;
|
|
269
|
+
}),
|
|
270
|
+
// Resetting appropriate values
|
|
271
|
+
set(drawerOldGestureState, GestureState.END), set(handleOldGestureState, GestureState.END), set(this.prevTranslateYOffset, state.position), cond(eq(this.scrollUpAndPullDown, 1), [set(this.prevTranslateYOffset, sub(this.prevTranslateYOffset, this.lastStartScrollY)), set(this.lastStartScrollY, 0), set(this.scrollUpAndPullDown, 0)]), cond(eq(this.destSnapPoint, _snapPoints[0]), [set(this.dragWithHandle, 0)]), set(this.isManuallySetValue, 0), set(this.manualYOffset, 0), stopClock(clock), this.prevTranslateYOffset],
|
|
272
|
+
// We made the block return the updated position,
|
|
273
|
+
state.position)];
|
|
274
|
+
};
|
|
275
|
+
const translateYOffset = cond(isAnimationInterrupted, [
|
|
276
|
+
// set(prevTranslateYOffset, animationPosition) should only run if we are
|
|
277
|
+
// interrupting an animation when the drawer is currently in a different
|
|
278
|
+
// position than the top
|
|
279
|
+
cond(or(this.dragWithHandle, greaterOrEq(abs(this.prevDragY), this.lastStartScrollY)), set(this.prevTranslateYOffset, this.animationPosition)), set(this.animationFinished, 1), set(this.translationY, 0),
|
|
280
|
+
// Resetting appropriate values
|
|
281
|
+
set(drawerOldGestureState, GestureState.END), set(handleOldGestureState, GestureState.END),
|
|
282
|
+
// By forcing that frameTime exceeds duration, it has the effect of stopping the animation
|
|
283
|
+
set(this.animationFrameTime, add(animationDuration, 1000)), set(this.velocityY, 0), stopClock(this.animationClock), this.prevTranslateYOffset], cond(or(this.didGestureFinish, this.isManuallySetValue, clockRunning(this.animationClock)), [runAnimation({
|
|
284
|
+
clock: this.animationClock,
|
|
285
|
+
from: cond(this.isManuallySetValue, this.prevTranslateYOffset, add(this.prevTranslateYOffset, this.translationY)),
|
|
286
|
+
to: this.destSnapPoint,
|
|
287
|
+
position: this.animationPosition,
|
|
288
|
+
finished: this.animationFinished,
|
|
289
|
+
frameTime: this.animationFrameTime,
|
|
290
|
+
velocity: this.velocityY
|
|
291
|
+
})], [set(this.animationFrameTime, 0), set(this.animationFinished, 0),
|
|
292
|
+
// @ts-ignore
|
|
293
|
+
this.prevTranslateYOffset]));
|
|
294
|
+
this.translateY = interpolate(add(translateYOffset, this.dragY, multiply(scrollY, -1)), {
|
|
295
|
+
inputRange: [openPosition, closedPosition],
|
|
296
|
+
outputRange: [openPosition, closedPosition],
|
|
297
|
+
extrapolate: Extrapolate.CLAMP
|
|
298
|
+
});
|
|
299
|
+
this.position = interpolate(this.translateY, {
|
|
300
|
+
inputRange: [openPosition, _snapPoints[_snapPoints.length - 1]],
|
|
301
|
+
outputRange: [1, 0],
|
|
302
|
+
extrapolate: Extrapolate.CLAMP
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
render() {
|
|
306
|
+
const {
|
|
307
|
+
renderHandle,
|
|
308
|
+
initialSnapIndex,
|
|
309
|
+
containerStyle,
|
|
310
|
+
...rest
|
|
311
|
+
} = this.props;
|
|
312
|
+
const AnimatedScrollableComponent = this.scrollComponent;
|
|
313
|
+
const normalisedSnapPoints = this.getNormalisedSnapPoints();
|
|
314
|
+
const initialSnap = normalisedSnapPoints[initialSnapIndex];
|
|
315
|
+
const Content = /*#__PURE__*/React.createElement(Animated.View, {
|
|
316
|
+
style: [StyleSheet.absoluteFillObject, containerStyle,
|
|
317
|
+
// @ts-ignore
|
|
318
|
+
{
|
|
319
|
+
transform: [{
|
|
320
|
+
translateY: this.translateY
|
|
321
|
+
}]
|
|
322
|
+
}]
|
|
323
|
+
}, /*#__PURE__*/React.createElement(PanGestureHandler, {
|
|
324
|
+
ref: this.drawerHandleRef,
|
|
325
|
+
shouldCancelWhenOutside: false,
|
|
326
|
+
simultaneousHandlers: this.masterDrawer,
|
|
327
|
+
onGestureEvent: this.onHandleGestureEvent,
|
|
328
|
+
onHandlerStateChange: this.onHandleGestureEvent
|
|
329
|
+
}, /*#__PURE__*/React.createElement(Animated.View, null, renderHandle())), /*#__PURE__*/React.createElement(PanGestureHandler, {
|
|
330
|
+
ref: this.drawerContentRef,
|
|
331
|
+
simultaneousHandlers: [this.scrollComponentRef, this.masterDrawer],
|
|
332
|
+
shouldCancelWhenOutside: false,
|
|
333
|
+
onGestureEvent: this.onDrawerGestureEvent,
|
|
334
|
+
onHandlerStateChange: this.onDrawerGestureEvent
|
|
335
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
336
|
+
style: styles.container
|
|
337
|
+
}, /*#__PURE__*/React.createElement(NativeViewGestureHandler, {
|
|
338
|
+
ref: this.scrollComponentRef,
|
|
339
|
+
waitFor: this.masterDrawer,
|
|
340
|
+
simultaneousHandlers: this.drawerContentRef
|
|
341
|
+
}, /*#__PURE__*/React.createElement(AnimatedScrollableComponent, _extends({
|
|
342
|
+
overScrollMode: "never",
|
|
343
|
+
bounces: false
|
|
344
|
+
}, rest, {
|
|
345
|
+
ref: this.props.innerRef
|
|
346
|
+
// @ts-ignore
|
|
347
|
+
,
|
|
348
|
+
decelerationRate: this.decelerationRate,
|
|
349
|
+
onScrollBeginDrag: this.onScrollBeginDrag,
|
|
350
|
+
scrollEventThrottle: 1,
|
|
351
|
+
contentContainerStyle: [rest.contentContainerStyle, {
|
|
352
|
+
paddingBottom: this.getNormalisedSnapPoints()[0]
|
|
353
|
+
}]
|
|
354
|
+
}))))), this.props.animatedPosition && /*#__PURE__*/React.createElement(Animated.Code, {
|
|
355
|
+
exec: onChange(this.position, set(this.props.animatedPosition, this.position))
|
|
356
|
+
}), /*#__PURE__*/React.createElement(Animated.Code, {
|
|
357
|
+
exec: onChange(this.dragY, cond(not(eq(this.dragY, 0)), set(this.prevDragY, this.dragY)))
|
|
358
|
+
}), /*#__PURE__*/React.createElement(Animated.Code, {
|
|
359
|
+
exec: onChange(this.didGestureFinish, cond(this.didGestureFinish, [this.didScrollUpAndPullDown, this.setTranslationY, set(this.tempDestSnapPoint, add(normalisedSnapPoints[0], this.extraOffset)), set(this.nextSnapIndex, 0), set(this.destSnapPoint, this.calculateNextSnapPoint()), cond(and(greaterThan(this.dragY, this.lastStartScrollY), this.isAndroid, not(this.dragWithHandle)), call([], () => {
|
|
360
|
+
var _this$props2, _this$props2$data;
|
|
361
|
+
// This prevents the scroll glide from happening on Android when pulling down with inertia.
|
|
362
|
+
// It's not perfect, but does the job for now
|
|
363
|
+
const {
|
|
364
|
+
method,
|
|
365
|
+
args
|
|
366
|
+
} = imperativeScrollOptions[this.props.componentType];
|
|
367
|
+
// @ts-ignore
|
|
368
|
+
const node = this.props.innerRef.current;
|
|
369
|
+
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")) {
|
|
370
|
+
node[method](args);
|
|
371
|
+
}
|
|
372
|
+
})), set(this.dragY, 0), set(this.velocityY, 0), set(this.lastSnap, sub(this.destSnapPoint, cond(eq(this.scrollUpAndPullDown, 1), this.lastStartScrollY, 0))), call([this.lastSnap], _ref3 => {
|
|
373
|
+
var _this$masterDrawer, _this$masterDrawer$cu;
|
|
374
|
+
let [value] = _ref3;
|
|
375
|
+
// This is the TapGHandler trick
|
|
376
|
+
// @ts-ignore
|
|
377
|
+
(_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({
|
|
378
|
+
maxDeltaY: value - this.getNormalisedSnapPoints()[0]
|
|
379
|
+
});
|
|
380
|
+
}), set(this.decelerationRate, cond(eq(this.isAndroid, 1), cond(eq(this.lastSnap, normalisedSnapPoints[0]), ANDROID_NORMAL_DECELERATION_RATE, 0), IOS_NORMAL_DECELERATION_RATE))]))
|
|
381
|
+
}), /*#__PURE__*/React.createElement(Animated.Code, {
|
|
382
|
+
exec: onChange(this.isManuallySetValue, [cond(this.isManuallySetValue, [set(this.destSnapPoint, this.manualYOffset), set(this.animationFinished, 0), set(this.lastSnap, this.manualYOffset), call([this.lastSnap], _ref4 => {
|
|
383
|
+
var _this$masterDrawer2, _this$masterDrawer2$c;
|
|
384
|
+
let [value] = _ref4;
|
|
385
|
+
// This is the TapGHandler trick
|
|
386
|
+
// @ts-ignore
|
|
387
|
+
(_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({
|
|
388
|
+
maxDeltaY: value - this.getNormalisedSnapPoints()[0]
|
|
389
|
+
});
|
|
390
|
+
})], [set(this.nextSnapIndex, 0)])])
|
|
391
|
+
}));
|
|
392
|
+
|
|
393
|
+
// On Android, having an intermediary view with pointerEvents="box-none", breaks the
|
|
394
|
+
// waitFor logic
|
|
395
|
+
if (Platform.OS === "android") {
|
|
396
|
+
return /*#__PURE__*/React.createElement(TapGestureHandler, {
|
|
397
|
+
maxDurationMs: 100000,
|
|
398
|
+
ref: this.masterDrawer,
|
|
399
|
+
maxDeltaY: initialSnap - this.getNormalisedSnapPoints()[0],
|
|
400
|
+
shouldCancelWhenOutside: false
|
|
401
|
+
}, Content);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// On iOS, We need to wrap the content on a view with PointerEvents box-none
|
|
405
|
+
// So that we can start scrolling automatically when reaching the top without
|
|
406
|
+
// Stopping the gesture
|
|
407
|
+
return /*#__PURE__*/React.createElement(TapGestureHandler, {
|
|
408
|
+
maxDurationMs: 100000,
|
|
409
|
+
ref: this.masterDrawer,
|
|
410
|
+
maxDeltaY: initialSnap - this.getNormalisedSnapPoints()[0]
|
|
411
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
412
|
+
style: StyleSheet.absoluteFillObject,
|
|
413
|
+
pointerEvents: "box-none"
|
|
414
|
+
}, Content));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
_defineProperty(ScrollBottomSheet, "defaultProps", {
|
|
418
|
+
topInset: 0,
|
|
419
|
+
friction: 0.95,
|
|
420
|
+
animationType: "timing",
|
|
421
|
+
innerRef: /*#__PURE__*/React.createRef(),
|
|
422
|
+
enableOverScroll: false
|
|
423
|
+
});
|
|
424
|
+
export default ScrollBottomSheet;
|
|
425
|
+
const styles = StyleSheet.create({
|
|
426
|
+
container: {
|
|
427
|
+
flex: 1
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
//# sourceMappingURL=BottomSheetComponent.js.map
|