@draftbit/core 46.10.3-7afc5f.2 → 46.10.3-84bbff.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.
Files changed (52) hide show
  1. package/lib/commonjs/components/AnimatedCircularProgress.js +12 -1
  2. package/lib/commonjs/components/Banner.js +23 -4
  3. package/lib/commonjs/components/BottomSheet/BottomSheet.js +22 -4
  4. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +127 -111
  5. package/lib/commonjs/components/Button.js +33 -10
  6. package/lib/commonjs/components/Checkbox/Checkbox.js +3 -4
  7. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +5 -23
  8. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
  9. package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +1 -4
  10. package/lib/commonjs/components/DeprecatedCardWrapper.js +15 -1
  11. package/lib/commonjs/components/Divider.js +14 -1
  12. package/lib/commonjs/components/FAB.js +18 -4
  13. package/lib/commonjs/components/Layout.js +40 -19
  14. package/lib/commonjs/components/Picker/PickerComponent.ios.js +36 -11
  15. package/lib/commonjs/components/Portal/Portal.js +27 -3
  16. package/lib/commonjs/components/Portal/PortalConsumer.js +22 -7
  17. package/lib/commonjs/components/Pressable.js +15 -2
  18. package/lib/commonjs/components/ScreenContainer.js +24 -6
  19. package/lib/commonjs/components/Shadow.js +15 -2
  20. package/lib/commonjs/components/Slider.js +21 -4
  21. package/lib/commonjs/components/Switch.js +19 -10
  22. package/lib/commonjs/components/TabView/TabView.js +13 -7
  23. package/lib/commonjs/components/Table/Table.js +5 -5
  24. package/lib/commonjs/components/Table/TableRow.js +1 -2
  25. package/lib/commonjs/components/Text.js +50 -4
  26. package/lib/commonjs/components/TextField.js +76 -28
  27. package/lib/commonjs/components/ToggleButton.js +15 -2
  28. package/lib/commonjs/components/Touchable.js +15 -2
  29. package/lib/commonjs/constants.js +1 -1
  30. package/lib/commonjs/mappings/FieldSearchBarFull.js +3 -1
  31. package/lib/commonjs/mappings/StarRating.js +6 -2
  32. package/lib/commonjs/styles/overlay.js +1 -3
  33. package/lib/module/components/Accordion/AccordionItem.js +25 -4
  34. package/lib/module/components/AnimatedCircularProgress.js +13 -1
  35. package/lib/module/components/AspectRatio.js +18 -1
  36. package/lib/module/components/AvatarEdit.js +15 -4
  37. package/lib/module/components/BottomSheet/BottomSheetComponent.js +124 -111
  38. package/lib/module/components/Checkbox/CheckboxGroup.js +16 -2
  39. package/lib/module/components/DeprecatedButton.js +21 -3
  40. package/lib/module/components/DeprecatedCardWrapper.js +18 -1
  41. package/lib/module/components/Picker/PickerComponent.android.js +21 -3
  42. package/lib/module/components/Picker/PickerComponent.ios.js +36 -11
  43. package/lib/module/components/Portal/PortalHost.js +45 -15
  44. package/lib/module/components/RadioButton/RadioButton.js +13 -1
  45. package/lib/module/components/RadioButton/RadioButtonGroup.js +16 -2
  46. package/lib/module/components/RadioButton/RadioButtonRow.js +24 -5
  47. package/lib/module/components/Surface.js +15 -1
  48. package/lib/module/components/TabView/TabView.js +17 -7
  49. package/lib/module/components/Touchable.js +15 -2
  50. package/lib/module/constants.js +1 -0
  51. package/lib/module/hooks.js +1 -2
  52. package/package.json +3 -3
@@ -7,7 +7,6 @@ exports.default = Touchable;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- 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); }
11
10
  function Touchable(_ref) {
12
11
  let {
13
12
  children,
@@ -20,8 +19,22 @@ function Touchable(_ref) {
20
19
  style,
21
20
  ...props
22
21
  } = _ref;
23
- return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
22
+ return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
24
23
  disabled: disabled,
24
+ onPress: onPress,
25
+ delayLongPress: delayLongPress ? delayLongPress : 500,
26
+ hitSlop: hitSlop ? hitSlop : 8,
27
+ style: _ref2 => {
28
+ let {
29
+ pressed
30
+ } = _ref2;
31
+ return [{
32
+ opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
33
+ }, style];
34
+ },
35
+ ...props
36
+ }, children);
37
+ } disabled: disabled,
25
38
  onPress: onPress,
