@tamagui/sheet 3.0.0-beta.831.1 → 3.0.0-beta.889.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/dist/cjs/SheetScrollView.cjs +7 -9
- package/dist/cjs/SheetScrollView.native.cjs +7 -9
- package/dist/cjs/SheetScrollView.native.js +7 -9
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/useKeyboardControllerSheet.native.cjs +1 -27
- package/dist/cjs/useKeyboardControllerSheet.native.js +1 -27
- package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +8 -10
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +8 -10
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/useKeyboardControllerSheet.native.js +1 -27
- package/dist/esm/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +8 -10
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.cjs +7 -9
- package/dist/jsx/SheetScrollView.native.js +7 -9
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/useKeyboardControllerSheet.native.cjs +1 -27
- package/dist/jsx/useKeyboardControllerSheet.native.js +1 -27
- package/dist/jsx/useKeyboardControllerSheet.native.js.map +1 -1
- package/package.json +18 -18
- package/src/SheetScrollView.tsx +6 -5
- package/src/useKeyboardControllerSheet.native.ts +10 -44
- package/types/Sheet.d.ts +58 -211
- package/types/Sheet.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts +3 -54
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/useKeyboardControllerSheet.native.d.ts +6 -6
- package/types/useKeyboardControllerSheet.native.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardControllerSheet.native.js","names":[],"sources":["jsx/useKeyboardControllerSheet.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useKeyboardControllerSheet_native_exports = {};\n__export(useKeyboardControllerSheet_native_exports, {\n useKeyboardControllerSheet: () => useKeyboardControllerSheet\n});\nmodule.exports = __toCommonJS(useKeyboardControllerSheet_native_exports);\nvar import_react = require(\"react\");\nvar import_react_native = require(\"react-native\");\nvar isKeyboardControllerEnabled = function() {\n return false;\n};\nvar getKeyboardControllerState = function() {\n return {};\n};\ntry {\n var nativeModule = require(\"@tamagui/native\");\n isKeyboardControllerEnabled = nativeModule.isKeyboardControllerEnabled;\n getKeyboardControllerState = nativeModule.getKeyboardControllerState;\n} catch (e) {\n}\nfunction useKeyboardControllerSheet(options) {\n var { enabled } = options;\n var [keyboardHeight, setKeyboardHeight] = (0, import_react.useState)(0);\n var [isKeyboardVisible, setIsKeyboardVisible] = (0, import_react.useState)(false);\n var keyboardControllerEnabled = isKeyboardControllerEnabled();\n var pauseKeyboardHandler = (0, import_react.useRef)(false);\n var pendingHide = (0, import_react.useRef)(false);\n var dismissKeyboard = (0, import_react.useCallback)(\n function() {\n import_react_native.Keyboard.dismiss();\n if (keyboardControllerEnabled) {\n try {\n var _KeyboardController_dismiss;\n var { KeyboardController } = getKeyboardControllerState();\n KeyboardController === null || KeyboardController === void 0 ? void 0 : (_KeyboardController_dismiss = KeyboardController.dismiss) === null || _KeyboardController_dismiss === void 0 ? void 0 : _KeyboardController_dismiss.call(KeyboardController);\n } catch (e) {\n }\n }\n },\n // ignore errors from keyboard-controller\n [\n keyboardControllerEnabled\n ]\n );\n var flushPendingHide = (0, import_react.useCallback)(function() {\n if (pendingHide.current) {\n pendingHide.current = false;\n setIsKeyboardVisible(false);\n setKeyboardHeight(0);\n }\n }, []);\n (0, import_react.useEffect)(function() {\n if (!enabled
|
|
1
|
+
{"version":3,"file":"useKeyboardControllerSheet.native.js","names":[],"sources":["jsx/useKeyboardControllerSheet.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useKeyboardControllerSheet_native_exports = {};\n__export(useKeyboardControllerSheet_native_exports, {\n useKeyboardControllerSheet: () => useKeyboardControllerSheet\n});\nmodule.exports = __toCommonJS(useKeyboardControllerSheet_native_exports);\nvar import_react = require(\"react\");\nvar import_react_native = require(\"react-native\");\nvar isKeyboardControllerEnabled = function() {\n return false;\n};\nvar getKeyboardControllerState = function() {\n return {};\n};\ntry {\n var nativeModule = require(\"@tamagui/native\");\n isKeyboardControllerEnabled = nativeModule.isKeyboardControllerEnabled;\n getKeyboardControllerState = nativeModule.getKeyboardControllerState;\n} catch (e) {\n}\nfunction useKeyboardControllerSheet(options) {\n var { enabled } = options;\n var [keyboardHeight, setKeyboardHeight] = (0, import_react.useState)(0);\n var [isKeyboardVisible, setIsKeyboardVisible] = (0, import_react.useState)(false);\n var keyboardControllerEnabled = isKeyboardControllerEnabled();\n var pauseKeyboardHandler = (0, import_react.useRef)(false);\n var pendingHide = (0, import_react.useRef)(false);\n var dismissKeyboard = (0, import_react.useCallback)(\n function() {\n import_react_native.Keyboard.dismiss();\n if (keyboardControllerEnabled) {\n try {\n var _KeyboardController_dismiss;\n var { KeyboardController } = getKeyboardControllerState();\n KeyboardController === null || KeyboardController === void 0 ? void 0 : (_KeyboardController_dismiss = KeyboardController.dismiss) === null || _KeyboardController_dismiss === void 0 ? void 0 : _KeyboardController_dismiss.call(KeyboardController);\n } catch (e) {\n }\n }\n },\n // ignore errors from keyboard-controller\n [\n keyboardControllerEnabled\n ]\n );\n var flushPendingHide = (0, import_react.useCallback)(function() {\n if (pendingHide.current) {\n pendingHide.current = false;\n setIsKeyboardVisible(false);\n setKeyboardHeight(0);\n }\n }, []);\n (0, import_react.useEffect)(function() {\n if (!enabled) return;\n var showEvent = import_react_native.Platform.OS === \"ios\" ? \"keyboardWillShow\" : \"keyboardDidShow\";\n var hideEvent = import_react_native.Platform.OS === \"ios\" ? \"keyboardWillHide\" : \"keyboardDidHide\";\n var showListener = import_react_native.Keyboard.addListener(showEvent, function(e) {\n setKeyboardHeight(e.endCoordinates.height);\n setIsKeyboardVisible(true);\n });\n var hideListener = import_react_native.Keyboard.addListener(hideEvent, function() {\n if (pauseKeyboardHandler.current) {\n pendingHide.current = true;\n return;\n }\n setIsKeyboardVisible(false);\n setKeyboardHeight(0);\n });\n return function() {\n showListener.remove();\n hideListener.remove();\n };\n }, [\n enabled\n ]);\n return {\n keyboardControllerEnabled,\n keyboardHeight,\n isKeyboardVisible,\n dismissKeyboard,\n pauseKeyboardHandler,\n flushPendingHide\n };\n}\n//# sourceMappingURL=useKeyboardControllerSheet.native.js.map\n"],"mappings":";;;AACA,IA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 -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/sheet",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.889.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -43,25 +43,25 @@
|
|
|
43
43
|
"clean": "tamagui-build clean"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@tamagui/adapt": "3.0.0-beta.
|
|
47
|
-
"@tamagui/animate-presence": "3.0.0-beta.
|
|
48
|
-
"@tamagui/animations-react-native": "3.0.0-beta.
|
|
49
|
-
"@tamagui/compose-refs": "3.0.0-beta.
|
|
50
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
51
|
-
"@tamagui/core": "3.0.0-beta.
|
|
52
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
53
|
-
"@tamagui/native": "3.0.0-beta.
|
|
54
|
-
"@tamagui/portal": "3.0.0-beta.
|
|
55
|
-
"@tamagui/remove-scroll": "3.0.0-beta.
|
|
56
|
-
"@tamagui/scroll-view": "3.0.0-beta.
|
|
57
|
-
"@tamagui/stacks": "3.0.0-beta.
|
|
58
|
-
"@tamagui/use-constant": "3.0.0-beta.
|
|
59
|
-
"@tamagui/use-controllable-state": "3.0.0-beta.
|
|
60
|
-
"@tamagui/use-did-finish-ssr": "3.0.0-beta.
|
|
61
|
-
"@tamagui/z-index-stack": "3.0.0-beta.
|
|
46
|
+
"@tamagui/adapt": "3.0.0-beta.889.1",
|
|
47
|
+
"@tamagui/animate-presence": "3.0.0-beta.889.1",
|
|
48
|
+
"@tamagui/animations-react-native": "3.0.0-beta.889.1",
|
|
49
|
+
"@tamagui/compose-refs": "3.0.0-beta.889.1",
|
|
50
|
+
"@tamagui/constants": "3.0.0-beta.889.1",
|
|
51
|
+
"@tamagui/core": "3.0.0-beta.889.1",
|
|
52
|
+
"@tamagui/helpers": "3.0.0-beta.889.1",
|
|
53
|
+
"@tamagui/native": "3.0.0-beta.889.1",
|
|
54
|
+
"@tamagui/portal": "3.0.0-beta.889.1",
|
|
55
|
+
"@tamagui/remove-scroll": "3.0.0-beta.889.1",
|
|
56
|
+
"@tamagui/scroll-view": "3.0.0-beta.889.1",
|
|
57
|
+
"@tamagui/stacks": "3.0.0-beta.889.1",
|
|
58
|
+
"@tamagui/use-constant": "3.0.0-beta.889.1",
|
|
59
|
+
"@tamagui/use-controllable-state": "3.0.0-beta.889.1",
|
|
60
|
+
"@tamagui/use-did-finish-ssr": "3.0.0-beta.889.1",
|
|
61
|
+
"@tamagui/z-index-stack": "3.0.0-beta.889.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@tamagui/build": "3.0.0-beta.
|
|
64
|
+
"@tamagui/build": "3.0.0-beta.889.1",
|
|
65
65
|
"react": "19.2.3",
|
|
66
66
|
"react-native": "0.86.2",
|
|
67
67
|
"react-native-gesture-handler": "~2.32.0",
|
package/src/SheetScrollView.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { composeRefs } from '@tamagui/compose-refs'
|
|
2
|
-
import { createStyledHOC, isWeb, View, type GetProps } from '@tamagui/core'
|
|
2
|
+
import { createStyledHOC, isWeb, style, View, type GetProps } from '@tamagui/core'
|
|
3
3
|
import type { ScrollViewRef } from '@tamagui/scroll-view'
|
|
4
4
|
import { ScrollView } from '@tamagui/scroll-view'
|
|
5
5
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from './webViewport'
|
|
19
19
|
|
|
20
20
|
const SHEET_SCROLL_VIEW_NAME = 'SheetScrollView'
|
|
21
|
+
const sheetContentStyle = style({ minHeight: '100%' })
|
|
21
22
|
|
|
22
23
|
type SheetScrollViewBaseProps = GetProps<typeof ScrollView>
|
|
23
24
|
|
|
@@ -73,14 +74,14 @@ export const SheetScrollView = createStyledHOC(
|
|
|
73
74
|
// a flex: 1 child can't grow inside a content-sized parent, so the ScrollView (and the Container
|
|
74
75
|
// around it) collapse to 0 height. instead, let the ScrollView size to its content and cap it
|
|
75
76
|
// at the available viewport (screenSize / maxContentSize) so scrolling kicks in for tall content.
|
|
76
|
-
const
|
|
77
|
+
const fitSizingProps = hasFit
|
|
77
78
|
? {
|
|
78
79
|
flex: undefined as undefined,
|
|
79
80
|
height: undefined as undefined,
|
|
80
81
|
maxHeight: screenSize || undefined,
|
|
81
82
|
}
|
|
82
83
|
: { flex: 1 }
|
|
83
|
-
const contentContainerStyle = hasFit ? undefined :
|
|
84
|
+
const contentContainerStyle = hasFit ? undefined : sheetContentStyle
|
|
84
85
|
|
|
85
86
|
// when the keyboard is open, pin the scroll view to the sheet's pre-keyboard
|
|
86
87
|
// frame height (frozenFrameHeight), overriding any consumer maxHeight. on web
|
|
@@ -93,7 +94,6 @@ export const SheetScrollView = createStyledHOC(
|
|
|
93
94
|
? { height: frozenFrameHeight, maxHeight: frozenFrameHeight }
|
|
94
95
|
: null
|
|
95
96
|
const scrollViewStyle = [
|
|
96
|
-
fitSizingStyle,
|
|
97
97
|
...(Array.isArray(style) ? style : [style]),
|
|
98
98
|
keyboardFrozenOverride,
|
|
99
99
|
]
|
|
@@ -294,7 +294,7 @@ export const SheetScrollView = createStyledHOC(
|
|
|
294
294
|
return (
|
|
295
295
|
<RNGHComponent
|
|
296
296
|
ref={composeRefs(scrollRef as any, ref)}
|
|
297
|
-
style={scrollViewStyle}
|
|
297
|
+
style={[fitSizingProps, ...scrollViewStyle]}
|
|
298
298
|
scrollEventThrottle={1}
|
|
299
299
|
scrollEnabled={scrollEnabled}
|
|
300
300
|
simultaneousHandlers={[panGestureRef]}
|
|
@@ -351,6 +351,7 @@ export const SheetScrollView = createStyledHOC(
|
|
|
351
351
|
// fallback ScrollView with platform-specific gesture props
|
|
352
352
|
return (
|
|
353
353
|
<ScrollView
|
|
354
|
+
{...fitSizingProps}
|
|
354
355
|
onLayout={(e) => {
|
|
355
356
|
recordFitHeight(Math.ceil(e.nativeEvent.layout.height))
|
|
356
357
|
updateScrollable()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* native implementation of keyboard controller sheet hook.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* keyboard-adjusted positions
|
|
4
|
+
* simplified to just track keyboard state (height, visibility).
|
|
5
|
+
* position animation is handled by SheetImplementationCustom via
|
|
6
|
+
* keyboard-adjusted positions, matching the react-native-actions-sheet pattern.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* uses React Native keyboard events for state. The optional keyboard-controller
|
|
9
|
+
* integration is only used for imperative dismissal.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
@@ -67,43 +67,9 @@ export function useKeyboardControllerSheet(
|
|
|
67
67
|
}
|
|
68
68
|
}, [])
|
|
69
69
|
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const { KeyboardEvents } = getKeyboardControllerState()
|
|
75
|
-
if (!KeyboardEvents?.addListener) return
|
|
76
|
-
|
|
77
|
-
const showSub = KeyboardEvents.addListener('keyboardWillShow', (e: any) => {
|
|
78
|
-
const height = e?.height ?? 0
|
|
79
|
-
if (height > 0) {
|
|
80
|
-
setKeyboardHeight(height)
|
|
81
|
-
}
|
|
82
|
-
setIsKeyboardVisible(true)
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
const hideSub = KeyboardEvents.addListener('keyboardWillHide', () => {
|
|
86
|
-
if (pauseKeyboardHandler.current) {
|
|
87
|
-
pendingHide.current = true
|
|
88
|
-
return
|
|
89
|
-
}
|
|
90
|
-
setIsKeyboardVisible(false)
|
|
91
|
-
setKeyboardHeight(0)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
return () => {
|
|
95
|
-
showSub?.remove?.()
|
|
96
|
-
hideSub?.remove?.()
|
|
97
|
-
}
|
|
98
|
-
}, [enabled, keyboardControllerEnabled])
|
|
99
|
-
|
|
100
|
-
// basic Keyboard API listeners, always on: keyboard-controller's events only
|
|
101
|
-
// fire when the app mounts its KeyboardProvider, and `enabled` above only
|
|
102
|
-
// proves the module is linked. an app (or the detox harness, which launches
|
|
103
|
-
// with disableKeyboardController) that skips the provider would otherwise get
|
|
104
|
-
// silently dead keyboard tracking - the sheet never moves and the scroll
|
|
105
|
-
// occlusion padding never applies. RN's Keyboard events always fire, so they
|
|
106
|
-
// are the baseline; when both fire the extra setState is a same-value no-op.
|
|
70
|
+
// module availability does not prove that KeyboardProvider is mounted. Its
|
|
71
|
+
// event emitter is silent without the provider, while React Native's keyboard
|
|
72
|
+
// notifications are available in both configurations.
|
|
107
73
|
useEffect(() => {
|
|
108
74
|
if (!enabled) return
|
|
109
75
|
|
|
@@ -128,7 +94,7 @@ export function useKeyboardControllerSheet(
|
|
|
128
94
|
showListener.remove()
|
|
129
95
|
hideListener.remove()
|
|
130
96
|
}
|
|
131
|
-
}, [enabled
|
|
97
|
+
}, [enabled])
|
|
132
98
|
|
|
133
99
|
return {
|
|
134
100
|
keyboardControllerEnabled,
|