@fountain-ui/lab 2.0.0-beta.42 → 2.0.0-beta.44
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/build/commonjs/BottomSheet/BottomSheetNative.js +24 -3
- package/build/commonjs/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/commonjs/BottomSheet/BottomSheetWeb.js +24 -25
- package/build/commonjs/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js +37 -21
- package/build/commonjs/BottomSheet/useDynamicSnapPoints.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetNative.js +25 -5
- package/build/module/BottomSheet/BottomSheetNative.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetProps.js.map +1 -1
- package/build/module/BottomSheet/BottomSheetWeb.js +24 -26
- package/build/module/BottomSheet/BottomSheetWeb.js.map +1 -1
- package/build/module/BottomSheet/useDynamicSnapPoints.js +33 -22
- package/build/module/BottomSheet/useDynamicSnapPoints.js.map +1 -1
- package/build/typescript/BottomSheet/BottomSheetProps.d.ts +13 -1
- package/build/typescript/BottomSheet/useDynamicSnapPoints.d.ts +7 -6
- package/build/typescript/Carousel/Carousel.d.ts +1 -1
- package/build/typescript/ViewPager/ViewPager.d.ts +1 -1
- package/build/typescript/ViewPager/ViewPager.native.d.ts +1 -1
- package/package.json +4 -4
- package/src/BottomSheet/BottomSheetNative.tsx +28 -3
- package/src/BottomSheet/BottomSheetProps.ts +15 -1
- package/src/BottomSheet/BottomSheetWeb.tsx +31 -25
- package/src/BottomSheet/useDynamicSnapPoints.ts +49 -28
- package/build/commonjs/BottomSheet/BottomSheet.js +0 -177
- package/build/commonjs/BottomSheet/BottomSheet.js.map +0 -1
- package/build/module/BottomSheet/BottomSheet.js +0 -161
- package/build/module/BottomSheet/BottomSheet.js.map +0 -1
- package/build/typescript/BottomSheet/BottomSheet.d.ts +0 -2
- package/src/BottomSheet/BottomSheet.tsx +0 -184
|
@@ -25,15 +25,23 @@ function BottomSheet(props) {
|
|
|
25
25
|
const {
|
|
26
26
|
backdropOpacity = 0.5,
|
|
27
27
|
children,
|
|
28
|
+
enableDynamicSizing = true,
|
|
29
|
+
header,
|
|
28
30
|
index,
|
|
31
|
+
maxHeightNormalizedRatio = 0.9,
|
|
29
32
|
onChange,
|
|
30
|
-
snapPoints
|
|
33
|
+
snapPoints = []
|
|
31
34
|
} = props;
|
|
32
35
|
|
|
33
36
|
const indexRef = _react.default.useRef(-1);
|
|
34
37
|
|
|
35
38
|
const bottomSheetRef = _react.default.useRef(null);
|
|
36
39
|
|
|
40
|
+
const {
|
|
41
|
+
height: windowHeight
|
|
42
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
43
|
+
const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);
|
|
44
|
+
|
|
37
45
|
const handleChange = _react.default.useCallback(newIndex => {
|
|
38
46
|
indexRef.current = newIndex;
|
|
39
47
|
|
|
@@ -80,6 +88,12 @@ function BottomSheet(props) {
|
|
|
80
88
|
const backgroundStyle = {
|
|
81
89
|
backgroundColor: theme.palette.paper.default
|
|
82
90
|
};
|
|
91
|
+
const contentWrapperStyle = {
|
|
92
|
+
flex: 1,
|
|
93
|
+
borderTopLeftRadius: 15,
|
|
94
|
+
borderTopRightRadius: 15,
|
|
95
|
+
overflow: 'hidden'
|
|
96
|
+
};
|
|
83
97
|
const isBackdropTransparent = backdropOpacity <= 0;
|
|
84
98
|
|
|
85
99
|
const OpacityAwareBackdrop = props => /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetBackdrop, _extends({}, props, {
|
|
@@ -100,8 +114,15 @@ function BottomSheet(props) {
|
|
|
100
114
|
ref: bottomSheetRef,
|
|
101
115
|
snapPoints: snapPoints,
|
|
102
116
|
style: modalStyle,
|
|
103
|
-
enablePanDownToClose: Boolean(onChange)
|
|
104
|
-
|
|
117
|
+
enablePanDownToClose: Boolean(onChange),
|
|
118
|
+
enableDynamicSizing: enableDynamicSizing,
|
|
119
|
+
maxDynamicContentSize: maxDynamicContentSize
|
|
120
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
121
|
+
style: contentWrapperStyle
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetScrollView, {
|
|
123
|
+
bounces: false,
|
|
124
|
+
stickyHeaderIndices: header ? [0] : undefined
|
|
125
|
+
}, header, children))));
|
|
105
126
|
}
|
|
106
127
|
|
|
107
128
|
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NoHandle","BottomSheet","props","backdropOpacity","children","index","onChange","snapPoints","indexRef","React","useRef","bottomSheetRef","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","useTheme","shadow","modalStyle","backgroundColor","Platform","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","isBackdropTransparent","OpacityAwareBackdrop","TransparentBackdrop","Boolean"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n index,\n onChange,\n snapPoints,\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n }),\n };\n const backgroundStyle = {\n backgroundColor: theme.palette.paper.default,\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n >\n {children}\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"names":["NoHandle","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","indexRef","React","useRef","bottomSheetRef","height","windowHeight","useWindowDimensions","maxDynamicContentSize","Math","round","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","useTheme","shadow","modalStyle","backgroundColor","Platform","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","contentWrapperStyle","flex","borderTopLeftRadius","borderTopRightRadius","overflow","isBackdropTransparent","OpacityAwareBackdrop","TransparentBackdrop","Boolean","undefined"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, useWindowDimensions, View } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const { height: windowHeight } = useWindowDimensions();\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n }),\n };\n const backgroundStyle = {\n backgroundColor: theme.palette.paper.default,\n };\n const contentWrapperStyle = {\n flex: 1,\n borderTopLeftRadius: 15,\n borderTopRightRadius: 15,\n overflow: 'hidden',\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n enableDynamicSizing={enableDynamicSizing}\n maxDynamicContentSize={maxDynamicContentSize}\n >\n {/* @ts-ignore */}\n <View style={contentWrapperStyle}>\n <BottomSheetScrollView\n bounces={false}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </BottomSheetScrollView>\n </View>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAQA;;;;;;AAEA,MAAMA,QAAQ,GAAG,MAAM,IAAvB;;AAEe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eAAe,GAAG,GADhB;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;EARX,IASFR,KATJ;;EAWA,MAAMS,QAAQ,GAAGC,cAAA,CAAMC,MAAN,CAAqB,CAAC,CAAtB,CAAjB;;EACA,MAAMC,cAAc,GAAGF,cAAA,CAAMC,MAAN,CAAsC,IAAtC,CAAvB;;EAEA,MAAM;IAAEE,MAAM,EAAEC;EAAV,IAA2B,IAAAC,gCAAA,GAAjC;EACA,MAAMC,qBAAqB,GAAGC,IAAI,CAAC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MAJL,EAMKF,QANL,CADJ,CAhBJ,CADJ,CADJ;AA+BH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n */\n snapPoints
|
|
1
|
+
{"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Enable dynamic sizing for content size.\n * @default true\n */\n enableDynamicSizing?: boolean;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Maximum height(normalized value) of dialog\n * ex. 30% => 0.3 / 90% => 0.9\n * @default 0.9\n */\n maxHeightNormalizedRatio?: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n * @default []\n */\n snapPoints?: Array<number | string>;\n}> {}\n"],"mappings":""}
|
|
@@ -13,6 +13,8 @@ var _core = require("@fountain-ui/core");
|
|
|
13
13
|
|
|
14
14
|
var _AnimatedY = _interopRequireDefault(require("../AnimatedY"));
|
|
15
15
|
|
|
16
|
+
var _useDynamicSnapPoints = _interopRequireDefault(require("./useDynamicSnapPoints"));
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
const useStyles = function () {
|
|
@@ -36,33 +38,18 @@ const useStyles = function () {
|
|
|
36
38
|
};
|
|
37
39
|
};
|
|
38
40
|
|
|
39
|
-
const convertHeightAsPixel = (windowHeight, value) => {
|
|
40
|
-
if (typeof value === 'number') {
|
|
41
|
-
return value;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const percentageRegex = new RegExp(/^[0-9]+%$/);
|
|
45
|
-
|
|
46
|
-
if (percentageRegex.test(value)) {
|
|
47
|
-
const percentage = parseFloat(value) / 100;
|
|
48
|
-
return isNaN(percentage) ? 0 : Math.round(windowHeight * percentage);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return 0;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
41
|
function BottomSheet(props) {
|
|
55
42
|
const {
|
|
56
43
|
backdropOpacity,
|
|
57
44
|
children,
|
|
45
|
+
enableDynamicSizing = true,
|
|
46
|
+
header,
|
|
58
47
|
index,
|
|
48
|
+
maxHeightNormalizedRatio = 0.9,
|
|
59
49
|
onChange,
|
|
60
|
-
snapPoints
|
|
50
|
+
snapPoints = []
|
|
61
51
|
} = props;
|
|
62
52
|
const styles = useStyles();
|
|
63
|
-
const {
|
|
64
|
-
height: windowHeight
|
|
65
|
-
} = (0, _reactNative.useWindowDimensions)();
|
|
66
53
|
|
|
67
54
|
const handleClose = () => {
|
|
68
55
|
if (onChange) {
|
|
@@ -70,8 +57,19 @@ function BottomSheet(props) {
|
|
|
70
57
|
}
|
|
71
58
|
};
|
|
72
59
|
|
|
73
|
-
const
|
|
74
|
-
|
|
60
|
+
const {
|
|
61
|
+
convertedSnapPoints,
|
|
62
|
+
handleContentSizeChange,
|
|
63
|
+
highestSnapPoint
|
|
64
|
+
} = (0, _useDynamicSnapPoints.default)({
|
|
65
|
+
enableDynamicSizing,
|
|
66
|
+
maxHeightNormalizedRatio,
|
|
67
|
+
snapPoints
|
|
68
|
+
});
|
|
69
|
+
const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);
|
|
70
|
+
const paperStyles = [styles.paper, {
|
|
71
|
+
height: highestSnapPoint
|
|
72
|
+
}];
|
|
75
73
|
return /*#__PURE__*/_react.default.createElement(_core.Modal, {
|
|
76
74
|
backdropOpacity: backdropOpacity,
|
|
77
75
|
onClose: handleClose,
|
|
@@ -82,10 +80,11 @@ function BottomSheet(props) {
|
|
|
82
80
|
translateY: translateY
|
|
83
81
|
}, /*#__PURE__*/_react.default.createElement(_core.Paper, {
|
|
84
82
|
elevation: 12,
|
|
85
|
-
style:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
style: paperStyles
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
|
|
85
|
+
onContentSizeChange: handleContentSizeChange,
|
|
86
|
+
stickyHeaderIndices: header ? [0] : undefined
|
|
87
|
+
}, header, children))));
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStyles","theme","useTheme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","
|
|
1
|
+
{"version":3,"names":["useStyles","theme","useTheme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","styles","handleClose","convertedSnapPoints","handleContentSizeChange","highestSnapPoint","useDynamicSnapPoints","translateY","paperStyles","height","css","StyleSheet","absoluteFill","undefined"],"sources":["BottomSheetWeb.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollView } from 'react-native';\nimport { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport AnimatedY from '../AnimatedY';\nimport type BottomSheetProps from './BottomSheetProps';\nimport useDynamicSnapPoints from './useDynamicSnapPoints';\n\ntype BottomSheetStyles = NamedStylesStringUnion<'root' | 'animated' | 'paper'>;\n\nconst useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {\n const theme = useTheme();\n\n return {\n root: {\n justifyContent: 'flex-end',\n zIndex: theme.zIndex.dialog,\n },\n animated: {\n alignSelf: 'center',\n maxWidth: 720,\n width: '100%',\n },\n paper: {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n flexGrow: 1,\n overflow: 'hidden',\n },\n };\n};\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const styles = useStyles();\n\n const handleClose = () => {\n if (onChange) {\n onChange(-1);\n }\n };\n\n const {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n } = useDynamicSnapPoints({\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n });\n\n const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);\n\n const paperStyles = [\n styles.paper,\n { height: highestSnapPoint },\n ];\n\n return (\n <Modal\n backdropOpacity={backdropOpacity}\n onClose={handleClose}\n visible={index >= 0}\n style={css([StyleSheet.absoluteFill, styles.root])}\n >\n <AnimatedY\n style={styles.animated}\n translateY={translateY}\n >\n <Paper\n elevation={12}\n style={paperStyles}\n >\n <ScrollView\n onContentSizeChange={handleContentSizeChange}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </ScrollView>\n </Paper>\n </AnimatedY>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA;;;;AAIA,MAAMA,SAAuC,GAAG,YAA+B;EAC3E,MAAMC,KAAK,GAAG,IAAAC,cAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,cAAc,EAAE,UADd;MAEFC,MAAM,EAAEJ,KAAK,CAACI,MAAN,CAAaC;IAFnB,CADH;IAKHC,QAAQ,EAAE;MACNC,SAAS,EAAE,QADL;MAENC,QAAQ,EAAE,GAFJ;MAGNC,KAAK,EAAE;IAHD,CALP;IAUHC,KAAK,EAAE;MACHC,sBAAsB,EAAE,CADrB;MAEHC,uBAAuB,EAAE,CAFtB;MAGHC,QAAQ,EAAE,CAHP;MAIHC,QAAQ,EAAE;IAJP;EAVJ,CAAP;AAiBH,CApBD;;AAsBe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eADE;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;EARX,IASFR,KATJ;EAWA,MAAMS,MAAM,GAAG1B,SAAS,EAAxB;;EAEA,MAAM2B,WAAW,GAAG,MAAM;IACtB,IAAIH,QAAJ,EAAc;MACVA,QAAQ,CAAC,CAAC,CAAF,CAAR;IACH;EACJ,CAJD;;EAMA,MAAM;IACFI,mBADE;IAEFC,uBAFE;IAGFC;EAHE,IAIF,IAAAC,6BAAA,EAAqB;IACrBX,mBADqB;IAErBG,wBAFqB;IAGrBE;EAHqB,CAArB,CAJJ;EAUA,MAAMO,UAAU,GAAGF,gBAAgB,IAAIF,mBAAmB,CAACN,KAAD,CAAnB,IAA8B,CAAlC,CAAnC;EAEA,MAAMW,WAAW,GAAG,CAChBP,MAAM,CAACf,KADS,EAEhB;IAAEuB,MAAM,EAAEJ;EAAV,CAFgB,CAApB;EAKA,oBACI,6BAAC,WAAD;IACI,eAAe,EAAEZ,eADrB;IAEI,OAAO,EAAES,WAFb;IAGI,OAAO,EAAEL,KAAK,IAAI,CAHtB;IAII,KAAK,EAAE,IAAAa,SAAA,EAAI,CAACC,gBAAA,CAAWC,YAAZ,EAA0BX,MAAM,CAACvB,IAAjC,CAAJ;EAJX,gBAMI,6BAAC,kBAAD;IACI,KAAK,EAAEuB,MAAM,CAACnB,QADlB;IAEI,UAAU,EAAEyB;EAFhB,gBAII,6BAAC,WAAD;IACI,SAAS,EAAE,EADf;IAEI,KAAK,EAAEC;EAFX,gBAII,6BAAC,uBAAD;IACI,mBAAmB,EAAEJ,uBADzB;IAEI,mBAAmB,EAAER,MAAM,GAAG,CAAC,CAAD,CAAH,GAASiB;EAFxC,GAIKjB,MAJL,EAMKF,QANL,CAJJ,CAJJ,CANJ,CADJ;AA2BH;;AAAA"}
|
|
@@ -5,45 +5,61 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = useDynamicSnapPoints;
|
|
7
7
|
|
|
8
|
+
var R = _interopRequireWildcard(require("ramda"));
|
|
9
|
+
|
|
8
10
|
var _react = require("react");
|
|
9
11
|
|
|
10
12
|
var _reactNative = require("react-native");
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
const convertSnapPoint = (snapPoint, windowHeight, maxDynamicContentSize) => {
|
|
19
|
+
if (typeof snapPoint === 'number') {
|
|
20
|
+
return Math.min(maxDynamicContentSize, snapPoint);
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
const percentageRegex = new RegExp(/^[0-9]+%$/);
|
|
18
24
|
|
|
19
|
-
if (percentageRegex.test(
|
|
20
|
-
const percentage = parseFloat(
|
|
21
|
-
return isNaN(percentage) ? 0 : Math.round(windowHeight * percentage);
|
|
25
|
+
if (percentageRegex.test(snapPoint)) {
|
|
26
|
+
const percentage = parseFloat(snapPoint) / 100;
|
|
27
|
+
return isNaN(percentage) ? 0 : Math.min(maxDynamicContentSize, Math.round(windowHeight * percentage));
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
return 0;
|
|
25
31
|
};
|
|
26
32
|
|
|
27
|
-
function useDynamicSnapPoints(
|
|
33
|
+
function useDynamicSnapPoints(params) {
|
|
28
34
|
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
enableDynamicSizing,
|
|
36
|
+
maxHeightNormalizedRatio,
|
|
37
|
+
snapPoints
|
|
38
|
+
} = params;
|
|
32
39
|
const {
|
|
33
|
-
height:
|
|
40
|
+
height: windowHeight
|
|
34
41
|
} = (0, _reactNative.useWindowDimensions)();
|
|
35
|
-
const [
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const [contentHeight, setContentHeight] = (0, _react.useState)(0);
|
|
43
|
+
const convertedSnapPoints = (0, _react.useMemo)(() => {
|
|
44
|
+
const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);
|
|
45
|
+
const convertedSnapPoints = snapPoints.map(snapPoint => {
|
|
46
|
+
return convertSnapPoint(snapPoint, windowHeight, maxDynamicContentSize);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (enableDynamicSizing && contentHeight !== 0) {
|
|
50
|
+
convertedSnapPoints.push(convertSnapPoint(contentHeight, windowHeight, maxDynamicContentSize));
|
|
42
51
|
}
|
|
43
|
-
|
|
52
|
+
|
|
53
|
+
return Array.from(new Set(convertedSnapPoints)).sort((a, b) => a - b);
|
|
54
|
+
}, [contentHeight, snapPoints, windowHeight]);
|
|
55
|
+
const highestSnapPoint = R.last(convertedSnapPoints) ?? 0;
|
|
56
|
+
const handleContentSizeChange = (0, _react.useCallback)((_, height) => {
|
|
57
|
+
setContentHeight(height);
|
|
58
|
+
}, []);
|
|
44
59
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
60
|
+
convertedSnapPoints,
|
|
61
|
+
handleContentSizeChange,
|
|
62
|
+
highestSnapPoint
|
|
47
63
|
};
|
|
48
64
|
}
|
|
49
65
|
//# sourceMappingURL=useDynamicSnapPoints.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["convertSnapPoint","snapPoint","windowHeight","maxDynamicContentSize","Math","min","percentageRegex","RegExp","test","percentage","parseFloat","isNaN","round","useDynamicSnapPoints","params","enableDynamicSizing","maxHeightNormalizedRatio","snapPoints","height","useWindowDimensions","contentHeight","setContentHeight","useState","convertedSnapPoints","useMemo","map","push","Array","from","Set","sort","a","b","highestSnapPoint","R","last","handleContentSizeChange","useCallback","_"],"sources":["useDynamicSnapPoints.ts"],"sourcesContent":["import * as R from 'ramda';\nimport { useCallback, useMemo, useState } from 'react';\nimport { useWindowDimensions } from 'react-native';\n\ninterface UseDynamicSnapPointsParams {\n enableDynamicSizing: boolean;\n maxHeightNormalizedRatio: number;\n snapPoints: (number | string)[];\n}\n\ninterface UseDynamicSnapPointsReturns {\n convertedSnapPoints: number[];\n handleContentSizeChange: (w: number, h: number) => void;\n highestSnapPoint: number;\n}\n\nconst convertSnapPoint = (snapPoint: number | string, windowHeight: number, maxDynamicContentSize: number): number => {\n if (typeof snapPoint === 'number') {\n return Math.min(maxDynamicContentSize, snapPoint);\n }\n\n const percentageRegex = new RegExp(/^[0-9]+%$/);\n if (percentageRegex.test(snapPoint)) {\n const percentage = parseFloat(snapPoint) / 100;\n return isNaN(percentage) ? 0 : Math.min(maxDynamicContentSize, Math.round(windowHeight * percentage));\n }\n\n return 0;\n};\n\nexport default function useDynamicSnapPoints(params: UseDynamicSnapPointsParams): UseDynamicSnapPointsReturns {\n const {\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n } = params;\n\n const { height: windowHeight } = useWindowDimensions();\n\n const [contentHeight, setContentHeight] = useState<number>(0);\n\n const convertedSnapPoints = useMemo(() => {\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const convertedSnapPoints = snapPoints.map((snapPoint) => {\n return convertSnapPoint(snapPoint, windowHeight, maxDynamicContentSize);\n });\n\n if (enableDynamicSizing && contentHeight !== 0) {\n convertedSnapPoints.push(\n convertSnapPoint(contentHeight, windowHeight, maxDynamicContentSize),\n );\n }\n\n return Array.from(new Set(convertedSnapPoints)).sort((a, b) => a - b);\n }, [\n contentHeight,\n snapPoints,\n windowHeight,\n ]);\n\n const highestSnapPoint = R.last(convertedSnapPoints) ?? 0;\n\n const handleContentSizeChange = useCallback((_: number, height: number) => {\n setContentHeight(height);\n }, []);\n\n return {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n };\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAcA,MAAMA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oB,aAAD,EAAgBlB,YAAhB,EAA8BC,qBAA9B,CADpB;IAGH;;IAED,OAAOwB,KAAK,CAACC,IAAN,CAAW,IAAIC,GAAJ,CAAQN,mBAAR,CAAX,EAAyCO,IAAzC,CAA8C,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,GAAGC,CAA5D,CAAP;EACH,CAd2B,EAczB,CACCZ,aADD,EAECH,UAFD,EAGCf,YAHD,CAdyB,CAA5B;EAoBA,MAAM+B,gBAAgB,GAAGC,CAAC,CAACC,IAAF,CAAOZ,mBAAP,KAA+B,CAAxD;EAEA,MAAMa,uBAAuB,GAAG,IAAAC,kBAAA,EAAY,CAACC,CAAD,EAAYpB,MAAZ,KAA+B;IACvEG,gBAAgB,CAACH,MAAD,CAAhB;EACH,CAF+B,EAE7B,EAF6B,CAAhC;EAIA,OAAO;IACHK,mBADG;IAEHa,uBAFG;IAGHH;EAHG,CAAP;AAKH"}
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { Platform } from 'react-native';
|
|
4
|
+
import { Platform, useWindowDimensions, View } from 'react-native';
|
|
5
5
|
import { useTheme } from '@fountain-ui/styles';
|
|
6
|
-
import { BottomSheetBackdrop, BottomSheetModal, BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
6
|
+
import { BottomSheetBackdrop, BottomSheetModal, BottomSheetModalProvider, BottomSheetScrollView } from '@gorhom/bottom-sheet';
|
|
7
7
|
import TransparentBackdrop from './TransparentBackdrop';
|
|
8
8
|
|
|
9
9
|
const NoHandle = () => null;
|
|
@@ -12,12 +12,19 @@ export default function BottomSheet(props) {
|
|
|
12
12
|
const {
|
|
13
13
|
backdropOpacity = 0.5,
|
|
14
14
|
children,
|
|
15
|
+
enableDynamicSizing = true,
|
|
16
|
+
header,
|
|
15
17
|
index,
|
|
18
|
+
maxHeightNormalizedRatio = 0.9,
|
|
16
19
|
onChange,
|
|
17
|
-
snapPoints
|
|
20
|
+
snapPoints = []
|
|
18
21
|
} = props;
|
|
19
22
|
const indexRef = React.useRef(-1);
|
|
20
23
|
const bottomSheetRef = React.useRef(null);
|
|
24
|
+
const {
|
|
25
|
+
height: windowHeight
|
|
26
|
+
} = useWindowDimensions();
|
|
27
|
+
const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);
|
|
21
28
|
const handleChange = React.useCallback(newIndex => {
|
|
22
29
|
indexRef.current = newIndex;
|
|
23
30
|
|
|
@@ -61,6 +68,12 @@ export default function BottomSheet(props) {
|
|
|
61
68
|
const backgroundStyle = {
|
|
62
69
|
backgroundColor: theme.palette.paper.default
|
|
63
70
|
};
|
|
71
|
+
const contentWrapperStyle = {
|
|
72
|
+
flex: 1,
|
|
73
|
+
borderTopLeftRadius: 15,
|
|
74
|
+
borderTopRightRadius: 15,
|
|
75
|
+
overflow: 'hidden'
|
|
76
|
+
};
|
|
64
77
|
const isBackdropTransparent = backdropOpacity <= 0;
|
|
65
78
|
|
|
66
79
|
const OpacityAwareBackdrop = props => /*#__PURE__*/React.createElement(BottomSheetBackdrop, _extends({}, props, {
|
|
@@ -81,8 +94,15 @@ export default function BottomSheet(props) {
|
|
|
81
94
|
ref: bottomSheetRef,
|
|
82
95
|
snapPoints: snapPoints,
|
|
83
96
|
style: modalStyle,
|
|
84
|
-
enablePanDownToClose: Boolean(onChange)
|
|
85
|
-
|
|
97
|
+
enablePanDownToClose: Boolean(onChange),
|
|
98
|
+
enableDynamicSizing: enableDynamicSizing,
|
|
99
|
+
maxDynamicContentSize: maxDynamicContentSize
|
|
100
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
101
|
+
style: contentWrapperStyle
|
|
102
|
+
}, /*#__PURE__*/React.createElement(BottomSheetScrollView, {
|
|
103
|
+
bounces: false,
|
|
104
|
+
stickyHeaderIndices: header ? [0] : undefined
|
|
105
|
+
}, header, children))));
|
|
86
106
|
}
|
|
87
107
|
;
|
|
88
108
|
//# sourceMappingURL=BottomSheetNative.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","useTheme","BottomSheetBackdrop","BottomSheetModal","BottomSheetModalProvider","TransparentBackdrop","NoHandle","BottomSheet","props","backdropOpacity","children","index","onChange","snapPoints","indexRef","useRef","bottomSheetRef","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","shadow","modalStyle","backgroundColor","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","isBackdropTransparent","OpacityAwareBackdrop","Boolean"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n index,\n onChange,\n snapPoints,\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n }),\n };\n const backgroundStyle = {\n backgroundColor: theme.palette.paper.default,\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n >\n {children}\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,
|
|
1
|
+
{"version":3,"names":["React","Platform","useWindowDimensions","View","useTheme","BottomSheetBackdrop","BottomSheetModal","BottomSheetModalProvider","BottomSheetScrollView","TransparentBackdrop","NoHandle","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","indexRef","useRef","bottomSheetRef","height","windowHeight","maxDynamicContentSize","Math","round","handleChange","useCallback","newIndex","current","handleDismiss","useEffect","present","dismiss","snapToIndex","theme","shadow","modalStyle","backgroundColor","select","android","elevation","ios","web","boxShadow","backgroundStyle","palette","paper","default","contentWrapperStyle","flex","borderTopLeftRadius","borderTopRightRadius","overflow","isBackdropTransparent","OpacityAwareBackdrop","Boolean","undefined"],"sources":["BottomSheetNative.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, useWindowDimensions, View } from 'react-native';\nimport { useTheme } from '@fountain-ui/styles';\nimport {\n BottomSheetBackdrop,\n BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetScrollView,\n} from '@gorhom/bottom-sheet';\nimport type BottomSheetProps from './BottomSheetProps';\nimport TransparentBackdrop from './TransparentBackdrop';\n\nconst NoHandle = () => null;\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity = 0.5,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const indexRef = React.useRef<number>(-1);\n const bottomSheetRef = React.useRef<BottomSheetModal | null>(null);\n\n const { height: windowHeight } = useWindowDimensions();\n const maxDynamicContentSize = Math.round(windowHeight * maxHeightNormalizedRatio);\n\n const handleChange = React.useCallback((newIndex: number) => {\n indexRef.current = newIndex;\n\n if (onChange) {\n onChange(newIndex);\n }\n }, [onChange]);\n\n const handleDismiss = React.useCallback(() => {\n handleChange(-1);\n }, [handleChange]);\n\n React.useEffect(() => {\n if (index === indexRef.current) {\n return;\n }\n\n if (indexRef.current < 0 && index >= 0) {\n bottomSheetRef.current?.present();\n } else if (indexRef.current >= 0 && index < 0) {\n bottomSheetRef.current?.dismiss();\n } else {\n // @ts-ignore\n bottomSheetRef.current?.snapToIndex(index);\n }\n }, [index]);\n\n const theme = useTheme();\n const shadow = theme.shadow[12];\n const modalStyle = {\n backgroundColor: '#ffffff00',\n ...Platform.select<object>({\n android: shadow?.elevation,\n ios: shadow?.shadow,\n web: shadow?.boxShadow,\n }),\n };\n const backgroundStyle = {\n backgroundColor: theme.palette.paper.default,\n };\n const contentWrapperStyle = {\n flex: 1,\n borderTopLeftRadius: 15,\n borderTopRightRadius: 15,\n overflow: 'hidden',\n };\n\n const isBackdropTransparent = backdropOpacity <= 0;\n\n const OpacityAwareBackdrop = (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n opacity={backdropOpacity}\n pressBehavior={onChange ? 'close' : 'none'}\n />\n );\n\n return (\n <BottomSheetModalProvider>\n <BottomSheetModal\n backdropComponent={isBackdropTransparent ? TransparentBackdrop : OpacityAwareBackdrop}\n // @ts-ignore\n backgroundStyle={backgroundStyle}\n index={index}\n handleComponent={NoHandle}\n onChange={handleChange}\n onDismiss={handleDismiss}\n ref={bottomSheetRef}\n snapPoints={snapPoints}\n style={modalStyle}\n enablePanDownToClose={Boolean(onChange)}\n enableDynamicSizing={enableDynamicSizing}\n maxDynamicContentSize={maxDynamicContentSize}\n >\n {/* @ts-ignore */}\n <View style={contentWrapperStyle}>\n <BottomSheetScrollView\n bounces={false}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </BottomSheetScrollView>\n </View>\n </BottomSheetModal>\n </BottomSheetModalProvider>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAmBC,mBAAnB,EAAwCC,IAAxC,QAAoD,cAApD;AACA,SAASC,QAAT,QAAyB,qBAAzB;AACA,SACIC,mBADJ,EAGIC,gBAHJ,EAIIC,wBAJJ,EAKIC,qBALJ,QAMO,sBANP;AAQA,OAAOC,mBAAP,MAAgC,uBAAhC;;AAEA,MAAMC,QAAQ,GAAG,MAAM,IAAvB;;AAEA,eAAe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eAAe,GAAG,GADhB;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;EARX,IASFR,KATJ;EAWA,MAAMS,QAAQ,GAAGrB,KAAK,CAACsB,MAAN,CAAqB,CAAC,CAAtB,CAAjB;EACA,MAAMC,cAAc,GAAGvB,KAAK,CAACsB,MAA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;EAAb,gBACI,oBAAC,qBAAD;IACI,OAAO,EAAE,KADb;IAEI,mBAAmB,EAAEpC,MAAM,GAAG,CAAC,CAAD,CAAH,GAAS4C;EAFxC,GAIK5C,MAJL,EAMKF,QANL,CADJ,CAhBJ,CADJ,CADJ;AA+BH;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n */\n snapPoints
|
|
1
|
+
{"version":3,"names":[],"sources":["BottomSheetProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ComponentProps } from '@fountain-ui/core';\n\nexport default interface BottomSheetProps extends ComponentProps<{\n /**\n * Opacity for BackdropComponent\n * @default 0.5\n */\n backdropOpacity?: number;\n\n /**\n * BottomSheet children, usually the included sub-components.\n */\n children?: React.ReactNode;\n\n /**\n * Enable dynamic sizing for content size.\n * @default true\n */\n enableDynamicSizing?: boolean;\n\n /**\n * Area to be fixed on the top of the bottom sheet.\n */\n header?: React.ReactNode;\n\n /**\n * Snap index. You could also provide -1 to bottom sheet in closed state.\n */\n index: number;\n\n /**\n * Maximum height(normalized value) of dialog\n * ex. 30% => 0.3 / 90% => 0.9\n * @default 0.9\n */\n maxHeightNormalizedRatio?: number;\n\n /**\n * Callback fired when the index is changed.\n * Important! Use memoized value.\n */\n onChange?: (newIndex: number) => void;\n\n /**\n * Points for the bottom sheet to snap to, points should be sorted from bottom to top.\n * Important! Use memoized value.\n * Only number type or string type(~% format) can be used.\n * @default []\n */\n snapPoints?: Array<number | string>;\n}> {}\n"],"mappings":""}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ScrollView } from 'react-native';
|
|
3
3
|
import { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';
|
|
4
4
|
import AnimatedY from '../AnimatedY';
|
|
5
|
+
import useDynamicSnapPoints from './useDynamicSnapPoints';
|
|
5
6
|
|
|
6
7
|
const useStyles = function () {
|
|
7
8
|
const theme = useTheme();
|
|
@@ -24,33 +25,18 @@ const useStyles = function () {
|
|
|
24
25
|
};
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
const convertHeightAsPixel = (windowHeight, value) => {
|
|
28
|
-
if (typeof value === 'number') {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const percentageRegex = new RegExp(/^[0-9]+%$/);
|
|
33
|
-
|
|
34
|
-
if (percentageRegex.test(value)) {
|
|
35
|
-
const percentage = parseFloat(value) / 100;
|
|
36
|
-
return isNaN(percentage) ? 0 : Math.round(windowHeight * percentage);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return 0;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
28
|
export default function BottomSheet(props) {
|
|
43
29
|
const {
|
|
44
30
|
backdropOpacity,
|
|
45
31
|
children,
|
|
32
|
+
enableDynamicSizing = true,
|
|
33
|
+
header,
|
|
46
34
|
index,
|
|
35
|
+
maxHeightNormalizedRatio = 0.9,
|
|
47
36
|
onChange,
|
|
48
|
-
snapPoints
|
|
37
|
+
snapPoints = []
|
|
49
38
|
} = props;
|
|
50
39
|
const styles = useStyles();
|
|
51
|
-
const {
|
|
52
|
-
height: windowHeight
|
|
53
|
-
} = useWindowDimensions();
|
|
54
40
|
|
|
55
41
|
const handleClose = () => {
|
|
56
42
|
if (onChange) {
|
|
@@ -58,8 +44,19 @@ export default function BottomSheet(props) {
|
|
|
58
44
|
}
|
|
59
45
|
};
|
|
60
46
|
|
|
61
|
-
const
|
|
62
|
-
|
|
47
|
+
const {
|
|
48
|
+
convertedSnapPoints,
|
|
49
|
+
handleContentSizeChange,
|
|
50
|
+
highestSnapPoint
|
|
51
|
+
} = useDynamicSnapPoints({
|
|
52
|
+
enableDynamicSizing,
|
|
53
|
+
maxHeightNormalizedRatio,
|
|
54
|
+
snapPoints
|
|
55
|
+
});
|
|
56
|
+
const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);
|
|
57
|
+
const paperStyles = [styles.paper, {
|
|
58
|
+
height: highestSnapPoint
|
|
59
|
+
}];
|
|
63
60
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
64
61
|
backdropOpacity: backdropOpacity,
|
|
65
62
|
onClose: handleClose,
|
|
@@ -70,10 +67,11 @@ export default function BottomSheet(props) {
|
|
|
70
67
|
translateY: translateY
|
|
71
68
|
}, /*#__PURE__*/React.createElement(Paper, {
|
|
72
69
|
elevation: 12,
|
|
73
|
-
style:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
style: paperStyles
|
|
71
|
+
}, /*#__PURE__*/React.createElement(ScrollView, {
|
|
72
|
+
onContentSizeChange: handleContentSizeChange,
|
|
73
|
+
stickyHeaderIndices: header ? [0] : undefined
|
|
74
|
+
}, header, children))));
|
|
77
75
|
}
|
|
78
76
|
;
|
|
79
77
|
//# sourceMappingURL=BottomSheetWeb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","ScrollView","Modal","Paper","StyleSheet","css","useTheme","AnimatedY","useDynamicSnapPoints","useStyles","theme","root","justifyContent","zIndex","dialog","animated","alignSelf","maxWidth","width","paper","borderBottomLeftRadius","borderBottomRightRadius","flexGrow","overflow","BottomSheet","props","backdropOpacity","children","enableDynamicSizing","header","index","maxHeightNormalizedRatio","onChange","snapPoints","styles","handleClose","convertedSnapPoints","handleContentSizeChange","highestSnapPoint","translateY","paperStyles","height","absoluteFill","undefined"],"sources":["BottomSheetWeb.tsx"],"sourcesContent":["import React from 'react';\nimport { ScrollView } from 'react-native';\nimport { Modal, Paper, StyleSheet, css, useTheme } from '@fountain-ui/core';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport AnimatedY from '../AnimatedY';\nimport type BottomSheetProps from './BottomSheetProps';\nimport useDynamicSnapPoints from './useDynamicSnapPoints';\n\ntype BottomSheetStyles = NamedStylesStringUnion<'root' | 'animated' | 'paper'>;\n\nconst useStyles: UseStyles<BottomSheetStyles> = function (): BottomSheetStyles {\n const theme = useTheme();\n\n return {\n root: {\n justifyContent: 'flex-end',\n zIndex: theme.zIndex.dialog,\n },\n animated: {\n alignSelf: 'center',\n maxWidth: 720,\n width: '100%',\n },\n paper: {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n flexGrow: 1,\n overflow: 'hidden',\n },\n };\n};\n\nexport default function BottomSheet(props: BottomSheetProps) {\n const {\n backdropOpacity,\n children,\n enableDynamicSizing = true,\n header,\n index,\n maxHeightNormalizedRatio = 0.9,\n onChange,\n snapPoints = [],\n } = props;\n\n const styles = useStyles();\n\n const handleClose = () => {\n if (onChange) {\n onChange(-1);\n }\n };\n\n const {\n convertedSnapPoints,\n handleContentSizeChange,\n highestSnapPoint,\n } = useDynamicSnapPoints({\n enableDynamicSizing,\n maxHeightNormalizedRatio,\n snapPoints,\n });\n\n const translateY = highestSnapPoint - (convertedSnapPoints[index] ?? 0);\n\n const paperStyles = [\n styles.paper,\n { height: highestSnapPoint },\n ];\n\n return (\n <Modal\n backdropOpacity={backdropOpacity}\n onClose={handleClose}\n visible={index >= 0}\n style={css([StyleSheet.absoluteFill, styles.root])}\n >\n <AnimatedY\n style={styles.animated}\n translateY={translateY}\n >\n <Paper\n elevation={12}\n style={paperStyles}\n >\n <ScrollView\n onContentSizeChange={handleContentSizeChange}\n stickyHeaderIndices={header ? [0] : undefined}\n >\n {header}\n\n {children}\n </ScrollView>\n </Paper>\n </AnimatedY>\n </Modal>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,KAAT,EAAgBC,KAAhB,EAAuBC,UAAvB,EAAmCC,GAAnC,EAAwCC,QAAxC,QAAwD,mBAAxD;AAEA,OAAOC,SAAP,MAAsB,cAAtB;AAEA,OAAOC,oBAAP,MAAiC,wBAAjC;;AAIA,MAAMC,SAAuC,GAAG,YAA+B;EAC3E,MAAMC,KAAK,GAAGJ,QAAQ,EAAtB;EAEA,OAAO;IACHK,IAAI,EAAE;MACFC,cAAc,EAAE,UADd;MAEFC,MAAM,EAAEH,KAAK,CAACG,MAAN,CAAaC;IAFnB,CADH;IAKHC,QAAQ,EAAE;MACNC,SAAS,EAAE,QADL;MAENC,QAAQ,EAAE,GAFJ;MAGNC,KAAK,EAAE;IAHD,CALP;IAUHC,KAAK,EAAE;MACHC,sBAAsB,EAAE,CADrB;MAEHC,uBAAuB,EAAE,CAFtB;MAGHC,QAAQ,EAAE,CAHP;MAIHC,QAAQ,EAAE;IAJP;EAVJ,CAAP;AAiBH,CApBD;;AAsBA,eAAe,SAASC,WAAT,CAAqBC,KAArB,EAA8C;EACzD,MAAM;IACFC,eADE;IAEFC,QAFE;IAGFC,mBAAmB,GAAG,IAHpB;IAIFC,MAJE;IAKFC,KALE;IAMFC,wBAAwB,GAAG,GANzB;IAOFC,QAPE;IAQFC,UAAU,GAAG;EARX,IASFR,KATJ;EAWA,MAAMS,MAAM,GAAGzB,SAAS,EAAxB;;EAEA,MAAM0B,WAAW,GAAG,MAAM;IACtB,IAAIH,QAAJ,EAAc;MACVA,QAAQ,CAAC,CAAC,CAAF,CAAR;IACH;EACJ,CAJD;;EAMA,MAAM;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