26
39
  delayLongPress: delayLongPress ? delayLongPress : 500,
27
40
  hitSlop: hitSlop ? hitSlop : 8,
@@ -12,4 +12,4 @@ const APPROX_STATUSBAR_HEIGHT = _reactNative.Platform.select({
12
12
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
13
13
  ios: _reactNative.Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
14
14
  });
15
- exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;AR_HEIGHT;
15
+ exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;
@@ -14,7 +14,6 @@ const SEED_DATA = [{
14
14
  preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
15
15
  supports_list_render: false,
16
16
  triggers: [_types.Triggers.OnChange],
17
- // TODO Triggers.OnSubmit for multiple triggers
18
17
  props: {
19
18
  icon: {
20
19
  group: _types.GROUPS.basic,
@@ -53,4 +52,7 @@ const SEED_DATA = [{
53
52
  },
54
53
  layout: {}
55
54
  }];
55
+ exports.SEED_DATA = SEED_DATA;},
56
+ layout: {}
57
+ }];
56
58
  exports.SEED_DATA = SEED_DATA;
@@ -23,9 +23,7 @@ const SEED_DATA = {
23
23
  }),
24
24
  fieldName: (0, _types.createFieldNameProp)({
25
25
  defaultValue: "ratingValue",
26
- // this is the name of the variable declared on the screen in Draftbit
27
26
  handlerPropName: "onPress",
28
- // the change handler prop in this component
29
27
  valuePropName: "rating" // the value prop in this component
30
28
  }),
31
29
 
@@ -50,4 +48,10 @@ const SEED_DATA = {
50
48
  })
51
49
  }
52
50
  };
51
+ exports.SEED_DATA = SEED_DATA;pes.createColorProp)({
52
+ label: "Inactive Color",
53
+ defaultValue: "divider"
54
+ })
55
+ }
56
+ };
53
57
  exports.SEED_DATA = SEED_DATA;
@@ -15,7 +15,6 @@ function overlay(elevation) {
15
15
  let surfaceColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _DarkTheme.default.colors.surface;
16
16
  if (isAnimatedValue(elevation)) {
17
17
  const inputRange = [0, 1, 2, 3, 8, 24];
18
-
19
18
  // @ts-expect-error: TS doesn't seem to refine the type correctly
20
19
  return elevation.interpolate({
21
20
  inputRange,
@@ -24,7 +23,6 @@ function overlay(elevation) {
24
23
  })
25
24
  });
26
25
  }
27
-
28
26
  // @ts-expect-error: TS doesn't seem to refine the type correctly
29
27
  return calculateColor(surfaceColor, elevation);
30
28
  }
@@ -65,4 +63,4 @@ const elevationOverlayTransparency = {
65
63
  22: 15.72,
66
64
  23: 15.84,
67
65
  24: 16
68
- };
66
+ };};
@@ -1,4 +1,3 @@
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
1
  import * as React from "react";
3
2
  import { Pressable, StyleSheet, View } from "react-native";
4
3
  import Text from "../Text";
@@ -18,9 +17,10 @@ const AccordionItem = _ref => {
18
17
  textStyles,
19
18
  viewStyles
20
19
  } = extractStyles(style);
