@hero-design/rn 8.2.1 → 8.2.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/.turbo/turbo-build.log +2 -2
- package/es/index.js +71 -25
- package/lib/index.js +70 -24
- package/package.json +5 -5
- package/src/components/BottomSheet/BottomSheetContext.ts +11 -0
- package/src/components/BottomSheet/ScrollView.tsx +57 -0
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +9 -24
- package/src/components/BottomSheet/__tests__/index.spec.tsx +17 -0
- package/src/components/BottomSheet/index.tsx +21 -8
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +0 -24
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +0 -72
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +0 -36
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +0 -24
- package/types/components/BottomSheet/BottomSheetContext.d.ts +5 -0
- package/types/components/BottomSheet/ScrollView.d.ts +3 -0
- package/types/components/BottomSheet/index.d.ts +5 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[32m@hero-design/rn:build[0m: cache hit, replaying output [
|
|
1
|
+
[32m@hero-design/rn:build[0m: cache hit, replaying output [2md7aa160db70d0015[0m
|
|
2
2
|
[32m@hero-design/rn:build: [0m$ yarn build:js && yarn build:types
|
|
3
3
|
[32m@hero-design/rn:build: [0m$ rollup -c
|
|
4
4
|
[32m@hero-design/rn:build: [0m[36m
|
|
5
5
|
[32m@hero-design/rn:build: [0m[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
6
6
|
[32m@hero-design/rn:build: [0m[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
7
7
|
[32m@hero-design/rn:build: [0m[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
8
|
-
[32m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [
|
|
8
|
+
[32m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m21.6s[22m[39m
|
|
9
9
|
[32m@hero-design/rn:build: [0m$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as reactNative from 'react-native';
|
|
2
|
-
import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, Easing, TouchableOpacity, Text as Text$1, Image as Image$1, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, Modal, TextInput as TextInput$1, PanResponder, TouchableHighlight, InteractionManager, useWindowDimensions, Keyboard, SectionList, FlatList, LayoutAnimation, RefreshControl as RefreshControl$1 } from 'react-native';
|
|
2
|
+
import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, Easing, TouchableOpacity, Text as Text$1, Image as Image$1, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, ScrollView, Modal, TextInput as TextInput$1, PanResponder, TouchableHighlight, InteractionManager, useWindowDimensions, Keyboard, SectionList, FlatList, LayoutAnimation, RefreshControl as RefreshControl$1 } from 'react-native';
|
|
3
3
|
import React, { useContext, createContext, createElement, useMemo, forwardRef, useEffect, useCallback, useRef, useState, useLayoutEffect, useImperativeHandle } from 'react';
|
|
4
4
|
import { createIconSet } from 'react-native-vector-icons';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -5701,7 +5701,7 @@ var StyledText$3 = index$a(Text$1)(function (_ref) {
|
|
|
5701
5701
|
});
|
|
5702
5702
|
});
|
|
5703
5703
|
|
|
5704
|
-
var _excluded$
|
|
5704
|
+
var _excluded$k = ["children", "fontSize", "fontWeight", "intent", "typeface"];
|
|
5705
5705
|
var Text = function Text(_ref) {
|
|
5706
5706
|
var children = _ref.children,
|
|
5707
5707
|
_ref$fontSize = _ref.fontSize,
|
|
@@ -5712,7 +5712,7 @@ var Text = function Text(_ref) {
|
|
|
5712
5712
|
intent = _ref$intent === void 0 ? 'body' : _ref$intent,
|
|
5713
5713
|
_ref$typeface = _ref.typeface,
|
|
5714
5714
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
5715
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
5715
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$k);
|
|
5716
5716
|
return /*#__PURE__*/React.createElement(StyledText$3, _extends$1({}, nativeProps, {
|
|
5717
5717
|
themeFontSize: fontSize,
|
|
5718
5718
|
themeFontWeight: fontWeight,
|
|
@@ -6191,10 +6191,10 @@ var StyledHeroIcon = index$a(HeroIcon)(function (_ref) {
|
|
|
6191
6191
|
};
|
|
6192
6192
|
});
|
|
6193
6193
|
|
|
6194
|
-
var _excluded$
|
|
6194
|
+
var _excluded$j = ["style"];
|
|
6195
6195
|
var AnimatedIcon = function AnimatedIcon(_ref) {
|
|
6196
6196
|
var style = _ref.style,
|
|
6197
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
6197
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$j);
|
|
6198
6198
|
var rotateAnimation = useRef(new Animated.Value(0));
|
|
6199
6199
|
useEffect(function () {
|
|
6200
6200
|
var animation = Animated.loop(Animated.timing(rotateAnimation.current, {
|
|
@@ -6276,7 +6276,7 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
|
6276
6276
|
}, content));
|
|
6277
6277
|
};
|
|
6278
6278
|
|
|
6279
|
-
var _excluded$
|
|
6279
|
+
var _excluded$i = ["key"];
|
|
6280
6280
|
var Accordion = function Accordion(_ref) {
|
|
6281
6281
|
var items = _ref.items,
|
|
6282
6282
|
activeItemKey = _ref.activeItemKey,
|
|
@@ -6297,7 +6297,7 @@ var Accordion = function Accordion(_ref) {
|
|
|
6297
6297
|
testID: testID
|
|
6298
6298
|
}, items.map(function (_ref2, index) {
|
|
6299
6299
|
var key = _ref2.key,
|
|
6300
|
-
props = _objectWithoutProperties(_ref2, _excluded$
|
|
6300
|
+
props = _objectWithoutProperties(_ref2, _excluded$i);
|
|
6301
6301
|
var open = _activeItemKey === key;
|
|
6302
6302
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
6303
6303
|
key: key
|
|
@@ -6679,7 +6679,7 @@ var StyledStatus = index$a(Animated.View)(function (_ref3) {
|
|
|
6679
6679
|
};
|
|
6680
6680
|
});
|
|
6681
6681
|
|
|
6682
|
-
var _excluded$
|
|
6682
|
+
var _excluded$h = ["children", "visible", "intent", "style", "testID"];
|
|
6683
6683
|
var Status = function Status(_ref) {
|
|
6684
6684
|
var children = _ref.children,
|
|
6685
6685
|
_ref$visible = _ref.visible,
|
|
@@ -6688,7 +6688,7 @@ var Status = function Status(_ref) {
|
|
|
6688
6688
|
intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
|
|
6689
6689
|
style = _ref.style,
|
|
6690
6690
|
testID = _ref.testID,
|
|
6691
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6691
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$h);
|
|
6692
6692
|
var _React$useRef = React.useRef(new Animated.Value(visible ? 1 : 0)),
|
|
6693
6693
|
opacity = _React$useRef.current;
|
|
6694
6694
|
var isFirstRendering = React.useRef(true);
|
|
@@ -6721,7 +6721,7 @@ var Status = function Status(_ref) {
|
|
|
6721
6721
|
}));
|
|
6722
6722
|
};
|
|
6723
6723
|
|
|
6724
|
-
var _excluded$
|
|
6724
|
+
var _excluded$g = ["content", "visible", "max", "intent", "style", "testID"];
|
|
6725
6725
|
var DEFAULT_MAX_NUMBER = 99;
|
|
6726
6726
|
var getPaddingState = function getPaddingState(content) {
|
|
6727
6727
|
return content.length > 1 ? 'wideContent' : 'narrowContent';
|
|
@@ -6736,7 +6736,7 @@ var Badge = function Badge(_ref) {
|
|
|
6736
6736
|
intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
|
|
6737
6737
|
style = _ref.style,
|
|
6738
6738
|
testID = _ref.testID,
|
|
6739
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6739
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$g);
|
|
6740
6740
|
var _React$useRef = React.useRef(new Animated.Value(visible ? 1 : 0)),
|
|
6741
6741
|
opacity = _React$useRef.current;
|
|
6742
6742
|
var isFirstRendering = React.useRef(true);
|
|
@@ -6840,7 +6840,7 @@ var omit = function omit(keys, props) {
|
|
|
6840
6840
|
return result;
|
|
6841
6841
|
};
|
|
6842
6842
|
|
|
6843
|
-
var _excluded$
|
|
6843
|
+
var _excluded$f = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
|
|
6844
6844
|
var getInactiveIcon = function getInactiveIcon(icon) {
|
|
6845
6845
|
var inactiveIcon = "".concat(icon, "-outlined");
|
|
6846
6846
|
return isHeroIcon(inactiveIcon) ? inactiveIcon : icon;
|
|
@@ -6851,7 +6851,7 @@ var BottomNavigation = function BottomNavigation(_ref) {
|
|
|
6851
6851
|
renderActiveTabOnly = _ref$renderActiveTabO === void 0 ? false : _ref$renderActiveTabO,
|
|
6852
6852
|
selectedTabKey = _ref.selectedTabKey,
|
|
6853
6853
|
tabs = _ref.tabs,
|
|
6854
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6854
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$f);
|
|
6855
6855
|
var insets = useSafeAreaInsets();
|
|
6856
6856
|
/**
|
|
6857
6857
|
* List of loaded tabs, tabs will be loaded when navigated to.
|
|
@@ -6919,6 +6919,8 @@ var BottomNavigation = function BottomNavigation(_ref) {
|
|
|
6919
6919
|
}))));
|
|
6920
6920
|
};
|
|
6921
6921
|
|
|
6922
|
+
var BottomSheetContext = /*#__PURE__*/createContext({});
|
|
6923
|
+
|
|
6922
6924
|
var StyledDivider = index$a(View)(function (_ref) {
|
|
6923
6925
|
var themeMarginHorizontal = _ref.themeMarginHorizontal,
|
|
6924
6926
|
themeMarginVertical = _ref.themeMarginVertical,
|
|
@@ -6936,13 +6938,13 @@ var StyledDivider = index$a(View)(function (_ref) {
|
|
|
6936
6938
|
}, horizontalMargin), verticalMargin);
|
|
6937
6939
|
});
|
|
6938
6940
|
|
|
6939
|
-
var _excluded$
|
|
6941
|
+
var _excluded$e = ["marginHorizontal", "marginVertical", "style", "testID"];
|
|
6940
6942
|
var Divider = function Divider(_ref) {
|
|
6941
6943
|
var marginHorizontal = _ref.marginHorizontal,
|
|
6942
6944
|
marginVertical = _ref.marginVertical,
|
|
6943
6945
|
style = _ref.style,
|
|
6944
6946
|
testID = _ref.testID,
|
|
6945
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6947
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$e);
|
|
6946
6948
|
return /*#__PURE__*/React.createElement(StyledDivider, _extends$1({}, nativeProps, {
|
|
6947
6949
|
themeMarginHorizontal: marginHorizontal,
|
|
6948
6950
|
themeMarginVertical: marginVertical,
|
|
@@ -7072,7 +7074,7 @@ var StyledLoadingDot = index$a(View)(function (_ref2) {
|
|
|
7072
7074
|
}, themeStyling());
|
|
7073
7075
|
});
|
|
7074
7076
|
|
|
7075
|
-
var _excluded$
|
|
7077
|
+
var _excluded$d = ["count", "size", "testID", "themeVariant"];
|
|
7076
7078
|
var AnimatedLoadingIndicatorWrapper = Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
|
|
7077
7079
|
var AnimatedLoadingDot = Animated.createAnimatedComponent(StyledLoadingDot);
|
|
7078
7080
|
var renderDotComponent = function renderDotComponent(_ref) {
|
|
@@ -7104,7 +7106,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
|
|
|
7104
7106
|
size = _ref2$size === void 0 ? 12 : _ref2$size,
|
|
7105
7107
|
testID = _ref2.testID,
|
|
7106
7108
|
themeVariant = _ref2.themeVariant,
|
|
7107
|
-
nativeProps = _objectWithoutProperties(_ref2, _excluded$
|
|
7109
|
+
nativeProps = _objectWithoutProperties(_ref2, _excluded$d);
|
|
7108
7110
|
var progressAnimation = useRef(new Animated.Value(0));
|
|
7109
7111
|
useEffect(function () {
|
|
7110
7112
|
var animation = Animated.loop(Animated.timing(progressAnimation.current, {
|
|
@@ -7500,6 +7502,36 @@ var Header = function Header(_ref) {
|
|
|
7500
7502
|
})) : null), showDivider ? /*#__PURE__*/React.createElement(Divider, null) : null);
|
|
7501
7503
|
};
|
|
7502
7504
|
|
|
7505
|
+
var _excluded$c = ["scrollEventThrottle"];
|
|
7506
|
+
var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
|
|
7507
|
+
var _ref$scrollEventThrot = _ref.scrollEventThrottle,
|
|
7508
|
+
scrollEventThrottle = _ref$scrollEventThrot === void 0 ? 100 : _ref$scrollEventThrot,
|
|
7509
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
7510
|
+
var _useContext = useContext(BottomSheetContext),
|
|
7511
|
+
setInternalShowDivider = _useContext.setInternalShowDivider;
|
|
7512
|
+
var onScrollBeginDrag = useCallback(function (e) {
|
|
7513
|
+
var _props$onScrollBeginD;
|
|
7514
|
+
setInternalShowDivider(true);
|
|
7515
|
+
props === null || props === void 0 ? void 0 : (_props$onScrollBeginD = props.onScrollBeginDrag) === null || _props$onScrollBeginD === void 0 ? void 0 : _props$onScrollBeginD.call(props, e);
|
|
7516
|
+
}, []);
|
|
7517
|
+
var onMomentumScrollBegin = useCallback(function (e) {
|
|
7518
|
+
var _props$onMomentumScro;
|
|
7519
|
+
setInternalShowDivider(true);
|
|
7520
|
+
props === null || props === void 0 ? void 0 : (_props$onMomentumScro = props.onMomentumScrollEnd) === null || _props$onMomentumScro === void 0 ? void 0 : _props$onMomentumScro.call(props, e);
|
|
7521
|
+
}, []);
|
|
7522
|
+
var onMomentumScrollEnd = useCallback(function (e) {
|
|
7523
|
+
var _props$onMomentumScro2;
|
|
7524
|
+
setInternalShowDivider(false);
|
|
7525
|
+
props === null || props === void 0 ? void 0 : (_props$onMomentumScro2 = props.onMomentumScrollEnd) === null || _props$onMomentumScro2 === void 0 ? void 0 : _props$onMomentumScro2.call(props, e);
|
|
7526
|
+
}, []);
|
|
7527
|
+
return /*#__PURE__*/React.createElement(ScrollView, _extends$1({}, props, {
|
|
7528
|
+
onScrollBeginDrag: onScrollBeginDrag,
|
|
7529
|
+
onMomentumScrollBegin: onMomentumScrollBegin,
|
|
7530
|
+
onMomentumScrollEnd: onMomentumScrollEnd,
|
|
7531
|
+
scrollEventThrottle: scrollEventThrottle
|
|
7532
|
+
}));
|
|
7533
|
+
};
|
|
7534
|
+
|
|
7503
7535
|
var BottomSheet = function BottomSheet(_ref) {
|
|
7504
7536
|
var open = _ref.open,
|
|
7505
7537
|
header = _ref.header,
|
|
@@ -7514,7 +7546,7 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7514
7546
|
_ref$hasBackdrop = _ref.hasBackdrop,
|
|
7515
7547
|
hasBackdrop = _ref$hasBackdrop === void 0 ? true : _ref$hasBackdrop,
|
|
7516
7548
|
_ref$showDivider = _ref.showDivider,
|
|
7517
|
-
showDivider = _ref$showDivider === void 0 ?
|
|
7549
|
+
showDivider = _ref$showDivider === void 0 ? false : _ref$showDivider,
|
|
7518
7550
|
style = _ref.style,
|
|
7519
7551
|
testID = _ref.testID,
|
|
7520
7552
|
_ref$keyboardAvoiding = _ref.keyboardAvoidingViewProps,
|
|
@@ -7527,6 +7559,10 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7527
7559
|
visible = _useState2[0],
|
|
7528
7560
|
setVisibility = _useState2[1];
|
|
7529
7561
|
var animatedValue = useRef(new Animated.Value(open ? 0 : 1));
|
|
7562
|
+
var _useState3 = useState(showDivider),
|
|
7563
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
7564
|
+
internalShowDivider = _useState4[0],
|
|
7565
|
+
setInternalShowDivider = _useState4[1];
|
|
7530
7566
|
useEffect(function () {
|
|
7531
7567
|
// Show the modal before the open animation start
|
|
7532
7568
|
if (open && !visible) {
|
|
@@ -7567,6 +7603,11 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7567
7603
|
inputRange: [0, 1],
|
|
7568
7604
|
outputRange: [0, 0.48]
|
|
7569
7605
|
}) : 0;
|
|
7606
|
+
var BottomSheetContextValue = useMemo(function () {
|
|
7607
|
+
return {
|
|
7608
|
+
setInternalShowDivider: setInternalShowDivider
|
|
7609
|
+
};
|
|
7610
|
+
}, [setInternalShowDivider]);
|
|
7570
7611
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
7571
7612
|
visible: visible,
|
|
7572
7613
|
onRequestClose: onRequestClose,
|
|
@@ -7592,13 +7633,18 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7592
7633
|
}]
|
|
7593
7634
|
}, header !== undefined ? /*#__PURE__*/React.createElement(Header, {
|
|
7594
7635
|
content: header,
|
|
7595
|
-
showDivider:
|
|
7636
|
+
showDivider: internalShowDivider,
|
|
7596
7637
|
onRequestClose: onRequestClose,
|
|
7597
7638
|
showCloseButton: showCloseButton
|
|
7598
|
-
}) : null,
|
|
7639
|
+
}) : null, /*#__PURE__*/React.createElement(BottomSheetContext.Provider, {
|
|
7640
|
+
value: BottomSheetContextValue
|
|
7641
|
+
}, children), footer ? /*#__PURE__*/React.createElement(Footer$1, {
|
|
7599
7642
|
showDivider: showDivider
|
|
7600
7643
|
}, footer) : null))));
|
|
7601
7644
|
};
|
|
7645
|
+
var BottomSheet$1 = Object.assign(BottomSheet, {
|
|
7646
|
+
ScrollView: BottomSheetScrollView
|
|
7647
|
+
});
|
|
7602
7648
|
|
|
7603
7649
|
var colors = {
|
|
7604
7650
|
backgroundColor: {
|
|
@@ -10928,7 +10974,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
10928
10974
|
helpText: helpText,
|
|
10929
10975
|
testID: testID,
|
|
10930
10976
|
style: style
|
|
10931
|
-
})), /*#__PURE__*/React.createElement(BottomSheet, {
|
|
10977
|
+
})), /*#__PURE__*/React.createElement(BottomSheet$1, {
|
|
10932
10978
|
open: open,
|
|
10933
10979
|
onRequestClose: function onRequestClose() {
|
|
10934
10980
|
return setOpen(false);
|
|
@@ -12998,7 +13044,7 @@ function MultiSelect(_ref) {
|
|
|
12998
13044
|
renderInputValue: renderSelectedValue !== undefined ? function (props) {
|
|
12999
13045
|
return renderSelectedValue(value, props);
|
|
13000
13046
|
} : undefined
|
|
13001
|
-
}))))), /*#__PURE__*/React.createElement(BottomSheet, {
|
|
13047
|
+
}))))), /*#__PURE__*/React.createElement(BottomSheet$1, {
|
|
13002
13048
|
open: open,
|
|
13003
13049
|
onRequestClose: function onRequestClose() {
|
|
13004
13050
|
return setOpen(false);
|
|
@@ -13174,7 +13220,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13174
13220
|
renderInputValue: renderSelectedValue !== undefined ? function (props) {
|
|
13175
13221
|
return renderSelectedValue(value, props);
|
|
13176
13222
|
} : undefined
|
|
13177
|
-
}))))), /*#__PURE__*/React.createElement(BottomSheet, {
|
|
13223
|
+
}))))), /*#__PURE__*/React.createElement(BottomSheet$1, {
|
|
13178
13224
|
open: open,
|
|
13179
13225
|
onRequestClose: function onRequestClose() {
|
|
13180
13226
|
return setOpen(false);
|
|
@@ -14011,7 +14057,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
14011
14057
|
helpText: helpText,
|
|
14012
14058
|
testID: testID,
|
|
14013
14059
|
style: style
|
|
14014
|
-
})), /*#__PURE__*/React.createElement(BottomSheet, {
|
|
14060
|
+
})), /*#__PURE__*/React.createElement(BottomSheet$1, {
|
|
14015
14061
|
open: open,
|
|
14016
14062
|
onRequestClose: function onRequestClose() {
|
|
14017
14063
|
return setOpen(false);
|
|
@@ -30834,4 +30880,4 @@ var index = Object.assign(RichTextEditor$1, {
|
|
|
30834
30880
|
Toolbar: EditorToolbar
|
|
30835
30881
|
});
|
|
30836
30882
|
|
|
30837
|
-
export { Accordion, Alert, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet, Box, CompoundButton as Button, Calendar, index$8 as Card, Checkbox, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, index$6 as FAB, Icon, Image, List, PinInput, Progress, CompoundRadio as Radio, RefreshControl, index as RichTextEditor, SectionHeading, index$4 as Select, Slider, Spinner, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, workSystemPalette };
|
|
30883
|
+
export { Accordion, Alert, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar, index$8 as Card, Checkbox, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, index$6 as FAB, Icon, Image, List, PinInput, Progress, CompoundRadio as Radio, RefreshControl, index as RichTextEditor, SectionHeading, index$4 as Select, Slider, Spinner, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, workSystemPalette };
|
package/lib/index.js
CHANGED
|
@@ -5730,7 +5730,7 @@ var StyledText$3 = index$a(reactNative.Text)(function (_ref) {
|
|
|
5730
5730
|
});
|
|
5731
5731
|
});
|
|
5732
5732
|
|
|
5733
|
-
var _excluded$
|
|
5733
|
+
var _excluded$k = ["children", "fontSize", "fontWeight", "intent", "typeface"];
|
|
5734
5734
|
var Text = function Text(_ref) {
|
|
5735
5735
|
var children = _ref.children,
|
|
5736
5736
|
_ref$fontSize = _ref.fontSize,
|
|
@@ -5741,7 +5741,7 @@ var Text = function Text(_ref) {
|
|
|
5741
5741
|
intent = _ref$intent === void 0 ? 'body' : _ref$intent,
|
|
5742
5742
|
_ref$typeface = _ref.typeface,
|
|
5743
5743
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
5744
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
5744
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$k);
|
|
5745
5745
|
return /*#__PURE__*/React__default["default"].createElement(StyledText$3, _extends$1({}, nativeProps, {
|
|
5746
5746
|
themeFontSize: fontSize,
|
|
5747
5747
|
themeFontWeight: fontWeight,
|
|
@@ -6220,10 +6220,10 @@ var StyledHeroIcon = index$a(HeroIcon)(function (_ref) {
|
|
|
6220
6220
|
};
|
|
6221
6221
|
});
|
|
6222
6222
|
|
|
6223
|
-
var _excluded$
|
|
6223
|
+
var _excluded$j = ["style"];
|
|
6224
6224
|
var AnimatedIcon = function AnimatedIcon(_ref) {
|
|
6225
6225
|
var style = _ref.style,
|
|
6226
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
6226
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$j);
|
|
6227
6227
|
var rotateAnimation = React.useRef(new reactNative.Animated.Value(0));
|
|
6228
6228
|
React.useEffect(function () {
|
|
6229
6229
|
var animation = reactNative.Animated.loop(reactNative.Animated.timing(rotateAnimation.current, {
|
|
@@ -6305,7 +6305,7 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
|
6305
6305
|
}, content));
|
|
6306
6306
|
};
|
|
6307
6307
|
|
|
6308
|
-
var _excluded$
|
|
6308
|
+
var _excluded$i = ["key"];
|
|
6309
6309
|
var Accordion = function Accordion(_ref) {
|
|
6310
6310
|
var items = _ref.items,
|
|
6311
6311
|
activeItemKey = _ref.activeItemKey,
|
|
@@ -6326,7 +6326,7 @@ var Accordion = function Accordion(_ref) {
|
|
|
6326
6326
|
testID: testID
|
|
6327
6327
|
}, items.map(function (_ref2, index) {
|
|
6328
6328
|
var key = _ref2.key,
|
|
6329
|
-
props = _objectWithoutProperties(_ref2, _excluded$
|
|
6329
|
+
props = _objectWithoutProperties(_ref2, _excluded$i);
|
|
6330
6330
|
var open = _activeItemKey === key;
|
|
6331
6331
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
6332
6332
|
key: key
|
|
@@ -6708,7 +6708,7 @@ var StyledStatus = index$a(reactNative.Animated.View)(function (_ref3) {
|
|
|
6708
6708
|
};
|
|
6709
6709
|
});
|
|
6710
6710
|
|
|
6711
|
-
var _excluded$
|
|
6711
|
+
var _excluded$h = ["children", "visible", "intent", "style", "testID"];
|
|
6712
6712
|
var Status = function Status(_ref) {
|
|
6713
6713
|
var children = _ref.children,
|
|
6714
6714
|
_ref$visible = _ref.visible,
|
|
@@ -6717,7 +6717,7 @@ var Status = function Status(_ref) {
|
|
|
6717
6717
|
intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
|
|
6718
6718
|
style = _ref.style,
|
|
6719
6719
|
testID = _ref.testID,
|
|
6720
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6720
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$h);
|
|
6721
6721
|
var _React$useRef = React__default["default"].useRef(new reactNative.Animated.Value(visible ? 1 : 0)),
|
|
6722
6722
|
opacity = _React$useRef.current;
|
|
6723
6723
|
var isFirstRendering = React__default["default"].useRef(true);
|
|
@@ -6750,7 +6750,7 @@ var Status = function Status(_ref) {
|
|
|
6750
6750
|
}));
|
|
6751
6751
|
};
|
|
6752
6752
|
|
|
6753
|
-
var _excluded$
|
|
6753
|
+
var _excluded$g = ["content", "visible", "max", "intent", "style", "testID"];
|
|
6754
6754
|
var DEFAULT_MAX_NUMBER = 99;
|
|
6755
6755
|
var getPaddingState = function getPaddingState(content) {
|
|
6756
6756
|
return content.length > 1 ? 'wideContent' : 'narrowContent';
|
|
@@ -6765,7 +6765,7 @@ var Badge = function Badge(_ref) {
|
|
|
6765
6765
|
intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
|
|
6766
6766
|
style = _ref.style,
|
|
6767
6767
|
testID = _ref.testID,
|
|
6768
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6768
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$g);
|
|
6769
6769
|
var _React$useRef = React__default["default"].useRef(new reactNative.Animated.Value(visible ? 1 : 0)),
|
|
6770
6770
|
opacity = _React$useRef.current;
|
|
6771
6771
|
var isFirstRendering = React__default["default"].useRef(true);
|
|
@@ -6869,7 +6869,7 @@ var omit = function omit(keys, props) {
|
|
|
6869
6869
|
return result;
|
|
6870
6870
|
};
|
|
6871
6871
|
|
|
6872
|
-
var _excluded$
|
|
6872
|
+
var _excluded$f = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
|
|
6873
6873
|
var getInactiveIcon = function getInactiveIcon(icon) {
|
|
6874
6874
|
var inactiveIcon = "".concat(icon, "-outlined");
|
|
6875
6875
|
return isHeroIcon(inactiveIcon) ? inactiveIcon : icon;
|
|
@@ -6880,7 +6880,7 @@ var BottomNavigation = function BottomNavigation(_ref) {
|
|
|
6880
6880
|
renderActiveTabOnly = _ref$renderActiveTabO === void 0 ? false : _ref$renderActiveTabO,
|
|
6881
6881
|
selectedTabKey = _ref.selectedTabKey,
|
|
6882
6882
|
tabs = _ref.tabs,
|
|
6883
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6883
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$f);
|
|
6884
6884
|
var insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
6885
6885
|
/**
|
|
6886
6886
|
* List of loaded tabs, tabs will be loaded when navigated to.
|
|
@@ -6948,6 +6948,8 @@ var BottomNavigation = function BottomNavigation(_ref) {
|
|
|
6948
6948
|
}))));
|
|
6949
6949
|
};
|
|
6950
6950
|
|
|
6951
|
+
var BottomSheetContext = /*#__PURE__*/React.createContext({});
|
|
6952
|
+
|
|
6951
6953
|
var StyledDivider = index$a(reactNative.View)(function (_ref) {
|
|
6952
6954
|
var themeMarginHorizontal = _ref.themeMarginHorizontal,
|
|
6953
6955
|
themeMarginVertical = _ref.themeMarginVertical,
|
|
@@ -6965,13 +6967,13 @@ var StyledDivider = index$a(reactNative.View)(function (_ref) {
|
|
|
6965
6967
|
}, horizontalMargin), verticalMargin);
|
|
6966
6968
|
});
|
|
6967
6969
|
|
|
6968
|
-
var _excluded$
|
|
6970
|
+
var _excluded$e = ["marginHorizontal", "marginVertical", "style", "testID"];
|
|
6969
6971
|
var Divider = function Divider(_ref) {
|
|
6970
6972
|
var marginHorizontal = _ref.marginHorizontal,
|
|
6971
6973
|
marginVertical = _ref.marginVertical,
|
|
6972
6974
|
style = _ref.style,
|
|
6973
6975
|
testID = _ref.testID,
|
|
6974
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6976
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$e);
|
|
6975
6977
|
return /*#__PURE__*/React__default["default"].createElement(StyledDivider, _extends$1({}, nativeProps, {
|
|
6976
6978
|
themeMarginHorizontal: marginHorizontal,
|
|
6977
6979
|
themeMarginVertical: marginVertical,
|
|
@@ -7101,7 +7103,7 @@ var StyledLoadingDot = index$a(reactNative.View)(function (_ref2) {
|
|
|
7101
7103
|
}, themeStyling());
|
|
7102
7104
|
});
|
|
7103
7105
|
|
|
7104
|
-
var _excluded$
|
|
7106
|
+
var _excluded$d = ["count", "size", "testID", "themeVariant"];
|
|
7105
7107
|
var AnimatedLoadingIndicatorWrapper = reactNative.Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
|
|
7106
7108
|
var AnimatedLoadingDot = reactNative.Animated.createAnimatedComponent(StyledLoadingDot);
|
|
7107
7109
|
var renderDotComponent = function renderDotComponent(_ref) {
|
|
@@ -7133,7 +7135,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
|
|
|
7133
7135
|
size = _ref2$size === void 0 ? 12 : _ref2$size,
|
|
7134
7136
|
testID = _ref2.testID,
|
|
7135
7137
|
themeVariant = _ref2.themeVariant,
|
|
7136
|
-
nativeProps = _objectWithoutProperties(_ref2, _excluded$
|
|
7138
|
+
nativeProps = _objectWithoutProperties(_ref2, _excluded$d);
|
|
7137
7139
|
var progressAnimation = React.useRef(new reactNative.Animated.Value(0));
|
|
7138
7140
|
React.useEffect(function () {
|
|
7139
7141
|
var animation = reactNative.Animated.loop(reactNative.Animated.timing(progressAnimation.current, {
|
|
@@ -7529,6 +7531,36 @@ var Header = function Header(_ref) {
|
|
|
7529
7531
|
})) : null), showDivider ? /*#__PURE__*/React__default["default"].createElement(Divider, null) : null);
|
|
7530
7532
|
};
|
|
7531
7533
|
|
|
7534
|
+
var _excluded$c = ["scrollEventThrottle"];
|
|
7535
|
+
var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
|
|
7536
|
+
var _ref$scrollEventThrot = _ref.scrollEventThrottle,
|
|
7537
|
+
scrollEventThrottle = _ref$scrollEventThrot === void 0 ? 100 : _ref$scrollEventThrot,
|
|
7538
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
7539
|
+
var _useContext = React.useContext(BottomSheetContext),
|
|
7540
|
+
setInternalShowDivider = _useContext.setInternalShowDivider;
|
|
7541
|
+
var onScrollBeginDrag = React.useCallback(function (e) {
|
|
7542
|
+
var _props$onScrollBeginD;
|
|
7543
|
+
setInternalShowDivider(true);
|
|
7544
|
+
props === null || props === void 0 ? void 0 : (_props$onScrollBeginD = props.onScrollBeginDrag) === null || _props$onScrollBeginD === void 0 ? void 0 : _props$onScrollBeginD.call(props, e);
|
|
7545
|
+
}, []);
|
|
7546
|
+
var onMomentumScrollBegin = React.useCallback(function (e) {
|
|
7547
|
+
var _props$onMomentumScro;
|
|
7548
|
+
setInternalShowDivider(true);
|
|
7549
|
+
props === null || props === void 0 ? void 0 : (_props$onMomentumScro = props.onMomentumScrollEnd) === null || _props$onMomentumScro === void 0 ? void 0 : _props$onMomentumScro.call(props, e);
|
|
7550
|
+
}, []);
|
|
7551
|
+
var onMomentumScrollEnd = React.useCallback(function (e) {
|
|
7552
|
+
var _props$onMomentumScro2;
|
|
7553
|
+
setInternalShowDivider(false);
|
|
7554
|
+
props === null || props === void 0 ? void 0 : (_props$onMomentumScro2 = props.onMomentumScrollEnd) === null || _props$onMomentumScro2 === void 0 ? void 0 : _props$onMomentumScro2.call(props, e);
|
|
7555
|
+
}, []);
|
|
7556
|
+
return /*#__PURE__*/React__default["default"].createElement(reactNative.ScrollView, _extends$1({}, props, {
|
|
7557
|
+
onScrollBeginDrag: onScrollBeginDrag,
|
|
7558
|
+
onMomentumScrollBegin: onMomentumScrollBegin,
|
|
7559
|
+
onMomentumScrollEnd: onMomentumScrollEnd,
|
|
7560
|
+
scrollEventThrottle: scrollEventThrottle
|
|
7561
|
+
}));
|
|
7562
|
+
};
|
|
7563
|
+
|
|
7532
7564
|
var BottomSheet = function BottomSheet(_ref) {
|
|
7533
7565
|
var open = _ref.open,
|
|
7534
7566
|
header = _ref.header,
|
|
@@ -7543,7 +7575,7 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7543
7575
|
_ref$hasBackdrop = _ref.hasBackdrop,
|
|
7544
7576
|
hasBackdrop = _ref$hasBackdrop === void 0 ? true : _ref$hasBackdrop,
|
|
7545
7577
|
_ref$showDivider = _ref.showDivider,
|
|
7546
|
-
showDivider = _ref$showDivider === void 0 ?
|
|
7578
|
+
showDivider = _ref$showDivider === void 0 ? false : _ref$showDivider,
|
|
7547
7579
|
style = _ref.style,
|
|
7548
7580
|
testID = _ref.testID,
|
|
7549
7581
|
_ref$keyboardAvoiding = _ref.keyboardAvoidingViewProps,
|
|
@@ -7556,6 +7588,10 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7556
7588
|
visible = _useState2[0],
|
|
7557
7589
|
setVisibility = _useState2[1];
|
|
7558
7590
|
var animatedValue = React.useRef(new reactNative.Animated.Value(open ? 0 : 1));
|
|
7591
|
+
var _useState3 = React.useState(showDivider),
|
|
7592
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
7593
|
+
internalShowDivider = _useState4[0],
|
|
7594
|
+
setInternalShowDivider = _useState4[1];
|
|
7559
7595
|
React.useEffect(function () {
|
|
7560
7596
|
// Show the modal before the open animation start
|
|
7561
7597
|
if (open && !visible) {
|
|
@@ -7596,6 +7632,11 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7596
7632
|
inputRange: [0, 1],
|
|
7597
7633
|
outputRange: [0, 0.48]
|
|
7598
7634
|
}) : 0;
|
|
7635
|
+
var BottomSheetContextValue = React.useMemo(function () {
|
|
7636
|
+
return {
|
|
7637
|
+
setInternalShowDivider: setInternalShowDivider
|
|
7638
|
+
};
|
|
7639
|
+
}, [setInternalShowDivider]);
|
|
7599
7640
|
return /*#__PURE__*/React__default["default"].createElement(reactNative.Modal, {
|
|
7600
7641
|
visible: visible,
|
|
7601
7642
|
onRequestClose: onRequestClose,
|
|
@@ -7621,13 +7662,18 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7621
7662
|
}]
|
|
7622
7663
|
}, header !== undefined ? /*#__PURE__*/React__default["default"].createElement(Header, {
|
|
7623
7664
|
content: header,
|
|
7624
|
-
showDivider:
|
|
7665
|
+
showDivider: internalShowDivider,
|
|
7625
7666
|
onRequestClose: onRequestClose,
|
|
7626
7667
|
showCloseButton: showCloseButton
|
|
7627
|
-
}) : null,
|
|
7668
|
+
}) : null, /*#__PURE__*/React__default["default"].createElement(BottomSheetContext.Provider, {
|
|
7669
|
+
value: BottomSheetContextValue
|
|
7670
|
+
}, children), footer ? /*#__PURE__*/React__default["default"].createElement(Footer$1, {
|
|
7628
7671
|
showDivider: showDivider
|
|
7629
7672
|
}, footer) : null))));
|
|
7630
7673
|
};
|
|
7674
|
+
var BottomSheet$1 = Object.assign(BottomSheet, {
|
|
7675
|
+
ScrollView: BottomSheetScrollView
|
|
7676
|
+
});
|
|
7631
7677
|
|
|
7632
7678
|
var colors = {
|
|
7633
7679
|
backgroundColor: {
|
|
@@ -10957,7 +11003,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
10957
11003
|
helpText: helpText,
|
|
10958
11004
|
testID: testID,
|
|
10959
11005
|
style: style
|
|
10960
|
-
})), /*#__PURE__*/React__default["default"].createElement(BottomSheet, {
|
|
11006
|
+
})), /*#__PURE__*/React__default["default"].createElement(BottomSheet$1, {
|
|
10961
11007
|
open: open,
|
|
10962
11008
|
onRequestClose: function onRequestClose() {
|
|
10963
11009
|
return setOpen(false);
|
|
@@ -13027,7 +13073,7 @@ function MultiSelect(_ref) {
|
|
|
13027
13073
|
renderInputValue: renderSelectedValue !== undefined ? function (props) {
|
|
13028
13074
|
return renderSelectedValue(value, props);
|
|
13029
13075
|
} : undefined
|
|
13030
|
-
}))))), /*#__PURE__*/React__default["default"].createElement(BottomSheet, {
|
|
13076
|
+
}))))), /*#__PURE__*/React__default["default"].createElement(BottomSheet$1, {
|
|
13031
13077
|
open: open,
|
|
13032
13078
|
onRequestClose: function onRequestClose() {
|
|
13033
13079
|
return setOpen(false);
|
|
@@ -13203,7 +13249,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
13203
13249
|
renderInputValue: renderSelectedValue !== undefined ? function (props) {
|
|
13204
13250
|
return renderSelectedValue(value, props);
|
|
13205
13251
|
} : undefined
|
|
13206
|
-
}))))), /*#__PURE__*/React__default["default"].createElement(BottomSheet, {
|
|
13252
|
+
}))))), /*#__PURE__*/React__default["default"].createElement(BottomSheet$1, {
|
|
13207
13253
|
open: open,
|
|
13208
13254
|
onRequestClose: function onRequestClose() {
|
|
13209
13255
|
return setOpen(false);
|
|
@@ -14040,7 +14086,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
14040
14086
|
helpText: helpText,
|
|
14041
14087
|
testID: testID,
|
|
14042
14088
|
style: style
|
|
14043
|
-
})), /*#__PURE__*/React__default["default"].createElement(BottomSheet, {
|
|
14089
|
+
})), /*#__PURE__*/React__default["default"].createElement(BottomSheet$1, {
|
|
14044
14090
|
open: open,
|
|
14045
14091
|
onRequestClose: function onRequestClose() {
|
|
14046
14092
|
return setOpen(false);
|
|
@@ -30869,7 +30915,7 @@ exports.Attachment = Attachment;
|
|
|
30869
30915
|
exports.Avatar = index$9;
|
|
30870
30916
|
exports.Badge = Badge$1;
|
|
30871
30917
|
exports.BottomNavigation = BottomNavigation;
|
|
30872
|
-
exports.BottomSheet = BottomSheet;
|
|
30918
|
+
exports.BottomSheet = BottomSheet$1;
|
|
30873
30919
|
exports.Box = Box;
|
|
30874
30920
|
exports.Button = CompoundButton;
|
|
30875
30921
|
exports.Calendar = Calendar;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.2.
|
|
24
|
+
"@hero-design/colors": "8.2.2",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@babel/preset-typescript": "^7.17.12",
|
|
45
45
|
"@babel/runtime": "^7.18.9",
|
|
46
46
|
"@emotion/jest": "^11.9.3",
|
|
47
|
-
"@hero-design/eslint-plugin": "8.2.
|
|
47
|
+
"@hero-design/eslint-plugin": "8.2.2",
|
|
48
48
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
49
49
|
"@react-native-community/slider": "4.1.12",
|
|
50
50
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@types/react-native": "^0.67.7",
|
|
61
61
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
62
62
|
"babel-plugin-inline-import": "^3.0.0",
|
|
63
|
-
"eslint-config-hd": "8.2.
|
|
63
|
+
"eslint-config-hd": "8.2.2",
|
|
64
64
|
"jest": "^27.3.1",
|
|
65
|
-
"prettier-config-hd": "8.2.
|
|
65
|
+
"prettier-config-hd": "8.2.2",
|
|
66
66
|
"react": "18.0.0",
|
|
67
67
|
"react-native": "0.69.7",
|
|
68
68
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
export type BottomSheetContextType = {
|
|
4
|
+
setInternalShowDivider: (value: boolean) => void;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const BottomSheetContext = createContext<BottomSheetContextType>(
|
|
8
|
+
{} as BottomSheetContextType
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export default BottomSheetContext;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useContext, useCallback } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
NativeScrollEvent,
|
|
4
|
+
NativeSyntheticEvent,
|
|
5
|
+
ScrollView,
|
|
6
|
+
ScrollViewProps,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import BottomSheetContext, {
|
|
9
|
+
BottomSheetContextType,
|
|
10
|
+
} from './BottomSheetContext';
|
|
11
|
+
|
|
12
|
+
const BottomSheetScrollView = ({
|
|
13
|
+
scrollEventThrottle = 100,
|
|
14
|
+
...props
|
|
15
|
+
}: ScrollViewProps): JSX.Element => {
|
|
16
|
+
const { setInternalShowDivider } =
|
|
17
|
+
useContext<BottomSheetContextType>(BottomSheetContext);
|
|
18
|
+
|
|
19
|
+
const onScrollBeginDrag = useCallback(
|
|
20
|
+
(e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
21
|
+
setInternalShowDivider(true);
|
|
22
|
+
|
|
23
|
+
props?.onScrollBeginDrag?.(e);
|
|
24
|
+
},
|
|
25
|
+
[]
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const onMomentumScrollBegin = useCallback(
|
|
29
|
+
(e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
30
|
+
setInternalShowDivider(true);
|
|
31
|
+
|
|
32
|
+
props?.onMomentumScrollEnd?.(e);
|
|
33
|
+
},
|
|
34
|
+
[]
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const onMomentumScrollEnd = useCallback(
|
|
38
|
+
(e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
39
|
+
setInternalShowDivider(false);
|
|
40
|
+
|
|
41
|
+
props?.onMomentumScrollEnd?.(e);
|
|
42
|
+
},
|
|
43
|
+
[]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<ScrollView
|
|
48
|
+
{...props}
|
|
49
|
+
onScrollBeginDrag={onScrollBeginDrag}
|
|
50
|
+
onMomentumScrollBegin={onMomentumScrollBegin}
|
|
51
|
+
onMomentumScrollEnd={onMomentumScrollEnd}
|
|
52
|
+
scrollEventThrottle={scrollEventThrottle}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default BottomSheetScrollView;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`BottomSheet renders correctly with BottomSheet.ScrollView 1`] = `
|
|
4
|
+
<Modal
|
|
5
|
+
hardwareAccelerated={false}
|
|
6
|
+
onRequestClose={[MockFunction]}
|
|
7
|
+
transparent={true}
|
|
8
|
+
visible={false}
|
|
9
|
+
/>
|
|
10
|
+
`;
|
|
11
|
+
|
|
3
12
|
exports[`BottomSheet renders correctly with close state 1`] = `
|
|
4
13
|
<Modal
|
|
5
14
|
hardwareAccelerated={false}
|
|
@@ -196,34 +205,10 @@ exports[`BottomSheet renders correctly with open state 1`] = `
|
|
|
196
205
|
</View>
|
|
197
206
|
</View>
|
|
198
207
|
</View>
|
|
199
|
-
<View
|
|
200
|
-
style={
|
|
201
|
-
Array [
|
|
202
|
-
Object {
|
|
203
|
-
"borderBottomColor": "#e8e9ea",
|
|
204
|
-
"borderBottomWidth": 1,
|
|
205
|
-
"maxWidth": "100%",
|
|
206
|
-
},
|
|
207
|
-
undefined,
|
|
208
|
-
]
|
|
209
|
-
}
|
|
210
|
-
/>
|
|
211
208
|
<Text>
|
|
212
209
|
Content
|
|
213
210
|
</Text>
|
|
214
211
|
<View>
|
|
215
|
-
<View
|
|
216
|
-
style={
|
|
217
|
-
Array [
|
|
218
|
-
Object {
|
|
219
|
-
"borderBottomColor": "#e8e9ea",
|
|
220
|
-
"borderBottomWidth": 1,
|
|
221
|
-
"maxWidth": "100%",
|
|
222
|
-
},
|
|
223
|
-
undefined,
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
/>
|
|
227
212
|
<View
|
|
228
213
|
style={
|
|
229
214
|
Array [
|
|
@@ -40,6 +40,23 @@ describe('BottomSheet', () => {
|
|
|
40
40
|
expect(toJSON()).toMatchSnapshot();
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
+
it('renders correctly with BottomSheet.ScrollView', () => {
|
|
44
|
+
const { toJSON } = renderWithTheme(
|
|
45
|
+
<BottomSheet
|
|
46
|
+
open={false}
|
|
47
|
+
header="Title"
|
|
48
|
+
footer={<Button title="Footer CTA" />}
|
|
49
|
+
onRequestClose={jest.fn()}
|
|
50
|
+
>
|
|
51
|
+
<BottomSheet.ScrollView>
|
|
52
|
+
<Content />
|
|
53
|
+
</BottomSheet.ScrollView>
|
|
54
|
+
</BottomSheet>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
expect(toJSON()).toMatchSnapshot();
|
|
58
|
+
});
|
|
59
|
+
|
|
43
60
|
describe('Header', () => {
|
|
44
61
|
it('renders default header correctly', () => {
|
|
45
62
|
const { getByText } = renderWithTheme(
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
4
|
import {
|
|
3
5
|
Animated,
|
|
4
6
|
Dimensions,
|
|
@@ -7,8 +9,7 @@ import {
|
|
|
7
9
|
Modal,
|
|
8
10
|
Platform,
|
|
9
11
|
} from 'react-native';
|
|
10
|
-
import
|
|
11
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
12
|
+
import BottomSheetContext from './BottomSheetContext';
|
|
12
13
|
import Footer from './Footer';
|
|
13
14
|
import Header from './Header';
|
|
14
15
|
import {
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
StyledKeyboardAvoidingView,
|
|
18
19
|
StyledWrapper,
|
|
19
20
|
} from './StyledBottomSheet';
|
|
21
|
+
import ScrollView from './ScrollView';
|
|
20
22
|
|
|
21
23
|
interface BottomSheetProps {
|
|
22
24
|
/**
|
|
@@ -72,7 +74,6 @@ interface BottomSheetProps {
|
|
|
72
74
|
* Testing id of the component.
|
|
73
75
|
*/
|
|
74
76
|
testID?: string;
|
|
75
|
-
|
|
76
77
|
/**
|
|
77
78
|
* keyboardAvoidingView's props
|
|
78
79
|
* */
|
|
@@ -90,7 +91,7 @@ const BottomSheet = ({
|
|
|
90
91
|
onDismiss,
|
|
91
92
|
showCloseButton = true,
|
|
92
93
|
hasBackdrop = true,
|
|
93
|
-
showDivider =
|
|
94
|
+
showDivider = false,
|
|
94
95
|
style,
|
|
95
96
|
testID,
|
|
96
97
|
keyboardAvoidingViewProps = {},
|
|
@@ -100,6 +101,8 @@ const BottomSheet = ({
|
|
|
100
101
|
// Internal state to control modal open/close timing with animation
|
|
101
102
|
const [visible, setVisibility] = useState<boolean>(open);
|
|
102
103
|
const animatedValue = useRef(new Animated.Value(open ? 0 : 1));
|
|
104
|
+
const [internalShowDivider, setInternalShowDivider] =
|
|
105
|
+
useState<boolean>(showDivider);
|
|
103
106
|
|
|
104
107
|
useEffect(() => {
|
|
105
108
|
// Show the modal before the open animation start
|
|
@@ -146,6 +149,11 @@ const BottomSheet = ({
|
|
|
146
149
|
})
|
|
147
150
|
: 0;
|
|
148
151
|
|
|
152
|
+
const BottomSheetContextValue = useMemo(
|
|
153
|
+
() => ({ setInternalShowDivider }),
|
|
154
|
+
[setInternalShowDivider]
|
|
155
|
+
);
|
|
156
|
+
|
|
149
157
|
return (
|
|
150
158
|
<Modal
|
|
151
159
|
visible={visible}
|
|
@@ -179,12 +187,15 @@ const BottomSheet = ({
|
|
|
179
187
|
{header !== undefined ? (
|
|
180
188
|
<Header
|
|
181
189
|
content={header}
|
|
182
|
-
showDivider={
|
|
190
|
+
showDivider={internalShowDivider}
|
|
183
191
|
onRequestClose={onRequestClose}
|
|
184
192
|
showCloseButton={showCloseButton}
|
|
185
193
|
/>
|
|
186
194
|
) : null}
|
|
187
|
-
{
|
|
195
|
+
<BottomSheetContext.Provider value={BottomSheetContextValue}>
|
|
196
|
+
{children}
|
|
197
|
+
</BottomSheetContext.Provider>
|
|
198
|
+
|
|
188
199
|
{footer ? (
|
|
189
200
|
<Footer showDivider={showDivider}>{footer}</Footer>
|
|
190
201
|
) : null}
|
|
@@ -195,4 +206,6 @@ const BottomSheet = ({
|
|
|
195
206
|
);
|
|
196
207
|
};
|
|
197
208
|
|
|
198
|
-
export default BottomSheet
|
|
209
|
+
export default Object.assign(BottomSheet, {
|
|
210
|
+
ScrollView,
|
|
211
|
+
});
|
|
@@ -428,18 +428,6 @@ exports[`DatePickerIOS renders correctly 1`] = `
|
|
|
428
428
|
</View>
|
|
429
429
|
</View>
|
|
430
430
|
</View>
|
|
431
|
-
<View
|
|
432
|
-
style={
|
|
433
|
-
Array [
|
|
434
|
-
Object {
|
|
435
|
-
"borderBottomColor": "#e8e9ea",
|
|
436
|
-
"borderBottomWidth": 1,
|
|
437
|
-
"maxWidth": "100%",
|
|
438
|
-
},
|
|
439
|
-
undefined,
|
|
440
|
-
]
|
|
441
|
-
}
|
|
442
|
-
/>
|
|
443
431
|
<View
|
|
444
432
|
style={
|
|
445
433
|
Array [
|
|
@@ -464,18 +452,6 @@ exports[`DatePickerIOS renders correctly 1`] = `
|
|
|
464
452
|
/>
|
|
465
453
|
</View>
|
|
466
454
|
<View>
|
|
467
|
-
<View
|
|
468
|
-
style={
|
|
469
|
-
Array [
|
|
470
|
-
Object {
|
|
471
|
-
"borderBottomColor": "#e8e9ea",
|
|
472
|
-
"borderBottomWidth": 1,
|
|
473
|
-
"maxWidth": "100%",
|
|
474
|
-
},
|
|
475
|
-
undefined,
|
|
476
|
-
]
|
|
477
|
-
}
|
|
478
|
-
/>
|
|
479
455
|
<View
|
|
480
456
|
style={
|
|
481
457
|
Array [
|
|
@@ -395,18 +395,6 @@ Array [
|
|
|
395
395
|
</View>
|
|
396
396
|
</View>
|
|
397
397
|
</View>
|
|
398
|
-
<View
|
|
399
|
-
style={
|
|
400
|
-
Array [
|
|
401
|
-
Object {
|
|
402
|
-
"borderBottomColor": "#e8e9ea",
|
|
403
|
-
"borderBottomWidth": 1,
|
|
404
|
-
"maxWidth": "100%",
|
|
405
|
-
},
|
|
406
|
-
undefined,
|
|
407
|
-
]
|
|
408
|
-
}
|
|
409
|
-
/>
|
|
410
398
|
<RCTScrollView
|
|
411
399
|
ListFooterComponent={null}
|
|
412
400
|
data={
|
|
@@ -1288,18 +1276,6 @@ Array [
|
|
|
1288
1276
|
</View>
|
|
1289
1277
|
</RCTScrollView>
|
|
1290
1278
|
<View>
|
|
1291
|
-
<View
|
|
1292
|
-
style={
|
|
1293
|
-
Array [
|
|
1294
|
-
Object {
|
|
1295
|
-
"borderBottomColor": "#e8e9ea",
|
|
1296
|
-
"borderBottomWidth": 1,
|
|
1297
|
-
"maxWidth": "100%",
|
|
1298
|
-
},
|
|
1299
|
-
undefined,
|
|
1300
|
-
]
|
|
1301
|
-
}
|
|
1302
|
-
/>
|
|
1303
1279
|
<View
|
|
1304
1280
|
style={
|
|
1305
1281
|
Array [
|
|
@@ -1985,18 +1961,6 @@ Array [
|
|
|
1985
1961
|
</View>
|
|
1986
1962
|
</View>
|
|
1987
1963
|
</View>
|
|
1988
|
-
<View
|
|
1989
|
-
style={
|
|
1990
|
-
Array [
|
|
1991
|
-
Object {
|
|
1992
|
-
"borderBottomColor": "#e8e9ea",
|
|
1993
|
-
"borderBottomWidth": 1,
|
|
1994
|
-
"maxWidth": "100%",
|
|
1995
|
-
},
|
|
1996
|
-
undefined,
|
|
1997
|
-
]
|
|
1998
|
-
}
|
|
1999
|
-
/>
|
|
2000
1964
|
<RCTScrollView
|
|
2001
1965
|
ListFooterComponent={null}
|
|
2002
1966
|
data={
|
|
@@ -3055,18 +3019,6 @@ Array [
|
|
|
3055
3019
|
</View>
|
|
3056
3020
|
</RCTScrollView>
|
|
3057
3021
|
<View>
|
|
3058
|
-
<View
|
|
3059
|
-
style={
|
|
3060
|
-
Array [
|
|
3061
|
-
Object {
|
|
3062
|
-
"borderBottomColor": "#e8e9ea",
|
|
3063
|
-
"borderBottomWidth": 1,
|
|
3064
|
-
"maxWidth": "100%",
|
|
3065
|
-
},
|
|
3066
|
-
undefined,
|
|
3067
|
-
]
|
|
3068
|
-
}
|
|
3069
|
-
/>
|
|
3070
3022
|
<View
|
|
3071
3023
|
style={
|
|
3072
3024
|
Array [
|
|
@@ -3765,18 +3717,6 @@ Array [
|
|
|
3765
3717
|
</View>
|
|
3766
3718
|
</View>
|
|
3767
3719
|
</View>
|
|
3768
|
-
<View
|
|
3769
|
-
style={
|
|
3770
|
-
Array [
|
|
3771
|
-
Object {
|
|
3772
|
-
"borderBottomColor": "#e8e9ea",
|
|
3773
|
-
"borderBottomWidth": 1,
|
|
3774
|
-
"maxWidth": "100%",
|
|
3775
|
-
},
|
|
3776
|
-
undefined,
|
|
3777
|
-
]
|
|
3778
|
-
}
|
|
3779
|
-
/>
|
|
3780
3720
|
<RCTScrollView
|
|
3781
3721
|
ListFooterComponent={null}
|
|
3782
3722
|
data={
|
|
@@ -4453,18 +4393,6 @@ Array [
|
|
|
4453
4393
|
</View>
|
|
4454
4394
|
</RCTScrollView>
|
|
4455
4395
|
<View>
|
|
4456
|
-
<View
|
|
4457
|
-
style={
|
|
4458
|
-
Array [
|
|
4459
|
-
Object {
|
|
4460
|
-
"borderBottomColor": "#e8e9ea",
|
|
4461
|
-
"borderBottomWidth": 1,
|
|
4462
|
-
"maxWidth": "100%",
|
|
4463
|
-
},
|
|
4464
|
-
undefined,
|
|
4465
|
-
]
|
|
4466
|
-
}
|
|
4467
|
-
/>
|
|
4468
4396
|
<View
|
|
4469
4397
|
style={
|
|
4470
4398
|
Array [
|
|
@@ -394,18 +394,6 @@ Array [
|
|
|
394
394
|
</View>
|
|
395
395
|
</View>
|
|
396
396
|
</View>
|
|
397
|
-
<View
|
|
398
|
-
style={
|
|
399
|
-
Array [
|
|
400
|
-
Object {
|
|
401
|
-
"borderBottomColor": "#e8e9ea",
|
|
402
|
-
"borderBottomWidth": 1,
|
|
403
|
-
"maxWidth": "100%",
|
|
404
|
-
},
|
|
405
|
-
undefined,
|
|
406
|
-
]
|
|
407
|
-
}
|
|
408
|
-
/>
|
|
409
397
|
<RCTScrollView
|
|
410
398
|
ListFooterComponent={null}
|
|
411
399
|
data={
|
|
@@ -1893,18 +1881,6 @@ Array [
|
|
|
1893
1881
|
</View>
|
|
1894
1882
|
</View>
|
|
1895
1883
|
</View>
|
|
1896
|
-
<View
|
|
1897
|
-
style={
|
|
1898
|
-
Array [
|
|
1899
|
-
Object {
|
|
1900
|
-
"borderBottomColor": "#e8e9ea",
|
|
1901
|
-
"borderBottomWidth": 1,
|
|
1902
|
-
"maxWidth": "100%",
|
|
1903
|
-
},
|
|
1904
|
-
undefined,
|
|
1905
|
-
]
|
|
1906
|
-
}
|
|
1907
|
-
/>
|
|
1908
1884
|
<RCTScrollView
|
|
1909
1885
|
ListFooterComponent={null}
|
|
1910
1886
|
data={
|
|
@@ -3528,18 +3504,6 @@ Array [
|
|
|
3528
3504
|
</View>
|
|
3529
3505
|
</View>
|
|
3530
3506
|
</View>
|
|
3531
|
-
<View
|
|
3532
|
-
style={
|
|
3533
|
-
Array [
|
|
3534
|
-
Object {
|
|
3535
|
-
"borderBottomColor": "#e8e9ea",
|
|
3536
|
-
"borderBottomWidth": 1,
|
|
3537
|
-
"maxWidth": "100%",
|
|
3538
|
-
},
|
|
3539
|
-
undefined,
|
|
3540
|
-
]
|
|
3541
|
-
}
|
|
3542
|
-
/>
|
|
3543
3507
|
<RCTScrollView
|
|
3544
3508
|
ListFooterComponent={null}
|
|
3545
3509
|
data={
|
|
@@ -641,18 +641,6 @@ exports[`TimePickerIOS renders correctly 1`] = `
|
|
|
641
641
|
</View>
|
|
642
642
|
</View>
|
|
643
643
|
</View>
|
|
644
|
-
<View
|
|
645
|
-
style={
|
|
646
|
-
Array [
|
|
647
|
-
Object {
|
|
648
|
-
"borderBottomColor": "#e8e9ea",
|
|
649
|
-
"borderBottomWidth": 1,
|
|
650
|
-
"maxWidth": "100%",
|
|
651
|
-
},
|
|
652
|
-
undefined,
|
|
653
|
-
]
|
|
654
|
-
}
|
|
655
|
-
/>
|
|
656
644
|
<View
|
|
657
645
|
style={
|
|
658
646
|
Array [
|
|
@@ -677,18 +665,6 @@ exports[`TimePickerIOS renders correctly 1`] = `
|
|
|
677
665
|
/>
|
|
678
666
|
</View>
|
|
679
667
|
<View>
|
|
680
|
-
<View
|
|
681
|
-
style={
|
|
682
|
-
Array [
|
|
683
|
-
Object {
|
|
684
|
-
"borderBottomColor": "#e8e9ea",
|
|
685
|
-
"borderBottomWidth": 1,
|
|
686
|
-
"maxWidth": "100%",
|
|
687
|
-
},
|
|
688
|
-
undefined,
|
|
689
|
-
]
|
|
690
|
-
}
|
|
691
|
-
/>
|
|
692
668
|
<View
|
|
693
669
|
style={
|
|
694
670
|
Array [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { KeyboardAvoidingViewProps } from 'react-native';
|
|
2
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
3
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { KeyboardAvoidingViewProps } from 'react-native';
|
|
4
4
|
interface BottomSheetProps {
|
|
5
5
|
/**
|
|
6
6
|
* Bottom sheet open state.
|
|
@@ -60,5 +60,7 @@ interface BottomSheetProps {
|
|
|
60
60
|
* */
|
|
61
61
|
keyboardAvoidingViewProps?: KeyboardAvoidingViewProps;
|
|
62
62
|
}
|
|
63
|
-
declare const
|
|
64
|
-
|
|
63
|
+
declare const _default: (({ open, header, footer, children, onAnimationEnd, onOpen, onRequestClose, onDismiss, showCloseButton, hasBackdrop, showDivider, style, testID, keyboardAvoidingViewProps, }: BottomSheetProps) => JSX.Element) & {
|
|
64
|
+
ScrollView: ({ scrollEventThrottle, ...props }: import("react-native").ScrollViewProps) => JSX.Element;
|
|
65
|
+
};
|
|
66
|
+
export default _default;
|