react-modal-sheet 3.0.0 → 3.2.0
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/README.md +55 -39
- package/dist/index.js +28 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/hooks.tsx +17 -8
- package/src/sheet.tsx +31 -20
- package/src/types.tsx +1 -0
- package/src/utils.ts +6 -3
package/src/utils.ts
CHANGED
|
@@ -74,15 +74,18 @@ export function validateSnapTo({
|
|
|
74
74
|
}) {
|
|
75
75
|
if (snapTo < 0) {
|
|
76
76
|
console.warn(
|
|
77
|
-
`Snap point is out of bounds. Sheet height is ${sheetHeight} but snap point is ${
|
|
78
|
-
Math.abs(snapTo)
|
|
77
|
+
`Snap point is out of bounds. Sheet height is ${sheetHeight} but snap point is ${
|
|
78
|
+
sheetHeight + Math.abs(snapTo)
|
|
79
|
+
}.`
|
|
79
80
|
);
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
return Math.max(Math.round(snapTo), 0);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
export function mergeRefs<T = any>(
|
|
86
|
+
export function mergeRefs<T = any>(
|
|
87
|
+
refs: Array<ForwardedRef<T>>
|
|
88
|
+
): RefCallback<T> {
|
|
86
89
|
return (value: any) => {
|
|
87
90
|
refs.forEach((ref: any) => {
|
|
88
91
|
if (typeof ref === 'function') {
|