21
- return /*#__PURE__*/React.createElement(Pressable, _extends({
22
- style: [styles.container, viewStyles]
23
- }, rest), /*#__PURE__*/React.createElement(View, {
20
+ return /*#__PURE__*/React.createElement(Pressable, {
21
+ style: [styles.container, viewStyles],
22
+ ...rest
23
+ }, /*#__PURE__*/React.createElement(View, {
24
24
  style: styles.row
25
25
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
26
26
  name: icon,
@@ -51,4 +51,25 @@ const styles = StyleSheet.create({
51
51
  justifyContent: "center"
52
52
  }
53
53
  });
54
+ export default withTheme(AccordionItem);xtStyles
55
+ }, label))));
56
+ };
57
+ const styles = StyleSheet.create({
58
+ container: {
59
+ padding: 8
60
+ },
61
+ row: {
62
+ flexDirection: "row",
63
+ alignItems: "center",
64
+ paddingLeft: 8
65
+ },
66
+ item: {
67
+ marginVertical: 6,
68
+ paddingLeft: 8
69
+ },
70
+ content: {
71
+ flex: 1,
72
+ justifyContent: "center"
73
+ }
74
+ });
54
75
  export default withTheme(AccordionItem);
@@ -1,4 +1,3 @@
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
1
  import * as React from "react";
3
2
  import { Animated, Easing } from "react-native";
4
3
  import CircularProgress from "./CircularProgress";
@@ -46,6 +45,19 @@ const AnimatedCircularProgress = _ref => {
46
45
  React.useEffect(() => {
47
46
  animate();
48
47
  }, [fill, animate]);
48
+ return /*#__PURE__*/React.createElement(AnimatedProgress, {
49
+ ...other,
50
+ style: other.style,
51
+ childrenContainerStyle: other.childrenContainerStyle,
52
+ fill: fillAnimation,
53
+ tintColor: animateColor()
54
+ });
55
+ };
56
+ export default AnimatedCircularProgress;imation;
57
+ };
58
+ React.useEffect(() => {
59
+ animate();
60
+ }, [fill, animate]);
49
61
  return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
50
62
  style: other.style,
51
63
  childrenContainerStyle: other.childrenContainerStyle,
@@ -1,4 +1,3 @@
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
1
  import React from "react";
3
2
  import { View, StyleSheet } from "react-native";
4
3
  const AspectRatio = props => {
@@ -27,6 +26,24 @@ const AspectRatio = props => {
27
26
  });
28
27
  }
29
28
  }
29
+ return /*#__PURE__*/React.createElement(View, {
30
+ ...props,
31
+ style: style,
32
+ onLayout: _ref => {
33
+ let {
34
+ nativeEvent: {
35
+ layout: l
36
+ }
37
+ } = _ref;
38
+ return setLayout(l);
39
+ }
40
+ }, props.children);
41
+ };
42
+ export default AspectRatio;idth,
43
+ height: width * (1 / aspectRatio)
44
+ });
45
+ }
46
+ }
30
47
  return /*#__PURE__*/React.createElement(View, _extends({}, props, {
31
48
  style: style,
32
49
  onLayout: _ref => {
@@ -1,4 +1,3 @@
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
1
  import * as React from "react";
3
2
  import { View } from "react-native";
4
3
  import Touchable from "./Touchable";
@@ -23,9 +22,10 @@ const AvatarEdit = _ref => {
23
22
  width: size,
24
23
  height: size
25
24
  };
26
- return /*#__PURE__*/React.createElement(View, _extends({
27
- style: [style, dimensions]
28
- }, rest), /*#__PURE__*/React.createElement(Touchable, {
25
+ return /*#__PURE__*/React.createElement(View, {
26
+ style: [style, dimensions],
27
+ ...rest
28
+ }, /*#__PURE__*/React.createElement(Touchable, {
29
29
  onPress: onPress
30
30
  }, /*#__PURE__*/React.createElement(CircleImage, {
31
31
  source: image,
@@ -46,4 +46,15 @@ const AvatarEdit = _ref => {
46
46
  size: size * (3 / 16)
47
47
  }))));
48
48
  };
49
+ export default withTheme(AvatarEdit);yles.editBorderColor,
50
+ backgroundColor: colorStyles.editBackgroundColor,
51
+ borderRadius: size * (3 / 16),
52
+ padding: size * (3 / 32)
53
+ }
54
+ }, /*#__PURE__*/React.createElement(Icon, {
55
+ name: "MaterialIcons/edit",
56
+ color: colorStyles.editIconColor,
57
+ size: size * (3 / 16)
58
+ }))));
59
+ };
49
60
  export default withTheme(AvatarEdit);
