@tamagui/sheet 2.0.0 → 2.1.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/.turbo/turbo-build.log +1 -1
- package/dist/cjs/SheetImplementationCustom.cjs +73 -24
- package/dist/cjs/SheetImplementationCustom.native.js +83 -28
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
- package/dist/cjs/SheetScrollView.cjs +18 -4
- package/dist/cjs/SheetScrollView.native.js +18 -4
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/nativeSheet.cjs +3 -0
- package/dist/cjs/nativeSheet.native.js +3 -0
- package/dist/cjs/nativeSheet.native.js.map +1 -1
- package/dist/cjs/useKeyboardControllerSheet.cjs +62 -6
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/cjs/useSheetScrollViewGestures.cjs +6 -1
- package/dist/cjs/webViewport.cjs +50 -0
- package/dist/cjs/webViewport.native.js +54 -0
- package/dist/cjs/webViewport.native.js.map +1 -0
- package/dist/esm/SheetImplementationCustom.mjs +73 -24
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +83 -28
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +19 -5
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +19 -5
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/nativeSheet.mjs +3 -0
- package/dist/esm/nativeSheet.mjs.map +1 -1
- package/dist/esm/nativeSheet.native.js +3 -0
- package/dist/esm/nativeSheet.native.js.map +1 -1
- package/dist/esm/useKeyboardControllerSheet.mjs +63 -7
- package/dist/esm/useKeyboardControllerSheet.mjs.map +1 -1
- package/dist/esm/useSheetProviderProps.mjs.map +1 -1
- package/dist/esm/useSheetProviderProps.native.js.map +1 -1
- package/dist/esm/useSheetScrollViewGestures.mjs +6 -1
- package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -1
- package/dist/esm/webViewport.mjs +22 -0
- package/dist/esm/webViewport.mjs.map +1 -0
- package/dist/esm/webViewport.native.js +23 -0
- package/dist/esm/webViewport.native.js.map +1 -0
- package/dist/jsx/SheetImplementationCustom.mjs +73 -24
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.js +83 -28
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +19 -5
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.js +18 -4
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/nativeSheet.mjs +3 -0
- package/dist/jsx/nativeSheet.mjs.map +1 -1
- package/dist/jsx/nativeSheet.native.js +3 -0
- package/dist/jsx/nativeSheet.native.js.map +1 -1
- package/dist/jsx/useKeyboardControllerSheet.mjs +63 -7
- package/dist/jsx/useKeyboardControllerSheet.mjs.map +1 -1
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
- package/dist/jsx/useSheetScrollViewGestures.mjs +6 -1
- package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -1
- package/dist/jsx/webViewport.mjs +22 -0
- package/dist/jsx/webViewport.mjs.map +1 -0
- package/dist/jsx/webViewport.native.js +54 -0
- package/dist/jsx/webViewport.native.js.map +1 -0
- package/package.json +20 -20
- package/src/SheetImplementationCustom.tsx +300 -56
- package/src/SheetScrollView.tsx +48 -9
- package/src/nativeSheet.tsx +3 -0
- package/src/types.tsx +11 -1
- package/src/useKeyboardControllerSheet.ts +106 -10
- package/src/useSheetProviderProps.tsx +16 -0
- package/src/useSheetScrollViewGestures.ts +23 -2
- package/src/webViewport.ts +52 -0
- package/types/SheetContext.d.ts +3 -0
- package/types/SheetContext.d.ts.map +1 -1
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/nativeSheet.d.ts.map +1 -1
- package/types/types.d.ts +4 -1
- package/types/types.d.ts.map +1 -1
- package/types/useKeyboardControllerSheet.d.ts +14 -3
- package/types/useKeyboardControllerSheet.d.ts.map +1 -1
- package/types/useSheetProviderProps.d.ts +3 -0
- package/types/useSheetProviderProps.d.ts.map +1 -1
- package/types/useSheetScrollViewGestures.d.ts.map +1 -1
- package/types/webViewport.d.ts +30 -0
- package/types/webViewport.d.ts.map +1 -0
|
@@ -1,26 +1,122 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Web
|
|
3
|
-
*
|
|
2
|
+
* Web implementation of the keyboard controller sheet hook.
|
|
3
|
+
*
|
|
4
|
+
* Mobile browsers don't expose a keyboard API, but they do resize the
|
|
5
|
+
* VisualViewport when the soft keyboard opens. We derive the keyboard height as
|
|
6
|
+
* `getStableLayoutViewportHeight() - visualViewport.height` (see webViewport —
|
|
7
|
+
* the stable baseline is document.documentElement.clientHeight, NOT innerHeight,
|
|
8
|
+
* which itself shrinks with the keyboard on real iOS Safari) and feed it into the
|
|
9
|
+
* keyboardOccludedHeight scroll padding in SheetImplementationCustom.
|
|
10
|
+
*
|
|
11
|
+
* Without this, a bottom sheet on mobile web stays pinned behind the keyboard:
|
|
12
|
+
* react-native-web's Dimensions tracks the (shrinking) VisualViewport, so any
|
|
13
|
+
* content sized off window dimensions collapses while the sheet's bottom stays
|
|
14
|
+
* occluded. See SheetImplementationCustom's activePositions / keyboardOccludedHeight.
|
|
4
15
|
*/
|
|
5
16
|
|
|
6
|
-
import { useRef } from 'react'
|
|
17
|
+
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
18
|
+
import { isWeb } from '@tamagui/constants'
|
|
7
19
|
import type {
|
|
8
20
|
KeyboardControllerSheetOptions,
|
|
9
21
|
KeyboardControllerSheetResult,
|
|
10
22
|
} from './types'
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
import {
|
|
24
|
+
getWebKeyboardHeight,
|
|
25
|
+
isEditableElement,
|
|
26
|
+
MIN_KEYBOARD_HEIGHT,
|
|
27
|
+
} from './webViewport'
|
|
13
28
|
|
|
14
29
|
export function useKeyboardControllerSheet(
|
|
15
|
-
|
|
30
|
+
options: KeyboardControllerSheetOptions
|
|
16
31
|
): KeyboardControllerSheetResult {
|
|
32
|
+
const { enabled } = options
|
|
33
|
+
|
|
34
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0)
|
|
35
|
+
const [isKeyboardVisible, setIsKeyboardVisible] = useState(false)
|
|
36
|
+
|
|
37
|
+
// action-sheet pattern: pause keyboard hide events during drag so the sheet
|
|
38
|
+
// position doesn't revert mid-gesture when a TextInput blurs.
|
|
17
39
|
const pauseKeyboardHandler = useRef(false)
|
|
40
|
+
const pendingHide = useRef(false)
|
|
41
|
+
// live mirror of isKeyboardVisible so the listener can read it without
|
|
42
|
+
// re-subscribing on every toggle.
|
|
43
|
+
const isVisibleRef = useRef(false)
|
|
44
|
+
isVisibleRef.current = isKeyboardVisible
|
|
45
|
+
|
|
46
|
+
const dismissKeyboard = useCallback(() => {
|
|
47
|
+
if (typeof document === 'undefined') return
|
|
48
|
+
const active = document.activeElement as HTMLElement | null
|
|
49
|
+
if (isEditableElement(active)) {
|
|
50
|
+
active?.blur?.()
|
|
51
|
+
}
|
|
52
|
+
}, [])
|
|
53
|
+
|
|
54
|
+
const flushPendingHide = useCallback(() => {
|
|
55
|
+
if (pendingHide.current) {
|
|
56
|
+
pendingHide.current = false
|
|
57
|
+
setIsKeyboardVisible(false)
|
|
58
|
+
setKeyboardHeight(0)
|
|
59
|
+
}
|
|
60
|
+
}, [])
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!isWeb || !enabled) return
|
|
64
|
+
if (typeof window === 'undefined') return
|
|
65
|
+
const vv = window.visualViewport
|
|
66
|
+
if (!vv) return
|
|
67
|
+
|
|
68
|
+
const update = () => {
|
|
69
|
+
const height = getWebKeyboardHeight()
|
|
70
|
+
const tall = height >= MIN_KEYBOARD_HEIGHT
|
|
71
|
+
// require an editable element focused to *show* — this rules out URL-bar
|
|
72
|
+
// collapse and other viewport changes that aren't a keyboard. but stay
|
|
73
|
+
// visible while the viewport remains shrunk even if focus momentarily
|
|
74
|
+
// moves to a non-editable element (e.g. tapping between two inputs fires
|
|
75
|
+
// focusout→focusin), so the sheet doesn't flicker mid-transition.
|
|
76
|
+
const editableFocused = isEditableElement(document.activeElement)
|
|
77
|
+
const visible = tall && (editableFocused || isVisibleRef.current)
|
|
78
|
+
|
|
79
|
+
if (!visible) {
|
|
80
|
+
// suppress hide during an active drag so positions stay frozen; the
|
|
81
|
+
// drag-end flush reconciles the real state.
|
|
82
|
+
if (pauseKeyboardHandler.current && isVisibleRef.current) {
|
|
83
|
+
pendingHide.current = true
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
setIsKeyboardVisible(false)
|
|
87
|
+
setKeyboardHeight(0)
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
pendingHide.current = false
|
|
92
|
+
setIsKeyboardVisible(true)
|
|
93
|
+
setKeyboardHeight((prev) => (prev === height ? prev : height))
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// only react to resize (keyboard height changes). we intentionally do NOT
|
|
97
|
+
// listen to visualViewport 'scroll' — that fires continuously while the
|
|
98
|
+
// sheet content scrolls and would re-derive the keyboard height from a
|
|
99
|
+
// shifting viewport, making the sheet jump.
|
|
100
|
+
vv.addEventListener('resize', update)
|
|
101
|
+
// focus changes flip editable state without necessarily resizing the viewport
|
|
102
|
+
window.addEventListener('focusin', update)
|
|
103
|
+
window.addEventListener('focusout', update)
|
|
104
|
+
|
|
105
|
+
update()
|
|
106
|
+
|
|
107
|
+
return () => {
|
|
108
|
+
vv.removeEventListener('resize', update)
|
|
109
|
+
window.removeEventListener('focusin', update)
|
|
110
|
+
window.removeEventListener('focusout', update)
|
|
111
|
+
}
|
|
112
|
+
}, [enabled])
|
|
113
|
+
|
|
18
114
|
return {
|
|
19
115
|
keyboardControllerEnabled: false,
|
|
20
|
-
keyboardHeight
|
|
21
|
-
isKeyboardVisible
|
|
22
|
-
dismissKeyboard
|
|
116
|
+
keyboardHeight,
|
|
117
|
+
isKeyboardVisible,
|
|
118
|
+
dismissKeyboard,
|
|
23
119
|
pauseKeyboardHandler,
|
|
24
|
-
flushPendingHide
|
|
120
|
+
flushPendingHide,
|
|
25
121
|
}
|
|
26
122
|
}
|
|
@@ -9,6 +9,22 @@ import type { SheetOpenState } from './useSheetOpenState'
|
|
|
9
9
|
|
|
10
10
|
export type SheetContextValue = ReturnType<typeof useSheetProviderProps> & {
|
|
11
11
|
keyboardOccludedHeight: number
|
|
12
|
+
// whether the soft keyboard is currently open. distinct from
|
|
13
|
+
// keyboardOccludedHeight (which is 0 once the sheet fits above the keyboard):
|
|
14
|
+
// the fit-mode height freeze must persist for the whole time the keyboard is
|
|
15
|
+
// open, not just while occluded, or it releases and the sheet collapses.
|
|
16
|
+
isKeyboardVisible: boolean
|
|
17
|
+
// the sheet's authoritative pre-keyboard frame height (web). SheetScrollView
|
|
18
|
+
// pins its height to this while the keyboard is open so the frame stays its
|
|
19
|
+
// full size (anchored to the screen bottom) instead of collapsing to a
|
|
20
|
+
// consumer maxHeight that shrank with the viewport. 0 when not applicable.
|
|
21
|
+
keyboardStableFrameHeight: number
|
|
22
|
+
// AUTOFOCUS-ON-OPEN seed phase (web). while reconstructing the pre-keyboard
|
|
23
|
+
// baseline, SheetScrollView must UNCLIP (apply keyboardStableFrameHeight as
|
|
24
|
+
// maxHeight only, not a fixed height) so it sizes to its content and the sheet
|
|
25
|
+
// can measure the true content height. once settled the fixed-height pin
|
|
26
|
+
// applies. false outside the seed window.
|
|
27
|
+
isKeyboardSeeding: boolean
|
|
12
28
|
setHasScrollView: (val: boolean) => void
|
|
13
29
|
}
|
|
14
30
|
|
|
@@ -75,6 +75,10 @@ export function useSheetScrollViewGestures({
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
scrollBridge.scrollStartY = touch.pageY
|
|
78
|
+
// claim this touch for the scroll-view gesture hook so the PanResponder
|
|
79
|
+
// (which also negotiates this touch via RNW's responder system) defers
|
|
80
|
+
// and doesn't double-drive the sheet position. cleared on touchend.
|
|
81
|
+
scrollBridge.scrollNodeTouched = true
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
const handleTouchMove = (e: TouchEvent) => {
|
|
@@ -115,6 +119,10 @@ export function useSheetScrollViewGestures({
|
|
|
115
119
|
if (newOwner === 'pan') {
|
|
116
120
|
s.panDragOffset = 0
|
|
117
121
|
s.dys = []
|
|
122
|
+
// re-baseline the pan origin to the sheet's CURRENT position so the
|
|
123
|
+
// offset (reset to 0 here) maps to where it actually is — required for
|
|
124
|
+
// a correct scroll→pan handoff now that the PanResponder defers to us.
|
|
125
|
+
scrollBridge.startPanDrag?.()
|
|
118
126
|
scrollBridge.setParentDragging(true)
|
|
119
127
|
disableScroll()
|
|
120
128
|
} else {
|
|
@@ -133,8 +141,13 @@ export function useSheetScrollViewGestures({
|
|
|
133
141
|
|
|
134
142
|
s.dys.push(dy)
|
|
135
143
|
if (s.dys.length > 100) s.dys = s.dys.slice(-10)
|
|
136
|
-
} else if (s.owner === 'scroll') {
|
|
137
|
-
//
|
|
144
|
+
} else if (s.owner === 'scroll' && !e.isTrusted) {
|
|
145
|
+
// SYNTHETIC events only (tests): dispatched TouchEvents don't trigger the
|
|
146
|
+
// browser's native overflow scroll, so we move scrollTop ourselves. for a
|
|
147
|
+
// REAL touch (e.isTrusted) the browser already scrolls the overflow
|
|
148
|
+
// container natively — doing it again here double-applies the delta and
|
|
149
|
+
// makes scrollTop jitter / snap around. so for real touches we let native
|
|
150
|
+
// scrolling own it and only track the offset via the ScrollView onScroll.
|
|
138
151
|
const scrollDelta = -dy
|
|
139
152
|
const maxScrollY = node.scrollHeight - node.clientHeight
|
|
140
153
|
const newScrollY = Math.max(0, Math.min(maxScrollY, currentScrollY + scrollDelta))
|
|
@@ -159,12 +172,20 @@ export function useSheetScrollViewGestures({
|
|
|
159
172
|
}
|
|
160
173
|
|
|
161
174
|
scrollBridge.release({ dragAt: s.panDragOffset, vy })
|
|
175
|
+
} else if (s.owner === 'scroll') {
|
|
176
|
+
// gesture ended while scrolling. a pan→scroll handoff only happens once
|
|
177
|
+
// the pane reached the top, so commit the top snap (index 0) and clear
|
|
178
|
+
// the dragging state HERE, on touchend — never mid-gesture (that would
|
|
179
|
+
// fight the live gesture). this replaces the PanResponder's release,
|
|
180
|
+
// which used to fire on touchend before it deferred to this hook.
|
|
181
|
+
scrollBridge.snapToPosition?.(0)
|
|
162
182
|
}
|
|
163
183
|
|
|
164
184
|
enableScroll()
|
|
165
185
|
s.owner = 'none'
|
|
166
186
|
s.panDragOffset = 0
|
|
167
187
|
s.dys = []
|
|
188
|
+
scrollBridge.scrollNodeTouched = false
|
|
168
189
|
}
|
|
169
190
|
|
|
170
191
|
node.addEventListener('touchstart', handleTouchStart, {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web (mobile-browser) viewport helpers for the Sheet's keyboard handling.
|
|
3
|
+
*
|
|
4
|
+
* On real iOS Safari (verified on-device, iOS 26) the soft keyboard shrinks
|
|
5
|
+
* BOTH `window.visualViewport.height` AND `window.innerHeight` — neither is the
|
|
6
|
+
* stable layout viewport. Measured during a keyboard open: visualViewport
|
|
7
|
+
* 714 -> 404, innerHeight 714 -> 561 (it wobbles), but
|
|
8
|
+
* `document.documentElement.clientHeight` holds rock-steady at 714 the whole
|
|
9
|
+
* time (open, mid-keyboard, and close). So clientHeight IS the stable layout
|
|
10
|
+
* viewport, and we derive everything from it:
|
|
11
|
+
* - soft-keyboard height = clientHeight - visualViewport.height (stays correct
|
|
12
|
+
* even as innerHeight drifts), so the scroll padding clears the input.
|
|
13
|
+
* - the sheet's fit-mode anchor cap (translateY = screenSize - frameSize) reads
|
|
14
|
+
* clientHeight, so it never re-measures against a shrunk value and the frame
|
|
15
|
+
* stays anchored at the bottom.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// ignore small viewport changes (URL bar collapse, accessory bars) so they
|
|
19
|
+
// don't read as a full keyboard. a real soft keyboard is well above this.
|
|
20
|
+
export const MIN_KEYBOARD_HEIGHT = 80
|
|
21
|
+
|
|
22
|
+
export function isEditableElement(el: Element | null): boolean {
|
|
23
|
+
if (!el) return false
|
|
24
|
+
const tag = el.tagName
|
|
25
|
+
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return true
|
|
26
|
+
if ((el as HTMLElement).isContentEditable) return true
|
|
27
|
+
return false
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The stable layout-viewport height. document.documentElement.clientHeight is
|
|
32
|
+
* unaffected by the soft keyboard on iOS Safari (unlike innerHeight /
|
|
33
|
+
* visualViewport), so it stays constant while the keyboard animates in/out.
|
|
34
|
+
*/
|
|
35
|
+
export function getStableLayoutViewportHeight(): number {
|
|
36
|
+
if (typeof window === 'undefined') return 0
|
|
37
|
+
const ch = typeof document !== 'undefined' ? document.documentElement?.clientHeight : 0
|
|
38
|
+
if (ch && ch > 0) return ch
|
|
39
|
+
// fallback when clientHeight is unavailable (SSR / detached): best effort
|
|
40
|
+
return Math.max(window.innerHeight || 0, window.visualViewport?.height || 0)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Soft-keyboard height = the occluded region between the (stable) layout
|
|
45
|
+
* viewport bottom and the visual viewport bottom.
|
|
46
|
+
*/
|
|
47
|
+
export function getWebKeyboardHeight(): number {
|
|
48
|
+
if (typeof window === 'undefined') return 0
|
|
49
|
+
const vv = window.visualViewport
|
|
50
|
+
if (!vv) return 0
|
|
51
|
+
return Math.max(0, Math.round(getStableLayoutViewportHeight() - vv.height))
|
|
52
|
+
}
|
package/types/SheetContext.d.ts
CHANGED
|
@@ -33,6 +33,9 @@ export declare const SheetProvider: (props: {
|
|
|
33
33
|
onlyShowFrame: boolean;
|
|
34
34
|
} & {
|
|
35
35
|
keyboardOccludedHeight: number;
|
|
36
|
+
isKeyboardVisible: boolean;
|
|
37
|
+
keyboardStableFrameHeight: number;
|
|
38
|
+
isKeyboardSeeding: boolean;
|
|
36
39
|
setHasScrollView: (val: boolean) => void;
|
|
37
40
|
} & {
|
|
38
41
|
scope: import("@tamagui/create-context").Scope<SheetContextValue>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetContext.d.ts","sourceRoot":"","sources":["../src/SheetContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,eAAO,MAAO,kBAAkB;;;2JAM4rB,CAAC;QAAS,CAAC;YAAoB,CAAC;yBAN1tB,gBAAgB,+CAAkC,CAAA;AAEpF,eAAO,MAAO,aAAa
|
|
1
|
+
{"version":3,"file":"SheetContext.d.ts","sourceRoot":"","sources":["../src/SheetContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,eAAO,MAAO,kBAAkB;;;2JAM4rB,CAAC;QAAS,CAAC;YAAoB,CAAC;yBAN1tB,gBAAgB,+CAAkC,CAAA;AAEpF,eAAO,MAAO,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAAE,eAAe;;;mCAG3C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetImplementationCustom.d.ts","sourceRoot":"","sources":["../src/SheetImplementationCustom.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAOvC,OAAO,EAA4B,IAAI,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"SheetImplementationCustom.d.ts","sourceRoot":"","sources":["../src/SheetImplementationCustom.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAOvC,OAAO,EAA4B,IAAI,EAAE,MAAM,cAAc,CAAA;AAa7D,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,SAAS,CAAA;AA2CzD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAkhCrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetScrollView.d.ts","sourceRoot":"","sources":["../src/SheetScrollView.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"SheetScrollView.d.ts","sourceRoot":"","sources":["../src/SheetScrollView.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,cAAc,CAAA;AAU9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAmP3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeSheet.d.ts","sourceRoot":"","sources":["../src/nativeSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAI9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,KAAK,oBAAoB,GAAG,KAAK,CAAA;AAMjC,wBAAgB,cAAc,CAAC,QAAQ,EAAE,oBAAoB,wCAE5D;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,oBAAoB,EAC9B,UAAU,EAAE;IAAE,cAAc,EAAE,GAAG,CAAC;IAAC,yBAAyB,EAAE,GAAG,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"nativeSheet.d.ts","sourceRoot":"","sources":["../src/nativeSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAI9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,KAAK,oBAAoB,GAAG,KAAK,CAAA;AAMjC,wBAAgB,cAAc,CAAC,QAAQ,EAAE,oBAAoB,wCAE5D;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,oBAAoB,EAC9B,UAAU,EAAE;IAAE,cAAc,EAAE,GAAG,CAAC;IAAC,yBAAyB,EAAE,GAAG,CAAA;CAAE,QAqEpE"}
|
package/types/types.d.ts
CHANGED
|
@@ -62,7 +62,8 @@ export type SheetProps = ScopedProps<{
|
|
|
62
62
|
zIndex?: number;
|
|
63
63
|
portalProps?: PortalProps;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Makes the sheet move up when the mobile keyboard opens so the focused input remains visible.
|
|
66
|
+
* Works on native (via keyboard events) and on mobile web (via the VisualViewport API).
|
|
66
67
|
*/
|
|
67
68
|
moveOnKeyboardChange?: boolean;
|
|
68
69
|
containerComponent?: React.ComponentType<any>;
|
|
@@ -104,6 +105,8 @@ export type ScrollBridge = {
|
|
|
104
105
|
forceScrollTo?: (y: number) => void;
|
|
105
106
|
isAtTop?: boolean;
|
|
106
107
|
snapToPosition?: (positionIndex: number) => void;
|
|
108
|
+
startPanDrag?: () => void;
|
|
109
|
+
scrollNodeTouched?: boolean;
|
|
107
110
|
};
|
|
108
111
|
export interface KeyboardControllerSheetOptions {
|
|
109
112
|
/**
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,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iB,EAAE,OAAO,CAAA;IAE1B;;;OAGG;IACH,eAAe,EAAE,MAAM,IAAI,CAAA;IAE3B;;;;OAIG;IACH,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAE9C;;;OAGG;IACH,gBAAgB,EAAE,MAAM,IAAI,CAAA;CAC7B"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Web
|
|
3
|
-
*
|
|
2
|
+
* Web implementation of the keyboard controller sheet hook.
|
|
3
|
+
*
|
|
4
|
+
* Mobile browsers don't expose a keyboard API, but they do resize the
|
|
5
|
+
* VisualViewport when the soft keyboard opens. We derive the keyboard height as
|
|
6
|
+
* `getStableLayoutViewportHeight() - visualViewport.height` (see webViewport —
|
|
7
|
+
* the stable baseline is document.documentElement.clientHeight, NOT innerHeight,
|
|
8
|
+
* which itself shrinks with the keyboard on real iOS Safari) and feed it into the
|
|
9
|
+
* keyboardOccludedHeight scroll padding in SheetImplementationCustom.
|
|
10
|
+
*
|
|
11
|
+
* Without this, a bottom sheet on mobile web stays pinned behind the keyboard:
|
|
12
|
+
* react-native-web's Dimensions tracks the (shrinking) VisualViewport, so any
|
|
13
|
+
* content sized off window dimensions collapses while the sheet's bottom stays
|
|
14
|
+
* occluded. See SheetImplementationCustom's activePositions / keyboardOccludedHeight.
|
|
4
15
|
*/
|
|
5
16
|
import type { KeyboardControllerSheetOptions, KeyboardControllerSheetResult } from './types';
|
|
6
|
-
export declare function useKeyboardControllerSheet(
|
|
17
|
+
export declare function useKeyboardControllerSheet(options: KeyboardControllerSheetOptions): KeyboardControllerSheetResult;
|
|
7
18
|
//# sourceMappingURL=useKeyboardControllerSheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardControllerSheet.d.ts","sourceRoot":"","sources":["../src/useKeyboardControllerSheet.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useKeyboardControllerSheet.d.ts","sourceRoot":"","sources":["../src/useKeyboardControllerSheet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EACV,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,SAAS,CAAA;AAOhB,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,8BAA8B,GACtC,6BAA6B,CA2F/B"}
|
|
@@ -4,6 +4,9 @@ import type { ScrollBridge, SheetProps } from './types';
|
|
|
4
4
|
import type { SheetOpenState } from './useSheetOpenState';
|
|
5
5
|
export type SheetContextValue = ReturnType<typeof useSheetProviderProps> & {
|
|
6
6
|
keyboardOccludedHeight: number;
|
|
7
|
+
isKeyboardVisible: boolean;
|
|
8
|
+
keyboardStableFrameHeight: number;
|
|
9
|
+
isKeyboardSeeding: boolean;
|
|
7
10
|
setHasScrollView: (val: boolean) => void;
|
|
8
11
|
};
|
|
9
12
|
export declare function useSheetProviderProps(props: SheetProps, state: SheetOpenState, options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSheetProviderProps.d.ts","sourceRoot":"","sources":["../src/useSheetProviderProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,GAAG;IACzE,sBAAsB,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"useSheetProviderProps.d.ts","sourceRoot":"","sources":["../src/useSheetProviderProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,OAAO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B,EAAE,+BAA+B,
|
|
1
|
+
{"version":3,"file":"useSheetScrollViewGestures.d.ts","sourceRoot":"","sources":["../src/useSheetScrollViewGestures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAa3C,UAAU,+BAA+B;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAC/C,YAAY,EAAE,YAAY,CAAA;IAC1B,oBAAoB,EAAE,OAAO,CAAA;IAC7B,aAAa,EAAE,OAAO,CAAA;IACtB,gBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9D;AAED,wBAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,YAAY,EACZ,oBAAoB,GACrB,EAAE,+BAA+B,MA2LjC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web (mobile-browser) viewport helpers for the Sheet's keyboard handling.
|
|
3
|
+
*
|
|
4
|
+
* On real iOS Safari (verified on-device, iOS 26) the soft keyboard shrinks
|
|
5
|
+
* BOTH `window.visualViewport.height` AND `window.innerHeight` — neither is the
|
|
6
|
+
* stable layout viewport. Measured during a keyboard open: visualViewport
|
|
7
|
+
* 714 -> 404, innerHeight 714 -> 561 (it wobbles), but
|
|
8
|
+
* `document.documentElement.clientHeight` holds rock-steady at 714 the whole
|
|
9
|
+
* time (open, mid-keyboard, and close). So clientHeight IS the stable layout
|
|
10
|
+
* viewport, and we derive everything from it:
|
|
11
|
+
* - soft-keyboard height = clientHeight - visualViewport.height (stays correct
|
|
12
|
+
* even as innerHeight drifts), so the scroll padding clears the input.
|
|
13
|
+
* - the sheet's fit-mode anchor cap (translateY = screenSize - frameSize) reads
|
|
14
|
+
* clientHeight, so it never re-measures against a shrunk value and the frame
|
|
15
|
+
* stays anchored at the bottom.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MIN_KEYBOARD_HEIGHT = 80;
|
|
18
|
+
export declare function isEditableElement(el: Element | null): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The stable layout-viewport height. document.documentElement.clientHeight is
|
|
21
|
+
* unaffected by the soft keyboard on iOS Safari (unlike innerHeight /
|
|
22
|
+
* visualViewport), so it stays constant while the keyboard animates in/out.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getStableLayoutViewportHeight(): number;
|
|
25
|
+
/**
|
|
26
|
+
* Soft-keyboard height = the occluded region between the (stable) layout
|
|
27
|
+
* viewport bottom and the visual viewport bottom.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getWebKeyboardHeight(): number;
|
|
30
|
+
//# sourceMappingURL=webViewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webViewport.d.ts","sourceRoot":"","sources":["../src/webViewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAM7D;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAMtD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAK7C"}
|