@adiraku/react-native-ui 0.2.4 → 1.0.1
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/BottomSheet/BottomSheet.component.js +44 -36
- package/lib/commonjs/components/BottomSheet/BottomSheet.component.js.map +1 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.style.js +9 -9
- package/lib/commonjs/components/BottomSheet/BottomSheet.style.js.map +1 -1
- package/lib/commonjs/components/index.js +6 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.component.js +44 -37
- package/lib/module/components/BottomSheet/BottomSheet.component.js.map +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.style.js +10 -10
- package/lib/module/components/BottomSheet/BottomSheet.style.js.map +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/typescript/components/BottomSheet/BottomSheet.component.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/BottomSheet.style.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/BottomSheet.type.d.ts +6 -3
- package/lib/typescript/components/BottomSheet/BottomSheet.type.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -1
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/components/BottomSheet/BottomSheet.component.tsx +53 -55
- package/src/components/BottomSheet/BottomSheet.style.tsx +10 -9
- package/src/components/BottomSheet/BottomSheet.type.ts +6 -4
- package/src/components/index.ts +4 -1
|
@@ -6,11 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.BottomSheet = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeModal = _interopRequireDefault(require("react-native-modal"));
|
|
9
10
|
var _BottomSheet = require("./BottomSheet.style");
|
|
10
11
|
var _typography = require("../typography/typography.component");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
15
|
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); }
|
|
16
|
+
const deviceWindow = _reactNative.Dimensions.get('window');
|
|
14
17
|
const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
15
18
|
const {
|
|
16
19
|
onDismiss,
|
|
@@ -18,22 +21,25 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
18
21
|
titleProps = {},
|
|
19
22
|
subtitle,
|
|
20
23
|
subtitleProps = {},
|
|
21
|
-
isOverlayDismissDisabled = false,
|
|
22
24
|
dismissIcon = null,
|
|
23
25
|
dismissIconProps = {},
|
|
24
26
|
action = null,
|
|
25
27
|
largeIcon = null,
|
|
26
28
|
largeIconContainerHeight = 50,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
maxSheetHeight = 0.85,
|
|
30
|
+
backdropTransitionOutTiming = 0,
|
|
31
|
+
onBackdropPress = () => {},
|
|
32
|
+
onBackButtonPress = () => {},
|
|
33
|
+
children,
|
|
34
|
+
...rest
|
|
29
35
|
} = props;
|
|
30
|
-
const
|
|
31
|
-
const screenWidth = _reactNative.Dimensions.get('screen').width;
|
|
32
|
-
const panY = React.useRef(new _reactNative.Animated.Value(screenHeight)).current;
|
|
36
|
+
const computedStyle = (0, _BottomSheet.getStyle)();
|
|
33
37
|
const [visibility, setVisibility] = React.useState(false);
|
|
38
|
+
const panY = React.useRef(new _reactNative.Animated.Value(deviceWindow.height)).current;
|
|
34
39
|
React.useImperativeHandle(ref, () => {
|
|
35
40
|
return {
|
|
36
41
|
open() {
|
|
42
|
+
console.log('clicked');
|
|
37
43
|
setVisibility(true);
|
|
38
44
|
},
|
|
39
45
|
close() {
|
|
@@ -41,14 +47,17 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
41
47
|
}
|
|
42
48
|
};
|
|
43
49
|
}, []);
|
|
44
|
-
const
|
|
50
|
+
const handleDismiss = () => {
|
|
51
|
+
setVisibility(false);
|
|
52
|
+
closeAnim.start(onDismiss);
|
|
53
|
+
};
|
|
45
54
|
const resetPositionAnim = _reactNative.Animated.timing(panY, {
|
|
46
55
|
toValue: 0,
|
|
47
56
|
duration: 300,
|
|
48
57
|
useNativeDriver: true
|
|
49
58
|
});
|
|
50
59
|
const closeAnim = _reactNative.Animated.timing(panY, {
|
|
51
|
-
toValue:
|
|
60
|
+
toValue: deviceWindow.height,
|
|
52
61
|
duration: 300,
|
|
53
62
|
useNativeDriver: true
|
|
54
63
|
});
|
|
@@ -56,10 +65,6 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
56
65
|
inputRange: [-1, 0, 1],
|
|
57
66
|
outputRange: [0, 0, 1]
|
|
58
67
|
});
|
|
59
|
-
const handleDismiss = () => {
|
|
60
|
-
setVisibility(false);
|
|
61
|
-
closeAnim.start(onDismiss);
|
|
62
|
-
};
|
|
63
68
|
React.useEffect(() => {
|
|
64
69
|
resetPositionAnim.start();
|
|
65
70
|
}, [resetPositionAnim]);
|
|
@@ -85,8 +90,8 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
85
90
|
style: [computedStyle.sheetHeader]
|
|
86
91
|
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
87
92
|
style: [{
|
|
88
|
-
maxWidth: (
|
|
89
|
-
minWidth: (
|
|
93
|
+
maxWidth: (deviceWindow.width - 32) / 8 * 2,
|
|
94
|
+
minWidth: (deviceWindow.width - 32) / 8 * 2
|
|
90
95
|
}]
|
|
91
96
|
}, !!dismissIcon && /*#__PURE__*/React.createElement(_reactNative.TouchableHighlight, _extends({
|
|
92
97
|
onPress: handleDismiss,
|
|
@@ -94,8 +99,8 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
94
99
|
underlayColor: 'transparent'
|
|
95
100
|
}, dismissIconProps), dismissIcon)), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
96
101
|
style: [{
|
|
97
|
-
maxWidth: (
|
|
98
|
-
minWidth: (
|
|
102
|
+
maxWidth: (deviceWindow.width - 32) / 8 * 4,
|
|
103
|
+
minWidth: (deviceWindow.width - 32) / 8 * 4
|
|
99
104
|
}]
|
|
100
105
|
}, !!title && /*#__PURE__*/React.createElement(_typography.Typography, _extends({
|
|
101
106
|
variant: "subtitle1",
|
|
@@ -103,8 +108,8 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
103
108
|
numberOfLines: 2
|
|
104
109
|
}, titleProps), title)), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
105
110
|
style: [{
|
|
106
|
-
maxWidth: (
|
|
107
|
-
minWidth: (
|
|
111
|
+
maxWidth: (deviceWindow.width - 32) / 8 * 2,
|
|
112
|
+
minWidth: (deviceWindow.width - 32) / 8 * 2
|
|
108
113
|
}, computedStyle.sheetActionWrapper]
|
|
109
114
|
}, action || null)), !!subtitle && /*#__PURE__*/React.createElement(_typography.Typography, _extends({
|
|
110
115
|
variant: "body2",
|
|
@@ -121,31 +126,34 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
121
126
|
style: [computedStyle.largeIconAbsoluteWrapper]
|
|
122
127
|
}, largeIcon));
|
|
123
128
|
};
|
|
124
|
-
return /*#__PURE__*/React.createElement(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
style: [computedStyle.overlay]
|
|
137
|
-
})), /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
|
|
129
|
+
return /*#__PURE__*/React.createElement(_reactNativeModal.default, _extends({
|
|
130
|
+
isVisible: visibility,
|
|
131
|
+
backdropTransitionOutTiming: backdropTransitionOutTiming,
|
|
132
|
+
onBackdropPress: () => {
|
|
133
|
+
onBackdropPress();
|
|
134
|
+
handleDismiss();
|
|
135
|
+
},
|
|
136
|
+
onBackButtonPress: () => {
|
|
137
|
+
onBackButtonPress();
|
|
138
|
+
handleDismiss();
|
|
139
|
+
},
|
|
140
|
+
onSwipeComplete: () => handleDismiss(),
|
|
138
141
|
style: {
|
|
139
|
-
|
|
142
|
+
flex: 1,
|
|
143
|
+
margin: 0
|
|
144
|
+
}
|
|
145
|
+
}, rest), /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
|
|
146
|
+
style: [computedStyle.container, {
|
|
147
|
+
maxHeight: deviceWindow.height * maxSheetHeight,
|
|
140
148
|
transform: [{
|
|
141
149
|
translateY: translateY
|
|
142
150
|
}]
|
|
143
|
-
}
|
|
144
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View,
|
|
151
|
+
}]
|
|
152
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, _extends({
|
|
145
153
|
style: [computedStyle.sheetIndicatorWrapper]
|
|
146
154
|
}, panResponders.panHandlers), !largeIcon && /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
147
155
|
style: computedStyle.sliderIndicator
|
|
148
|
-
})), largeIcon ? renderLargeIconComponent() : renderSheetHeader()
|
|
156
|
+
})), largeIcon ? renderLargeIconComponent() : renderSheetHeader(), children));
|
|
149
157
|
});
|
|
150
158
|
exports.BottomSheet = BottomSheet;
|
|
151
159
|
//# sourceMappingURL=BottomSheet.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BottomSheet","React","forwardRef","props","ref","onDismiss","title","titleProps","subtitle","subtitleProps","
|
|
1
|
+
{"version":3,"names":["deviceWindow","Dimensions","get","BottomSheet","React","forwardRef","props","ref","onDismiss","title","titleProps","subtitle","subtitleProps","dismissIcon","dismissIconProps","action","largeIcon","largeIconContainerHeight","maxSheetHeight","backdropTransitionOutTiming","onBackdropPress","onBackButtonPress","children","rest","computedStyle","getStyle","visibility","setVisibility","useState","panY","useRef","Animated","Value","height","current","useImperativeHandle","open","console","log","close","handleDismiss","closeAnim","start","resetPositionAnim","timing","toValue","duration","useNativeDriver","translateY","interpolate","inputRange","outputRange","useEffect","panResponders","PanResponder","create","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","onPanResponderMove","event","dy","onPanResponderRelease","_","gs","vy","renderSheetHeader","sheetHeaderWrapper","sheetHeader","maxWidth","width","minWidth","sheetDismissIconWrapper","textCenter","sheetActionWrapper","renderLargeIconComponent","largeIconContainer","largeIconAbsoluteWrapper","flex","margin","container","maxHeight","transform","sheetIndicatorWrapper","panHandlers","sliderIndicator"],"sourceRoot":"../../src","sources":["BottomSheet.component.tsx"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AACA;AAAgE;AAAA;AAAA;AAAA;AAYhE,MAAMA,YAAY,GAAG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B,EAAG,CACxD,EACNpE,SAAS,GAAG0D,wBAAwB,EAAE,GAAGT,iBAAiB,EAAE,EAC5D3C,QAAQ,CACK,CACV;AAEZ,CAAC,CACF;AAAC"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getStyle = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
|
-
var _themes = require("
|
|
8
|
+
var _themes = require("../../themes");
|
|
9
9
|
const getStyle = () => {
|
|
10
10
|
const computedStyle = {};
|
|
11
11
|
computedStyle.flex = {
|
|
@@ -15,14 +15,13 @@ const getStyle = () => {
|
|
|
15
15
|
flex: 1,
|
|
16
16
|
justifyContent: 'flex-end'
|
|
17
17
|
};
|
|
18
|
-
computedStyle.overlayColor = {
|
|
19
|
-
backgroundColor: 'rgba(0,0,0,0.2)'
|
|
20
|
-
};
|
|
21
18
|
computedStyle.container = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
backgroundColor: _themes.Palettes.white[50],
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
bottom: 0,
|
|
22
|
+
width: '100%',
|
|
23
|
+
borderTopEndRadius: _themes.Spacing[16],
|
|
24
|
+
borderTopStartRadius: _themes.Spacing[16]
|
|
26
25
|
};
|
|
27
26
|
computedStyle.sliderIndicator = {
|
|
28
27
|
height: 5,
|
|
@@ -41,7 +40,8 @@ const getStyle = () => {
|
|
|
41
40
|
justifyContent: 'space-between'
|
|
42
41
|
};
|
|
43
42
|
computedStyle.sheetHeaderWrapper = {
|
|
44
|
-
paddingHorizontal: _themes.Spacing[16]
|
|
43
|
+
paddingHorizontal: _themes.Spacing[16],
|
|
44
|
+
paddingBottom: _themes.Spacing[8]
|
|
45
45
|
};
|
|
46
46
|
computedStyle.sheetDismissIconWrapper = {
|
|
47
47
|
padding: 4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getStyle","computedStyle","flex","overlay","justifyContent","
|
|
1
|
+
{"version":3,"names":["getStyle","computedStyle","flex","overlay","justifyContent","container","backgroundColor","Palettes","white","position","bottom","width","borderTopEndRadius","Spacing","borderTopStartRadius","sliderIndicator","height","borderRadius","Radius","full","grey","sheetIndicatorWrapper","alignItems","sheetHeader","flexDirection","sheetHeaderWrapper","paddingHorizontal","paddingBottom","sheetDismissIconWrapper","padding","sheetActionWrapper","textCenter","textAlign","largeIconContainer","largeIconAbsoluteWrapper","StyleSheet","create"],"sourceRoot":"../../src","sources":["BottomSheet.style.tsx"],"mappings":";;;;;;AACA;AAEA;AAmBO,MAAMA,QAAQ,GAAG,MAAM;EAC5B,MAAMC,aAAiC,GAAG,CAAC,CAAC;EAE5CA,aAAa,CAACC,IAAI,GAAG;IACnBA,IAAI,EAAE;EACR,CAAC;EAEDD,aAAa,CAACE,OAAO,GAAG;IACtBD,IAAI,EAAE,CAAC;IACPE,cAAc,EAAE;EAClB,CAAC;EAEDH,aAAa,CAACI,SAAS,GAAG;IACxBC,eAAe,EAAEC,gBAAQ,CAACC,KAAK,CAAC,EAAE,CAAC;IACnCC,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE,MAAM;IACbC,kBAAkB,EAAEC,eAAO,CAAC,EAAE,CAAC;IAC/BC,oBAAoB,EAAED,eAAO,CAAC,EAAE;EAClC,CAAC;EAEDZ,aAAa,CAACc,eAAe,GAAG;IAC9BC,MAAM,EAAE,CAAC;IACTL,KAAK,EAAE,GAAG;IACVM,YAAY,EAAEC,cAAM,CAACC,IAAI;IACzBb,eAAe,EAAEC,gBAAQ,CAACa,IAAI,CAAC,GAAG;EACpC,CAAC;EAEDnB,aAAa,CAACoB,qBAAqB,GAAG;IACpCL,MAAM,EAAE,EAAE;IACVM,UAAU,EAAE,QAAQ;IACpBlB,cAAc,EAAE;EAClB,CAAC;EAEDH,aAAa,CAACsB,WAAW,GAAG;IAC1BC,aAAa,EAAE,KAAK;IACpBF,UAAU,EAAE,QAAQ;IACpBlB,cAAc,EAAE;EAClB,CAAC;EAEDH,aAAa,CAACwB,kBAAkB,GAAG;IACjCC,iBAAiB,EAAEb,eAAO,CAAC,EAAE,CAAC;IAC9Bc,aAAa,EAAEd,eAAO,CAAC,CAAC;EAC1B,CAAC;EACDZ,aAAa,CAAC2B,uBAAuB,GAAG;IACtCC,OAAO,EAAE;EACX,CAAC;EACD5B,aAAa,CAAC6B,kBAAkB,GAAG;IACjCN,aAAa,EAAE,KAAK;IACpBpB,cAAc,EAAE;EAClB,CAAC;EAEDH,aAAa,CAAC8B,UAAU,GAAG;IACzBC,SAAS,EAAE;EACb,CAAC;EAED/B,aAAa,CAACgC,kBAAkB,GAAG;IACjCX,UAAU,EAAE;EACd,CAAC;EAEDrB,aAAa,CAACiC,wBAAwB,GAAG;IACvCzB,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE;EACV,CAAC;EAED,OAAOyB,uBAAU,CAACC,MAAM,CAACnC,aAAa,CAAC;AACzC,CAAC;AAAC"}
|
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "BottomSheet", {
|
|
|
21
21
|
return _BottomSheet.BottomSheet;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "BottomSheetHandler", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _BottomSheet.BottomSheetHandler;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "Button", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
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
2
|
import * as React from 'react';
|
|
3
|
-
import { Animated, Dimensions, PanResponder,
|
|
3
|
+
import { Animated, Dimensions, PanResponder, View } from 'react-native';
|
|
4
|
+
import Modal from 'react-native-modal';
|
|
4
5
|
import { getStyle } from './BottomSheet.style';
|
|
5
6
|
import { Typography } from '../typography/typography.component';
|
|
6
7
|
import { TouchableHighlight } from 'react-native';
|
|
8
|
+
const deviceWindow = Dimensions.get('window');
|
|
7
9
|
const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
8
10
|
const {
|
|
9
11
|
onDismiss,
|
|
@@ -11,22 +13,25 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
11
13
|
titleProps = {},
|
|
12
14
|
subtitle,
|
|
13
15
|
subtitleProps = {},
|
|
14
|
-
isOverlayDismissDisabled = false,
|
|
15
16
|
dismissIcon = null,
|
|
16
17
|
dismissIconProps = {},
|
|
17
18
|
action = null,
|
|
18
19
|
largeIcon = null,
|
|
19
20
|
largeIconContainerHeight = 50,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
maxSheetHeight = 0.85,
|
|
22
|
+
backdropTransitionOutTiming = 0,
|
|
23
|
+
onBackdropPress = () => {},
|
|
24
|
+
onBackButtonPress = () => {},
|
|
25
|
+
children,
|
|
26
|
+
...rest
|
|
22
27
|
} = props;
|
|
23
|
-
const
|
|
24
|
-
const screenWidth = Dimensions.get('screen').width;
|
|
25
|
-
const panY = React.useRef(new Animated.Value(screenHeight)).current;
|
|
28
|
+
const computedStyle = getStyle();
|
|
26
29
|
const [visibility, setVisibility] = React.useState(false);
|
|
30
|
+
const panY = React.useRef(new Animated.Value(deviceWindow.height)).current;
|
|
27
31
|
React.useImperativeHandle(ref, () => {
|
|
28
32
|
return {
|
|
29
33
|
open() {
|
|
34
|
+
console.log('clicked');
|
|
30
35
|
setVisibility(true);
|
|
31
36
|
},
|
|
32
37
|
close() {
|
|
@@ -34,14 +39,17 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
34
39
|
}
|
|
35
40
|
};
|
|
36
41
|
}, []);
|
|
37
|
-
const
|
|
42
|
+
const handleDismiss = () => {
|
|
43
|
+
setVisibility(false);
|
|
44
|
+
closeAnim.start(onDismiss);
|
|
45
|
+
};
|
|
38
46
|
const resetPositionAnim = Animated.timing(panY, {
|
|
39
47
|
toValue: 0,
|
|
40
48
|
duration: 300,
|
|
41
49
|
useNativeDriver: true
|
|
42
50
|
});
|
|
43
51
|
const closeAnim = Animated.timing(panY, {
|
|
44
|
-
toValue:
|
|
52
|
+
toValue: deviceWindow.height,
|
|
45
53
|
duration: 300,
|
|
46
54
|
useNativeDriver: true
|
|
47
55
|
});
|
|
@@ -49,10 +57,6 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
49
57
|
inputRange: [-1, 0, 1],
|
|
50
58
|
outputRange: [0, 0, 1]
|
|
51
59
|
});
|
|
52
|
-
const handleDismiss = () => {
|
|
53
|
-
setVisibility(false);
|
|
54
|
-
closeAnim.start(onDismiss);
|
|
55
|
-
};
|
|
56
60
|
React.useEffect(() => {
|
|
57
61
|
resetPositionAnim.start();
|
|
58
62
|
}, [resetPositionAnim]);
|
|
@@ -78,8 +82,8 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
78
82
|
style: [computedStyle.sheetHeader]
|
|
79
83
|
}, /*#__PURE__*/React.createElement(View, {
|
|
80
84
|
style: [{
|
|
81
|
-
maxWidth: (
|
|
82
|
-
minWidth: (
|
|
85
|
+
maxWidth: (deviceWindow.width - 32) / 8 * 2,
|
|
86
|
+
minWidth: (deviceWindow.width - 32) / 8 * 2
|
|
83
87
|
}]
|
|
84
88
|
}, !!dismissIcon && /*#__PURE__*/React.createElement(TouchableHighlight, _extends({
|
|
85
89
|
onPress: handleDismiss,
|
|
@@ -87,8 +91,8 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
87
91
|
underlayColor: 'transparent'
|
|
88
92
|
}, dismissIconProps), dismissIcon)), /*#__PURE__*/React.createElement(View, {
|
|
89
93
|
style: [{
|
|
90
|
-
maxWidth: (
|
|
91
|
-
minWidth: (
|
|
94
|
+
maxWidth: (deviceWindow.width - 32) / 8 * 4,
|
|
95
|
+
minWidth: (deviceWindow.width - 32) / 8 * 4
|
|
92
96
|
}]
|
|
93
97
|
}, !!title && /*#__PURE__*/React.createElement(Typography, _extends({
|
|
94
98
|
variant: "subtitle1",
|
|
@@ -96,8 +100,8 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
96
100
|
numberOfLines: 2
|
|
97
101
|
}, titleProps), title)), /*#__PURE__*/React.createElement(View, {
|
|
98
102
|
style: [{
|
|
99
|
-
maxWidth: (
|
|
100
|
-
minWidth: (
|
|
103
|
+
maxWidth: (deviceWindow.width - 32) / 8 * 2,
|
|
104
|
+
minWidth: (deviceWindow.width - 32) / 8 * 2
|
|
101
105
|
}, computedStyle.sheetActionWrapper]
|
|
102
106
|
}, action || null)), !!subtitle && /*#__PURE__*/React.createElement(Typography, _extends({
|
|
103
107
|
variant: "body2",
|
|
@@ -114,31 +118,34 @@ const BottomSheet = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
114
118
|
style: [computedStyle.largeIconAbsoluteWrapper]
|
|
115
119
|
}, largeIcon));
|
|
116
120
|
};
|
|
117
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
style: [computedStyle.overlay]
|
|
130
|
-
})), /*#__PURE__*/React.createElement(Animated.View, {
|
|
121
|
+
return /*#__PURE__*/React.createElement(Modal, _extends({
|
|
122
|
+
isVisible: visibility,
|
|
123
|
+
backdropTransitionOutTiming: backdropTransitionOutTiming,
|
|
124
|
+
onBackdropPress: () => {
|
|
125
|
+
onBackdropPress();
|
|
126
|
+
handleDismiss();
|
|
127
|
+
},
|
|
128
|
+
onBackButtonPress: () => {
|
|
129
|
+
onBackButtonPress();
|
|
130
|
+
handleDismiss();
|
|
131
|
+
},
|
|
132
|
+
onSwipeComplete: () => handleDismiss(),
|
|
131
133
|
style: {
|
|
132
|
-
|
|
134
|
+
flex: 1,
|
|
135
|
+
margin: 0
|
|
136
|
+
}
|
|
137
|
+
}, rest), /*#__PURE__*/React.createElement(Animated.View, {
|
|
138
|
+
style: [computedStyle.container, {
|
|
139
|
+
maxHeight: deviceWindow.height * maxSheetHeight,
|
|
133
140
|
transform: [{
|
|
134
141
|
translateY: translateY
|
|
135
142
|
}]
|
|
136
|
-
}
|
|
137
|
-
}, /*#__PURE__*/React.createElement(View,
|
|
143
|
+
}]
|
|
144
|
+
}, /*#__PURE__*/React.createElement(View, _extends({
|
|
138
145
|
style: [computedStyle.sheetIndicatorWrapper]
|
|
139
146
|
}, panResponders.panHandlers), !largeIcon && /*#__PURE__*/React.createElement(View, {
|
|
140
147
|
style: computedStyle.sliderIndicator
|
|
141
|
-
})), largeIcon ? renderLargeIconComponent() : renderSheetHeader()
|
|
148
|
+
})), largeIcon ? renderLargeIconComponent() : renderSheetHeader(), children));
|
|
142
149
|
});
|
|
143
150
|
export { BottomSheet };
|
|
144
151
|
//# sourceMappingURL=BottomSheet.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Animated","Dimensions","PanResponder","Modal","
|
|
1
|
+
{"version":3,"names":["React","Animated","Dimensions","PanResponder","View","Modal","getStyle","Typography","TouchableHighlight","deviceWindow","get","BottomSheet","forwardRef","props","ref","onDismiss","title","titleProps","subtitle","subtitleProps","dismissIcon","dismissIconProps","action","largeIcon","largeIconContainerHeight","maxSheetHeight","backdropTransitionOutTiming","onBackdropPress","onBackButtonPress","children","rest","computedStyle","visibility","setVisibility","useState","panY","useRef","Value","height","current","useImperativeHandle","open","console","log","close","handleDismiss","closeAnim","start","resetPositionAnim","timing","toValue","duration","useNativeDriver","translateY","interpolate","inputRange","outputRange","useEffect","panResponders","create","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","onPanResponderMove","event","dy","onPanResponderRelease","_","gs","vy","renderSheetHeader","sheetHeaderWrapper","sheetHeader","maxWidth","width","minWidth","sheetDismissIconWrapper","textCenter","sheetActionWrapper","renderLargeIconComponent","largeIconContainer","largeIconAbsoluteWrapper","flex","margin","container","maxHeight","transform","sheetIndicatorWrapper","panHandlers","sliderIndicator"],"sourceRoot":"../../src","sources":["BottomSheet.component.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,UAAU,EAAEC,YAAY,EAAEC,IAAI,QAAQ,cAAc;AACvE,OAAOC,KAAK,MAAM,oBAAoB;AAEtC,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,UAAU,QAAQ,oCAAoC;AAG/D,SAASC,kBAAkB,QAAQ,cAAc;AASjD,MAAMC,YAAY,GAAGP,UAAU,CAACQ,GAAG,CAAC,QAAQ,CAAC;AAE7C,MAAMC,WAAW,gBAAGX,KAAK,CAACY,UAAU,CAClC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACd,MAAM;IACJC,SAAS;IACTC,KAAK;IACLC,UA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import { Palettes, Radius, Spacing } from '
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Palettes, Radius, Spacing } from '../../themes';
|
|
3
3
|
export const getStyle = () => {
|
|
4
4
|
const computedStyle = {};
|
|
5
5
|
computedStyle.flex = {
|
|
@@ -9,14 +9,13 @@ export const getStyle = () => {
|
|
|
9
9
|
flex: 1,
|
|
10
10
|
justifyContent: 'flex-end'
|
|
11
11
|
};
|
|
12
|
-
computedStyle.overlayColor = {
|
|
13
|
-
backgroundColor: 'rgba(0,0,0,0.2)'
|
|
14
|
-
};
|
|
15
12
|
computedStyle.container = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
backgroundColor: Palettes.white[50],
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
bottom: 0,
|
|
16
|
+
width: '100%',
|
|
17
|
+
borderTopEndRadius: Spacing[16],
|
|
18
|
+
borderTopStartRadius: Spacing[16]
|
|
20
19
|
};
|
|
21
20
|
computedStyle.sliderIndicator = {
|
|
22
21
|
height: 5,
|
|
@@ -35,7 +34,8 @@ export const getStyle = () => {
|
|
|
35
34
|
justifyContent: 'space-between'
|
|
36
35
|
};
|
|
37
36
|
computedStyle.sheetHeaderWrapper = {
|
|
38
|
-
paddingHorizontal: Spacing[16]
|
|
37
|
+
paddingHorizontal: Spacing[16],
|
|
38
|
+
paddingBottom: Spacing[8]
|
|
39
39
|
};
|
|
40
40
|
computedStyle.sheetDismissIconWrapper = {
|
|
41
41
|
padding: 4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["StyleSheet","Palettes","Radius","Spacing","getStyle","computedStyle","flex","overlay","justifyContent","container","backgroundColor","white","position","bottom","width","borderTopEndRadius","borderTopStartRadius","sliderIndicator","height","borderRadius","full","grey","sheetIndicatorWrapper","alignItems","sheetHeader","flexDirection","sheetHeaderWrapper","paddingHorizontal","paddingBottom","sheetDismissIconWrapper","padding","sheetActionWrapper","textCenter","textAlign","largeIconContainer","largeIconAbsoluteWrapper","create"],"sourceRoot":"../../src","sources":["BottomSheet.style.tsx"],"mappings":"AACA,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,QAAQ,cAAc;AAmBxD,OAAO,MAAMC,QAAQ,GAAG,MAAM;EAC5B,MAAMC,aAAiC,GAAG,CAAC,CAAC;EAE5CA,aAAa,CAACC,IAAI,GAAG;IACnBA,IAAI,EAAE;EACR,CAAC;EAEDD,aAAa,CAACE,OAAO,GAAG;IACtBD,IAAI,EAAE,CAAC;IACPE,cAAc,EAAE;EAClB,CAAC;EAEDH,aAAa,CAACI,SAAS,GAAG;IACxBC,eAAe,EAAET,QAAQ,CAACU,KAAK,CAAC,EAAE,CAAC;IACnCC,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE,MAAM;IACbC,kBAAkB,EAAEZ,OAAO,CAAC,EAAE,CAAC;IAC/Ba,oBAAoB,EAAEb,OAAO,CAAC,EAAE;EAClC,CAAC;EAEDE,aAAa,CAACY,eAAe,GAAG;IAC9BC,MAAM,EAAE,CAAC;IACTJ,KAAK,EAAE,GAAG;IACVK,YAAY,EAAEjB,MAAM,CAACkB,IAAI;IACzBV,eAAe,EAAET,QAAQ,CAACoB,IAAI,CAAC,GAAG;EACpC,CAAC;EAEDhB,aAAa,CAACiB,qBAAqB,GAAG;IACpCJ,MAAM,EAAE,EAAE;IACVK,UAAU,EAAE,QAAQ;IACpBf,cAAc,EAAE;EAClB,CAAC;EAEDH,aAAa,CAACmB,WAAW,GAAG;IAC1BC,aAAa,EAAE,KAAK;IACpBF,UAAU,EAAE,QAAQ;IACpBf,cAAc,EAAE;EAClB,CAAC;EAEDH,aAAa,CAACqB,kBAAkB,GAAG;IACjCC,iBAAiB,EAAExB,OAAO,CAAC,EAAE,CAAC;IAC9ByB,aAAa,EAAEzB,OAAO,CAAC,CAAC;EAC1B,CAAC;EACDE,aAAa,CAACwB,uBAAuB,GAAG;IACtCC,OAAO,EAAE;EACX,CAAC;EACDzB,aAAa,CAAC0B,kBAAkB,GAAG;IACjCN,aAAa,EAAE,KAAK;IACpBjB,cAAc,EAAE;EAClB,CAAC;EAEDH,aAAa,CAAC2B,UAAU,GAAG;IACzBC,SAAS,EAAE;EACb,CAAC;EAED5B,aAAa,CAAC6B,kBAAkB,GAAG;IACjCX,UAAU,EAAE;EACd,CAAC;EAEDlB,aAAa,CAAC8B,wBAAwB,GAAG;IACvCvB,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE;EACV,CAAC;EAED,OAAOb,UAAU,CAACoC,MAAM,CAAC/B,aAAa,CAAC;AACzC,CAAC"}
|
|
@@ -11,7 +11,7 @@ export { StepperCounter } from './StepperCounter/StepperCounter.component';
|
|
|
11
11
|
export { Divider } from './Divider/Divider.component';
|
|
12
12
|
export { Tabs } from './Tabs/Tabs.component';
|
|
13
13
|
export { RadioButton } from './RadioButton/RadioButton.component';
|
|
14
|
-
export { BottomSheet } from './BottomSheet/BottomSheet.component';
|
|
14
|
+
export { BottomSheet, BottomSheetHandler } from './BottomSheet/BottomSheet.component';
|
|
15
15
|
export { RadioInput } from './RadioInput/RadioInput.component';
|
|
16
16
|
export { CheckBoxInput } from './CheckBoxInput/CheckBoxInput.component';
|
|
17
17
|
export { Checkbox } from './Checkbox/Checkbox.component';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Label","BaseComponent","Typography","Coachmark","TextLink","SliderIndicator","TextInput","TextArea","StepperCounter","Divider","Tabs","RadioButton","BottomSheet","RadioInput","CheckBoxInput","Checkbox","Appbar","Snackbar","SnackbarComponent","Switch","Dot","InformationBox","RoundedTab","Countdown"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,MAAM,QAAQ,2BAA2B;AAClD,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,SAASC,SAAS,QAAQ,iCAAiC;AAC3D,SAASC,QAAQ,QAAQ,+BAA+B;AACxD,SAASC,eAAe,QAAQ,+CAA+C;AAC/E,SAASC,SAAS,QAAQ,iCAAiC;AAC3D,SAASC,QAAQ,QAAQ,+BAA+B;AACxD,SAASC,cAAc,QAAQ,2CAA2C;AAC1E,SAASC,OAAO,QAAQ,6BAA6B;AACrD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,WAAW,QAAQ,qCAAqC;AACjE,
|
|
1
|
+
{"version":3,"names":["Button","Label","BaseComponent","Typography","Coachmark","TextLink","SliderIndicator","TextInput","TextArea","StepperCounter","Divider","Tabs","RadioButton","BottomSheet","BottomSheetHandler","RadioInput","CheckBoxInput","Checkbox","Appbar","Snackbar","SnackbarComponent","Switch","Dot","InformationBox","RoundedTab","Countdown"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,MAAM,QAAQ,2BAA2B;AAClD,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,SAASC,SAAS,QAAQ,iCAAiC;AAC3D,SAASC,QAAQ,QAAQ,+BAA+B;AACxD,SAASC,eAAe,QAAQ,+CAA+C;AAC/E,SAASC,SAAS,QAAQ,iCAAiC;AAC3D,SAASC,QAAQ,QAAQ,+BAA+B;AACxD,SAASC,cAAc,QAAQ,2CAA2C;AAC1E,SAASC,OAAO,QAAQ,6BAA6B;AACrD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,WAAW,QAAQ,qCAAqC;AACjE,SACEC,WAAW,EACXC,kBAAkB,QACb,qCAAqC;AAC5C,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,SAASC,aAAa,QAAQ,yCAAyC;AACvE,SAASC,QAAQ,QAAQ,+BAA+B;AACxD,SAASC,MAAM,QAAQ,2BAA2B;AAClD,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,+BAA+B;AAC3E,SAASC,MAAM,QAAQ,2BAA2B;AAClD,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,cAAc,QAAQ,6CAA6C;AAC5E,SAASC,UAAU,QAAQ,qCAAqC;AAChE,SAASC,SAAS,QAAQ,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.component.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/BottomSheet.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheet.component.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/BottomSheet.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,aAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,oBAAY,kBAAkB,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAItE,QAAA,MAAM,WAAW,+FA4MhB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.style.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/BottomSheet.style.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzD,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAClC,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,uBAAuB,CAAC,EAAE,SAAS,CAAC;IACpC,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,wBAAwB,CAAC,EAAE,SAAS,CAAC;CACtC;AAED,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"BottomSheet.style.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/BottomSheet.style.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzD,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAClC,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,uBAAuB,CAAC,EAAE,SAAS,CAAC;IACpC,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,wBAAwB,CAAC,EAAE,SAAS,CAAC;CACtC;AAED,eAAO,MAAM,QAAQ,0BAkEpB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { TextProps, TouchableHighlightProps } from 'react-native';
|
|
3
|
-
|
|
3
|
+
import type { ModalProps } from 'react-native-modal';
|
|
4
|
+
export interface BottomSheetProps extends Omit<ModalProps, 'isVisible'> {
|
|
4
5
|
onDismiss?: () => void;
|
|
5
6
|
sheetHeader?: ReactNode;
|
|
6
7
|
title: string;
|
|
@@ -13,8 +14,10 @@ export interface BottomSheetProps {
|
|
|
13
14
|
action?: ReactNode;
|
|
14
15
|
largeIcon?: ReactNode;
|
|
15
16
|
largeIconContainerHeight?: number;
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Decimal number between 0 - 1
|
|
19
|
+
*/
|
|
20
|
+
maxSheetHeight?: number;
|
|
18
21
|
}
|
|
19
22
|
export declare type BottomSheetRefHandle = {
|
|
20
23
|
open: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.type.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/BottomSheet.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheet.type.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/BottomSheet.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC;IACrE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB,KAAK,EAAE,MAAM,CAAC;IAEd,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,aAAa,CAAC,EAAE,SAAS,CAAC;IAE1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;IAE3C,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,oBAAY,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC"}
|
|
@@ -11,7 +11,7 @@ export { StepperCounter } from './StepperCounter/StepperCounter.component';
|
|
|
11
11
|
export { Divider } from './Divider/Divider.component';
|
|
12
12
|
export { Tabs } from './Tabs/Tabs.component';
|
|
13
13
|
export { RadioButton } from './RadioButton/RadioButton.component';
|
|
14
|
-
export { BottomSheet } from './BottomSheet/BottomSheet.component';
|
|
14
|
+
export { BottomSheet, BottomSheetHandler, } from './BottomSheet/BottomSheet.component';
|
|
15
15
|
export { RadioInput } from './RadioInput/RadioInput.component';
|
|
16
16
|
export { CheckBoxInput } from './CheckBoxInput/CheckBoxInput.component';
|
|
17
17
|
export { Checkbox } from './Checkbox/Checkbox.component';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,O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.0.1",
|
|
4
|
+
"description": "UI library for Adiraku apps",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"react": "*",
|
|
82
82
|
"react-native": "*",
|
|
83
|
-
"react-native-svg": "
|
|
83
|
+
"react-native-svg": "9.9.3"
|
|
84
84
|
},
|
|
85
85
|
"packageManager": "^yarn@1.22.15",
|
|
86
86
|
"jest": {
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
]
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
|
+
"react-native-modal": "^11.5.6",
|
|
129
130
|
"react-native-toast-message": "^2.1.6"
|
|
130
131
|
}
|
|
131
132
|
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
Dimensions,
|
|
5
|
-
PanResponder,
|
|
6
|
-
Modal,
|
|
7
|
-
TouchableWithoutFeedback,
|
|
8
|
-
View,
|
|
9
|
-
} from 'react-native';
|
|
2
|
+
import { Animated, Dimensions, PanResponder, View } from 'react-native';
|
|
3
|
+
import Modal from 'react-native-modal';
|
|
10
4
|
|
|
11
5
|
import { getStyle } from './BottomSheet.style';
|
|
12
6
|
import { Typography } from '../typography/typography.component';
|
|
@@ -21,6 +15,8 @@ type BottomSheetRefHandle = {
|
|
|
21
15
|
|
|
22
16
|
export type BottomSheetHandler = React.ElementRef<typeof BottomSheet>;
|
|
23
17
|
|
|
18
|
+
const deviceWindow = Dimensions.get('window');
|
|
19
|
+
|
|
24
20
|
const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
25
21
|
(props, ref) => {
|
|
26
22
|
const {
|
|
@@ -29,26 +25,30 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
29
25
|
titleProps = {},
|
|
30
26
|
subtitle,
|
|
31
27
|
subtitleProps = {},
|
|
32
|
-
isOverlayDismissDisabled = false,
|
|
33
28
|
dismissIcon = null,
|
|
34
29
|
dismissIconProps = {},
|
|
35
30
|
action = null,
|
|
36
31
|
largeIcon = null,
|
|
37
32
|
largeIconContainerHeight = 50,
|
|
38
|
-
|
|
33
|
+
maxSheetHeight = 0.85,
|
|
34
|
+
backdropTransitionOutTiming = 0,
|
|
35
|
+
onBackdropPress = () => {},
|
|
36
|
+
onBackButtonPress = () => {},
|
|
39
37
|
children,
|
|
38
|
+
...rest
|
|
40
39
|
} = props;
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const panY = React.useRef(new Animated.Value(screenHeight)).current;
|
|
40
|
+
|
|
41
|
+
const computedStyle = getStyle();
|
|
44
42
|
|
|
45
43
|
const [visibility, setVisibility] = React.useState(false);
|
|
44
|
+
const panY = React.useRef(new Animated.Value(deviceWindow.height)).current;
|
|
46
45
|
|
|
47
46
|
React.useImperativeHandle(
|
|
48
47
|
ref,
|
|
49
48
|
() => {
|
|
50
49
|
return {
|
|
51
50
|
open() {
|
|
51
|
+
console.log('clicked');
|
|
52
52
|
setVisibility(true);
|
|
53
53
|
},
|
|
54
54
|
close() {
|
|
@@ -59,7 +59,10 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
59
59
|
[]
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
-
const
|
|
62
|
+
const handleDismiss = () => {
|
|
63
|
+
setVisibility(false);
|
|
64
|
+
closeAnim.start(onDismiss);
|
|
65
|
+
};
|
|
63
66
|
|
|
64
67
|
const resetPositionAnim = Animated.timing(panY, {
|
|
65
68
|
toValue: 0,
|
|
@@ -68,7 +71,7 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
68
71
|
});
|
|
69
72
|
|
|
70
73
|
const closeAnim = Animated.timing(panY, {
|
|
71
|
-
toValue:
|
|
74
|
+
toValue: deviceWindow.height,
|
|
72
75
|
duration: 300,
|
|
73
76
|
useNativeDriver: true,
|
|
74
77
|
});
|
|
@@ -78,11 +81,6 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
78
81
|
outputRange: [0, 0, 1],
|
|
79
82
|
});
|
|
80
83
|
|
|
81
|
-
const handleDismiss = () => {
|
|
82
|
-
setVisibility(false);
|
|
83
|
-
closeAnim.start(onDismiss);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
84
|
React.useEffect(() => {
|
|
87
85
|
resetPositionAnim.start();
|
|
88
86
|
}, [resetPositionAnim]);
|
|
@@ -110,8 +108,8 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
110
108
|
<View
|
|
111
109
|
style={[
|
|
112
110
|
{
|
|
113
|
-
maxWidth: ((
|
|
114
|
-
minWidth: ((
|
|
111
|
+
maxWidth: ((deviceWindow.width - 32) / 8) * 2,
|
|
112
|
+
minWidth: ((deviceWindow.width - 32) / 8) * 2,
|
|
115
113
|
},
|
|
116
114
|
]}
|
|
117
115
|
>
|
|
@@ -129,8 +127,8 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
129
127
|
<View
|
|
130
128
|
style={[
|
|
131
129
|
{
|
|
132
|
-
maxWidth: ((
|
|
133
|
-
minWidth: ((
|
|
130
|
+
maxWidth: ((deviceWindow.width - 32) / 8) * 4,
|
|
131
|
+
minWidth: ((deviceWindow.width - 32) / 8) * 4,
|
|
134
132
|
},
|
|
135
133
|
]}
|
|
136
134
|
>
|
|
@@ -148,8 +146,8 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
148
146
|
<View
|
|
149
147
|
style={[
|
|
150
148
|
{
|
|
151
|
-
maxWidth: ((
|
|
152
|
-
minWidth: ((
|
|
149
|
+
maxWidth: ((deviceWindow.width - 32) / 8) * 2,
|
|
150
|
+
minWidth: ((deviceWindow.width - 32) / 8) * 2,
|
|
153
151
|
},
|
|
154
152
|
computedStyle.sheetActionWrapper,
|
|
155
153
|
]}
|
|
@@ -188,38 +186,38 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
188
186
|
|
|
189
187
|
return (
|
|
190
188
|
<Modal
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
189
|
+
isVisible={visibility}
|
|
190
|
+
backdropTransitionOutTiming={backdropTransitionOutTiming}
|
|
191
|
+
onBackdropPress={() => {
|
|
192
|
+
onBackdropPress();
|
|
193
|
+
handleDismiss();
|
|
194
|
+
}}
|
|
195
|
+
onBackButtonPress={() => {
|
|
196
|
+
onBackButtonPress();
|
|
197
|
+
handleDismiss();
|
|
198
|
+
}}
|
|
199
|
+
onSwipeComplete={() => handleDismiss()}
|
|
200
|
+
style={{ flex: 1, margin: 0 }}
|
|
201
|
+
{...rest}
|
|
196
202
|
>
|
|
197
|
-
<View
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<View style={[computedStyle.overlay]} />
|
|
203
|
-
</TouchableWithoutFeedback>
|
|
204
|
-
<Animated.View
|
|
205
|
-
style={{
|
|
206
|
-
...computedStyle.container,
|
|
203
|
+
<Animated.View
|
|
204
|
+
style={[
|
|
205
|
+
computedStyle.container,
|
|
206
|
+
{
|
|
207
|
+
maxHeight: deviceWindow.height * maxSheetHeight,
|
|
207
208
|
transform: [{ translateY: translateY }],
|
|
208
|
-
}
|
|
209
|
+
},
|
|
210
|
+
]}
|
|
211
|
+
>
|
|
212
|
+
<View
|
|
213
|
+
style={[computedStyle.sheetIndicatorWrapper]}
|
|
214
|
+
{...panResponders.panHandlers}
|
|
209
215
|
>
|
|
210
|
-
<View
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
{!largeIcon && <View style={computedStyle.sliderIndicator} />}
|
|
216
|
-
</View>
|
|
217
|
-
{largeIcon ? renderLargeIconComponent() : renderSheetHeader()}
|
|
218
|
-
</View>
|
|
219
|
-
|
|
220
|
-
{children}
|
|
221
|
-
</Animated.View>
|
|
222
|
-
</View>
|
|
216
|
+
{!largeIcon && <View style={computedStyle.sliderIndicator} />}
|
|
217
|
+
</View>
|
|
218
|
+
{largeIcon ? renderLargeIconComponent() : renderSheetHeader()}
|
|
219
|
+
{children}
|
|
220
|
+
</Animated.View>
|
|
223
221
|
</Modal>
|
|
224
222
|
);
|
|
225
223
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ViewStyle, TextStyle } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { Palettes, Radius, Spacing } from '
|
|
4
|
+
import { Palettes, Radius, Spacing } from '../../themes';
|
|
5
5
|
|
|
6
6
|
interface ComputedStyleProps {
|
|
7
7
|
overlay?: ViewStyle;
|
|
@@ -31,16 +31,16 @@ export const getStyle = () => {
|
|
|
31
31
|
flex: 1,
|
|
32
32
|
justifyContent: 'flex-end',
|
|
33
33
|
};
|
|
34
|
-
computedStyle.overlayColor = {
|
|
35
|
-
backgroundColor: 'rgba(0,0,0,0.2)',
|
|
36
|
-
};
|
|
37
34
|
|
|
38
35
|
computedStyle.container = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
backgroundColor: Palettes.white[50],
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
bottom: 0,
|
|
39
|
+
width: '100%',
|
|
40
|
+
borderTopEndRadius: Spacing[16],
|
|
41
|
+
borderTopStartRadius: Spacing[16],
|
|
43
42
|
};
|
|
43
|
+
|
|
44
44
|
computedStyle.sliderIndicator = {
|
|
45
45
|
height: 5,
|
|
46
46
|
width: 100,
|
|
@@ -62,6 +62,7 @@ export const getStyle = () => {
|
|
|
62
62
|
|
|
63
63
|
computedStyle.sheetHeaderWrapper = {
|
|
64
64
|
paddingHorizontal: Spacing[16],
|
|
65
|
+
paddingBottom: Spacing[8],
|
|
65
66
|
};
|
|
66
67
|
computedStyle.sheetDismissIconWrapper = {
|
|
67
68
|
padding: 4,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import type { TextProps, TouchableHighlightProps } from 'react-native';
|
|
4
|
+
import type { ModalProps } from 'react-native-modal';
|
|
4
5
|
|
|
5
|
-
export interface BottomSheetProps {
|
|
6
|
+
export interface BottomSheetProps extends Omit<ModalProps, 'isVisible'> {
|
|
6
7
|
onDismiss?: () => void;
|
|
7
8
|
|
|
8
9
|
sheetHeader?: ReactNode;
|
|
@@ -27,9 +28,10 @@ export interface BottomSheetProps {
|
|
|
27
28
|
|
|
28
29
|
largeIconContainerHeight?: number;
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Decimal number between 0 - 1
|
|
33
|
+
*/
|
|
34
|
+
maxSheetHeight?: number;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export type BottomSheetRefHandle = {
|
package/src/components/index.ts
CHANGED
|
@@ -11,7 +11,10 @@ export { StepperCounter } from './StepperCounter/StepperCounter.component';
|
|
|
11
11
|
export { Divider } from './Divider/Divider.component';
|
|
12
12
|
export { Tabs } from './Tabs/Tabs.component';
|
|
13
13
|
export { RadioButton } from './RadioButton/RadioButton.component';
|
|
14
|
-
export {
|
|
14
|
+
export {
|
|
15
|
+
BottomSheet,
|
|
16
|
+
BottomSheetHandler,
|
|
17
|
+
} from './BottomSheet/BottomSheet.component';
|
|
15
18
|
export { RadioInput } from './RadioInput/RadioInput.component';
|
|
16
19
|
export { CheckBoxInput } from './CheckBoxInput/CheckBoxInput.component';
|
|
17
20
|
export { Checkbox } from './Checkbox/Checkbox.component';
|