@@ -1,13 +1,8 @@
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
1
  /**
6
2
  * Slightly modfied version as taken from https://github.com/rgommezz/react-native-scroll-bottom-sheet
7
3
  * Main previously breaking change:
8
4
  * const node = this.props.innerRef.current?.getNode() ==> const node = this.props.innerRef.current as any
9
5
  */
10
-
11
6
  /**
12
7
  * Copyright (c) 2020 Raul Gomez Acuna
13
8
  *
@@ -15,7 +10,6 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
15
10
  * LICENSE file in the root directory of this source tree.
16
11
  *
17
12
  */
18
-
19
13
  import React, { Component } from "react";
20
14
  import { Dimensions, FlatList, Platform, ScrollView, SectionList, StyleSheet, View } from "react-native";
21
15
  import Animated, { abs, add, and, call, Clock, clockRunning, cond, Easing as EasingDeprecated,
@@ -81,85 +75,42 @@ const imperativeScrollOptions = {
81
75
  }
82
76
  };
83
77
  export class ScrollBottomSheet extends Component {
84
- /**
85
- * Gesture Handler references
86
- */
87
-
88
- /**
89
- * ScrollView prop
90
- */
91
-
92
- /**
93
- * Pan gesture handler events for drawer handle and content
94
- */
95
-
96
- /**
97
- * Main Animated Value that drives the top position of the UI drawer at any point in time
98
- */
99
-
100
- /**
101
- * Animated value that keeps track of the position: 0 => closed, 1 => opened
102
- */
103
-
104
- /**
105
- * Flag to indicate imperative snapping
106
- */
107
-
108
- /**
109
- * Manual snapping amount
110
- */
111
-
112
- /**
113
- * Keeps track of the current index
114
- */
115
-
116
- /**
117
- * Deceleration rate of the scroll component. This is used only on Android to
118
- * compensate the unexpected glide it gets sometimes.
119
- */
120
-
121
78
  constructor(props) {
122
- var _props$animationConfi, _this;
79
+ var _this;
80
+ var _a;
123
81
  super(props);
124
82
  _this = this;
125
- _defineProperty(this, "masterDrawer", /*#__PURE__*/React.createRef());
126
- _defineProperty(this, "drawerHandleRef", /*#__PURE__*/React.createRef());
127
- _defineProperty(this, "drawerContentRef", /*#__PURE__*/React.createRef());
128
- _defineProperty(this, "scrollComponentRef", /*#__PURE__*/React.createRef());
129
- _defineProperty(this, "onScrollBeginDrag", void 0);
130
- _defineProperty(this, "onHandleGestureEvent", void 0);
131
- _defineProperty(this, "onDrawerGestureEvent", void 0);
132
- _defineProperty(this, "translateY", void 0);
133
- _defineProperty(this, "position", void 0);
134
- _defineProperty(this, "isManuallySetValue", new Value(0));
135
- _defineProperty(this, "manualYOffset", new Value(0));
136
- _defineProperty(this, "nextSnapIndex", void 0);
137
- _defineProperty(this, "decelerationRate", void 0);
138
- _defineProperty(this, "prevSnapIndex", -1);
139
- _defineProperty(this, "dragY", new Value(0));
140
- _defineProperty(this, "prevDragY", new Value(0));
141
- _defineProperty(this, "tempDestSnapPoint", new Value(0));
142
- _defineProperty(this, "isAndroid", new Value(Number(Platform.OS === "android")));
143
- _defineProperty(this, "animationClock", new Clock());
144
- _defineProperty(this, "animationPosition", new Value(0));
145
- _defineProperty(this, "animationFinished", new Value(0));
146
- _defineProperty(this, "animationFrameTime", new Value(0));
147
- _defineProperty(this, "velocityY", new Value(0));
148
- _defineProperty(this, "lastStartScrollY", new Value(0));
149
- _defineProperty(this, "prevTranslateYOffset", void 0);
150
- _defineProperty(this, "translationY", void 0);
151
- _defineProperty(this, "destSnapPoint", new Value(0));
152
- _defineProperty(this, "lastSnap", void 0);
153
- _defineProperty(this, "dragWithHandle", new Value(0));
154
- _defineProperty(this, "scrollUpAndPullDown", new Value(0));
155
- _defineProperty(this, "didGestureFinish", void 0);
156
- _defineProperty(this, "didScrollUpAndPullDown", void 0);
157
- _defineProperty(this, "setTranslationY", void 0);
158
- _defineProperty(this, "extraOffset", void 0);
159
- _defineProperty(this, "calculateNextSnapPoint", void 0);
160
- _defineProperty(this, "scrollComponent", void 0);
161
- _defineProperty(this, "convertPercentageToDp", str => Number(str.split("%")[0]) * (windowHeight - this.props.topInset) / 100);
162
- _defineProperty(this, "getNormalisedSnapPoints", () => {
83
+ /**
84
+ * Gesture Handler references
85
+ */
86
+ this.masterDrawer = /*#__PURE__*/React.createRef();
87
+ this.drawerHandleRef = /*#__PURE__*/React.createRef();
88
+ this.drawerContentRef = /*#__PURE__*/React.createRef();
89
+ this.scrollComponentRef = /*#__PURE__*/React.createRef();
90
+ /**
91
+ * Flag to indicate imperative snapping
92
+ */
93
+ this.isManuallySetValue = new Value(0);
94
+ /**
95
+ * Manual snapping amount
96
+ */
97
+ this.manualYOffset = new Value(0);
98
+ this.prevSnapIndex = -1;
99
+ this.dragY = new Value(0);
100
+ this.prevDragY = new Value(0);
101
+ this.tempDestSnapPoint = new Value(0);
102
+ this.isAndroid = new Value(Number(Platform.OS === "android"));
103
+ this.animationClock = new Clock();
104
+ this.animationPosition = new Value(0);
105
+ this.animationFinished = new Value(0);
106
+ this.animationFrameTime = new Value(0);
107
+ this.velocityY = new Value(0);
108
+ this.lastStartScrollY = new Value(0);
109
+ this.destSnapPoint = new Value(0);
110
+ this.dragWithHandle = new Value(0);
111
+ this.scrollUpAndPullDown = new Value(0);
112
+ this.convertPercentageToDp = str => Number(str.split("%")[0]) * (windowHeight - this.props.topInset) / 100;
113
+ this.getNormalisedSnapPoints = () => {
163
114
  return this.props.snapPoints.map(p => {
164
115
  if (typeof p === "string") {
165
116
  return this.convertPercentageToDp(p);
@@ -168,8 +119,8 @@ export class ScrollBottomSheet extends Component {
168
119
  }
169
120
  throw new Error("Invalid type for value ".concat(p, ": ").concat(typeof p, ". It should be either a percentage string or a number"));
170
121
  });
171
- });
172
- _defineProperty(this, "getScrollComponent", () => {
122
+ };
123
+ this.getScrollComponent = () => {
173
124
  switch (this.props.componentType) {
174
125
  case "FlatList":
175
126
  return FlatList;
@@ -180,33 +131,32 @@ export class ScrollBottomSheet extends Component {
180
131
  default:
181
132
  throw new Error("Component type not supported: it should be one of `FlatList`, `ScrollView` or `SectionList`");
182
133
  }
183
- });
184
- _defineProperty(this, "snapTo", index => {
134
+ };
135
+ this.snapTo = index => {
185
136
  const snapPoints = this.getNormalisedSnapPoints();
186
137
  this.isManuallySetValue.setValue(1);
187
138
  this.manualYOffset.setValue(snapPoints[index]);
188
139
  this.nextSnapIndex.setValue(index);
189
- });
140
+ };
190
141
  const {
191
142
  initialSnapIndex,
192
143
  animationType
193
144
  } = props;
194
145
  const animationDriver = animationType === "timing" ? 0 : 1;
195
- const animationDuration = props.animationType === "timing" && ((_props$animationConfi = props.animationConfig) === null || _props$animationConfi === void 0 ? void 0 : _props$animationConfi.duration) || DEFAULT_ANIMATION_DURATION;
146
+ const animationDuration = props.animationType === "timing" && ((_a = props.animationConfig) === null || _a === void 0 ? void 0 : _a.duration) || DEFAULT_ANIMATION_DURATION;
196
147
  const ScrollComponent = this.getScrollComponent();
197
148
  // @ts-ignore
198
149
  this.scrollComponent = Animated.createAnimatedComponent(ScrollComponent);
199
- const _snapPoints = this.getNormalisedSnapPoints();
200
- const openPosition = _snapPoints[0];
201
- const closedPosition = this.props.enableOverScroll ? windowHeight : _snapPoints[_snapPoints.length - 1];
202
- const initialSnap = _snapPoints[initialSnapIndex];
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];
203
154
  this.nextSnapIndex = new Value(initialSnapIndex);
204
155
  const initialDecelerationRate = Platform.select({
205
156
  android: props.initialSnapIndex === 0 ? ANDROID_NORMAL_DECELERATION_RATE : 0,
206
157
  ios: IOS_NORMAL_DECELERATION_RATE
207
158
  });
208
159
  this.decelerationRate = new Value(initialDecelerationRate);
209
-
210
160
  //@ts-ignore
211
161
  const handleGestureState = new Value(-1);
212
162
  //@ts-ignore
@@ -245,29 +195,27 @@ export class ScrollBottomSheet extends Component {
245
195
  const didHandleGestureBegin = eq(handleGestureState, GestureState.ACTIVE);
246
196
  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));
247
197
  this.didGestureFinish = or(and(eq(handleOldGestureState, GestureState.ACTIVE), eq(handleGestureState, GestureState.END)), and(eq(drawerOldGestureState, GestureState.ACTIVE), eq(drawerGestureState, GestureState.END)));
248
-
249
198
  // Function that determines if the last snap point is in the range {snapPoints}
250
199
  // In the case of interruptions in the middle of an animation, we'll get
251
200
  // lastSnap values outside the range
252
201
  const isLastSnapPointInRange = function () {
253
202
  let i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
254
- return i === _snapPoints.length ? lastSnapInRange : cond(eq(_this.lastSnap, _snapPoints[i]), [set(lastSnapInRange, 1)], isLastSnapPointInRange(i + 1));
203
+ return i === snapPoints.length ? lastSnapInRange : cond(eq(_this.lastSnap, snapPoints[i]), [set(lastSnapInRange, 1)], isLastSnapPointInRange(i + 1));
255
204
  };
256
- const scrollY = [set(lastSnapInRange, 0), isLastSnapPointInRange(), cond(or(didHandleGestureBegin, and(this.isManuallySetValue, not(eq(this.manualYOffset, _snapPoints[0])))), [set(this.dragWithHandle, 1), 0]), cond(
205
+ const scrollY = [set(lastSnapInRange, 0), isLastSnapPointInRange(), cond(or(didHandleGestureBegin, and(this.isManuallySetValue, not(eq(this.manualYOffset, snapPoints[0])))), [set(this.dragWithHandle, 1), 0]), cond(
257
206
  // This is to account for a continuous scroll on the drawer from a snap point
258
207
  // Different than top, bringing the drawer to the top position, so that if we
259
208
  // change scroll direction without releasing the gesture, it doesn't pull down the drawer again
260
- 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))];
209
+ 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))];
261
210
  this.didScrollUpAndPullDown = cond(and(greaterOrEq(this.dragY, this.lastStartScrollY), greaterThan(this.lastStartScrollY, 0)), set(this.scrollUpAndPullDown, 1));
262
211
  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));
263
212
  this.extraOffset = cond(eq(this.scrollUpAndPullDown, 1), this.lastStartScrollY, 0);
264
213
  const endOffsetY = add(this.lastSnap, this.translationY, multiply(1 - props.friction, this.velocityY));
265
214
  this.calculateNextSnapPoint = function () {
266
215
  let i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
267
- 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));
216
+ 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));
268
217
  };
269
218
  const runAnimation = _ref => {
270
- var _props$animationConfi2;
271
219
  let {
272
220
  clock,
273
221
  from,
@@ -277,6 +225,7 @@ export class ScrollBottomSheet extends Component {
277
225
  velocity,
278
226
  frameTime
279
227
  } = _ref;
228
+ var _a;
280
229
  const state = {
281
230
  finished,
282
231
  velocity: new Value(0),
@@ -286,7 +235,7 @@ export class ScrollBottomSheet extends Component {
286
235
  };
287
236
  const timingConfig = {
288
237
  duration: animationDuration,
289
- easing: props.animationType === "timing" && ((_props$animationConfi2 = props.animationConfig) === null || _props$animationConfi2 === void 0 ? void 0 : _props$animationConfi2.easing) || DEFAULT_EASING,
238
+ easing: props.animationType === "timing" && ((_a = props.animationConfig) === null || _a === void 0 ? void 0 : _a.easing) || DEFAULT_EASING,
290
239
  toValue: new Value(0)
291
240
  };
292
241
  const springConfig = {
@@ -302,14 +251,14 @@ export class ScrollBottomSheet extends Component {
302
251
  //@ts-ignore
303
252
  timing(clock, state, timingConfig), spring(clock, state, springConfig)), cond(state.finished, [call([this.nextSnapIndex], _ref2 => {
304
253
  let [value] = _ref2;
254
+ var _a, _b;
305
255
  if (value !== this.prevSnapIndex) {
306
- var _this$props$onSettle, _this$props;
307
- (_this$props$onSettle = (_this$props = this.props).onSettle) === null || _this$props$onSettle === void 0 ? void 0 : _this$props$onSettle.call(_this$props, value);
256
+ (_b = (_a = this.props).onSettle) === null || _b === void 0 ? void 0 : _b.call(_a, value);
308
257
  }
309
258
  this.prevSnapIndex = value;
310
259
  }),
311
260
  // Resetting appropriate values
312
- 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],
261
+ 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],
313
262
  // We made the block return the updated position,
314
263
  state.position)];
315
264
  };
@@ -338,7 +287,7 @@ export class ScrollBottomSheet extends Component {
338
287
  extrapolate: Extrapolate.CLAMP
339
288
  });
340
289
  this.position = interpolate(this.translateY, {
341
- inputRange: [openPosition, _snapPoints[_snapPoints.length - 1]],
290
+ inputRange: [openPosition, snapPoints[snapPoints.length - 1]],
342
291
  outputRange: [1, 0],
343
292
  extrapolate: Extrapolate.CLAMP
344
293
  });
@@ -379,28 +328,92 @@ export class ScrollBottomSheet extends Component {
379
328
  ref: this.scrollComponentRef,
380
329
  waitFor: this.masterDrawer,
381
330
  simultaneousHandlers: this.drawerContentRef
382
- }, /*#__PURE__*/React.createElement(AnimatedScrollableComponent, _extends({
331
+ }, /*#__PURE__*/React.createElement(AnimatedScrollableComponent, {
383
332
  overScrollMode: "never",
384
- bounces: false
385
- }, rest, {
386
- ref: this.props.innerRef
333
+ bounces: false,
334
+ ...rest,
335
+ ref: this.props.innerRef,
387
336
  // @ts-ignore
388
- ,
389
337
  decelerationRate: this.decelerationRate,
390
338
  onScrollBeginDrag: this.onScrollBeginDrag,
391
339
  scrollEventThrottle: 1,
392
340
  contentContainerStyle: [rest.contentContainerStyle, {
393
341
  paddingBottom: this.getNormalisedSnapPoints()[0]
394
342
  }]
395
- }))))), this.props.animatedPosition && /*#__PURE__*/React.createElement(Animated.Code, {
343
+ })))), this.props.animatedPosition && /*#__PURE__*/React.createElement(Animated.Code, {
396
344
  exec: onChange(this.position, set(this.props.animatedPosition, this.position))
397
345
  }), /*#__PURE__*/React.createElement(Animated.Code, {
398
346
  exec: onChange(this.dragY, cond(not(eq(this.dragY, 0)), set(this.prevDragY, this.dragY)))
399
347
  }), /*#__PURE__*/React.createElement(Animated.Code, {
400
348
  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([], () => {
401
- var _this$props2, _this$props2$data;
349
+ var _a, _b;
402
350
  // This prevents the scroll glide from happening on Android when pulling down with inertia.
403
351
  // It's not perfect, but does the job for now
352
+ const {
353
+ method,
354
+ args
355
+ } = imperativeScrollOptions[this.props.componentType];
356
+ // @ts-ignore
357
+ const node = this.props.innerRef.current;
358
+ if (node && node[method] && (this.props.componentType === "FlatList" && (((_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0 || this.props.componentType === "SectionList" && this.props.sections.length > 0 || this.props.componentType === "ScrollView")) {
359
+ node[method](args);
360
+ }
361
+ })), 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 => {
362
+ let [value] = _ref3;
363
+ var _a, _b;
364
+ // This is the TapGHandler trick
365
+ // @ts-ignore
366
+ (_b = (_a = this.masterDrawer) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.setNativeProps({
367
+ maxDeltaY: value - this.getNormalisedSnapPoints()[0]
368
+ });
369
+ }), set(this.decelerationRate, cond(eq(this.isAndroid, 1), cond(eq(this.lastSnap, normalisedSnapPoints[0]), ANDROID_NORMAL_DECELERATION_RATE, 0), IOS_NORMAL_DECELERATION_RATE))]))
370
+ }), /*#__PURE__*/React.createElement(Animated.Code, {
371
+ 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 => {
372
+ let [value] = _ref4;
373
+ var _a, _b;
374
+ // This is the TapGHandler trick
375
+ // @ts-ignore
376
+ (_b = (_a = this.masterDrawer) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.setNativeProps({
377
+ maxDeltaY: value - this.getNormalisedSnapPoints()[0]
378
+ });
379
+ })], [set(this.nextSnapIndex, 0)])])
380
+ }));
381
+ // On Android, having an intermediary view with pointerEvents="box-none", breaks the
382
+ // waitFor logic
383
+ if (Platform.OS === "android") {
384
+ return /*#__PURE__*/React.createElement(TapGestureHandler, {
385
+ maxDurationMs: 100000,
386
+ ref: this.masterDrawer,
387
+ maxDeltaY: initialSnap - this.getNormalisedSnapPoints()[0],
388
+ shouldCancelWhenOutside: false
389
+ }, Content);
390
+ }
391
+ // On iOS, We need to wrap the content on a view with PointerEvents box-none
392
+ // So that we can start scrolling automatically when reaching the top without
393
+ // Stopping the gesture
394
+ return /*#__PURE__*/React.createElement(TapGestureHandler, {
395
+ maxDurationMs: 100000,
396
+ ref: this.masterDrawer,
397
+ maxDeltaY: initialSnap - this.getNormalisedSnapPoints()[0]
398
+ }, /*#__PURE__*/React.createElement(View, {
399
+ style: StyleSheet.absoluteFillObject,
400
+ pointerEvents: "box-none"
401
+ }, Content));
402
+ }
403
+ }
404
+ ScrollBottomSheet.defaultProps = {
405
+ topInset: 0,
406
+ friction: 0.95,
407
+ animationType: "timing",
408
+ innerRef: /*#__PURE__*/React.createRef(),
409
+ enableOverScroll: false
410
+ };
411
+ export default ScrollBottomSheet;
412
+ const styles = StyleSheet.create({
413
+ container: {
414
+ flex: 1
415
+ }
416
+ }); // It's not perfect, but does the job for now
404
417
  const {
405
418
  method,
406
419
  args
@@ -1,4 +1,3 @@
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
1
  import * as React from "react";
3
2
  import { View } from "react-native";
4
3
  import { checkboxGroupContext, Direction } from "./context";
@@ -23,7 +22,22 @@ const CheckboxGroup = _ref => {
23
22
  alignItems: "center"
24
23
  });
25
24
  }
26
- return /*#__PURE__*/React.createElement(View, _extends({
25
+ return /*#__PURE__*/React.createElement(View, {
26
+ style: [{
27
+ minHeight: 40
28
+ }, style],
29
+ ...rest
30
+ }, /*#__PURE__*/React.createElement(Provider, {
31
+ value: {
32
+ values,
33
+ onValueChange,
34
+ direction
35
+ }
36
+ }, /*#__PURE__*/React.createElement(View, {
37
+ style: _containerStyle
38
+ }, children)));
39
+ };
40
+ export default CheckboxGroup;PURE__*/React.createElement(View, _extends({
27
41
  style: [{
28
42
  minHeight: 40
29
43
  }, style]