@tamagui/sheet 1.88.13 → 1.88.15
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/LICENSE +21 -0
- package/dist/cjs/SheetController.js.map +1 -1
- package/dist/cjs/SheetController.native.js.map +1 -1
- package/dist/cjs/SheetImplementationCustom.js +47 -50
- package/dist/cjs/SheetImplementationCustom.js.map +1 -1
- package/dist/cjs/SheetImplementationCustom.native.js +47 -50
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
- package/dist/cjs/SheetScrollView.js.map +1 -1
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/createSheet.js.map +1 -1
- package/dist/cjs/createSheet.native.js.map +1 -1
- package/dist/cjs/helpers.js +1 -1
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/cjs/helpers.native.js +1 -1
- package/dist/cjs/helpers.native.js.map +1 -1
- package/dist/cjs/nativeSheet.js.map +1 -1
- package/dist/cjs/nativeSheet.native.js.map +1 -1
- package/dist/cjs/useSheetProviderProps.js +0 -1
- package/dist/cjs/useSheetProviderProps.js.map +1 -1
- package/dist/cjs/useSheetProviderProps.native.js +0 -1
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/esm/Sheet.mjs +91 -0
- package/dist/esm/SheetContext.mjs +5 -0
- package/dist/esm/SheetController.js.map +1 -1
- package/dist/esm/SheetController.mjs +22 -0
- package/dist/esm/SheetController.native.js.map +1 -1
- package/dist/esm/SheetImplementationCustom.js +48 -56
- package/dist/esm/SheetImplementationCustom.js.map +1 -1
- package/dist/esm/SheetImplementationCustom.mjs +312 -0
- package/dist/esm/SheetImplementationCustom.native.js +47 -50
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetScrollView.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +57 -0
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/constants.mjs +8 -0
- package/dist/esm/contexts.mjs +6 -0
- package/dist/esm/createSheet.js +1 -3
- package/dist/esm/createSheet.js.map +1 -1
- package/dist/esm/createSheet.mjs +138 -0
- package/dist/esm/createSheet.native.js.map +1 -1
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/helpers.mjs +9 -0
- package/dist/esm/helpers.native.js +1 -1
- package/dist/esm/helpers.native.js.map +1 -1
- package/dist/esm/index.mjs +7 -0
- package/dist/esm/nativeSheet.js.map +1 -1
- package/dist/esm/nativeSheet.mjs +50 -0
- package/dist/esm/nativeSheet.native.js.map +1 -1
- package/dist/esm/types.mjs +0 -0
- package/dist/esm/useSheet.mjs +3 -0
- package/dist/esm/useSheetController.mjs +14 -0
- package/dist/esm/useSheetOffscreenSize.mjs +27 -0
- package/dist/esm/useSheetOpenState.mjs +25 -0
- package/dist/esm/useSheetProviderProps.js +0 -1
- package/dist/esm/useSheetProviderProps.js.map +1 -1
- package/dist/esm/useSheetProviderProps.mjs +84 -0
- package/dist/esm/useSheetProviderProps.native.js +0 -1
- package/dist/esm/useSheetProviderProps.native.js.map +1 -1
- package/dist/jsx/Sheet.mjs +91 -0
- package/dist/jsx/SheetContext.mjs +5 -0
- package/dist/jsx/SheetController.js.map +1 -1
- package/dist/jsx/SheetController.mjs +22 -0
- package/dist/jsx/SheetController.native.js.map +1 -1
- package/dist/jsx/SheetImplementationCustom.js +48 -56
- package/dist/jsx/SheetImplementationCustom.js.map +1 -1
- package/dist/jsx/SheetImplementationCustom.mjs +312 -0
- package/dist/jsx/SheetImplementationCustom.native.js +47 -50
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +57 -0
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/constants.mjs +8 -0
- package/dist/jsx/contexts.mjs +6 -0
- package/dist/jsx/createSheet.js +1 -3
- package/dist/jsx/createSheet.js.map +1 -1
- package/dist/jsx/createSheet.mjs +138 -0
- package/dist/jsx/createSheet.native.js.map +1 -1
- package/dist/jsx/helpers.js +1 -1
- package/dist/jsx/helpers.js.map +1 -1
- package/dist/jsx/helpers.mjs +9 -0
- package/dist/jsx/helpers.native.js +1 -1
- package/dist/jsx/helpers.native.js.map +1 -1
- package/dist/jsx/index.mjs +7 -0
- package/dist/jsx/nativeSheet.js.map +1 -1
- package/dist/jsx/nativeSheet.mjs +50 -0
- package/dist/jsx/nativeSheet.native.js.map +1 -1
- package/dist/jsx/types.mjs +0 -0
- package/dist/jsx/useSheet.mjs +3 -0
- package/dist/jsx/useSheetController.mjs +14 -0
- package/dist/jsx/useSheetOffscreenSize.mjs +27 -0
- package/dist/jsx/useSheetOpenState.mjs +25 -0
- package/dist/jsx/useSheetProviderProps.js +0 -1
- package/dist/jsx/useSheetProviderProps.js.map +1 -1
- package/dist/jsx/useSheetProviderProps.mjs +84 -0
- package/dist/jsx/useSheetProviderProps.native.js +0 -1
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
- package/package.json +16 -16
- package/src/SheetContext.tsx +1 -1
- package/src/SheetController.tsx +2 -1
- package/src/SheetImplementationCustom.tsx +102 -103
- package/src/SheetScrollView.tsx +5 -4
- package/src/createSheet.tsx +7 -5
- package/src/helpers.tsx +1 -1
- package/src/nativeSheet.tsx +3 -2
- package/src/types.tsx +4 -3
- package/src/useSheetOffscreenSize.tsx +1 -1
- package/src/useSheetOpenState.tsx +1 -1
- package/src/useSheetProviderProps.tsx +5 -4
- package/types/SheetController.d.ts +1 -1
- package/types/SheetController.d.ts.map +1 -1
- package/types/SheetImplementationCustom.d.ts +1 -1
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts +1 -1
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/createSheet.d.ts +4 -4
- package/types/createSheet.d.ts.map +1 -1
- package/types/nativeSheet.d.ts +2 -2
- package/types/nativeSheet.d.ts.map +1 -1
- package/types/types.d.ts +4 -3
- package/types/types.d.ts.map +1 -1
- package/types/useSheetOffscreenSize.d.ts +1 -1
- package/types/useSheetOffscreenSize.d.ts.map +1 -1
- package/types/useSheetOpenState.d.ts +1 -1
- package/types/useSheetOpenState.d.ts.map +1 -1
- package/types/useSheetProviderProps.d.ts +3 -3
- package/types/useSheetProviderProps.d.ts.map +1 -1
|
@@ -22,22 +22,19 @@ import {
|
|
|
22
22
|
useRef,
|
|
23
23
|
useState,
|
|
24
24
|
} from 'react'
|
|
25
|
-
import {
|
|
25
|
+
import type {
|
|
26
26
|
Animated,
|
|
27
|
-
Dimensions,
|
|
28
27
|
GestureResponderEvent,
|
|
29
|
-
Keyboard,
|
|
30
28
|
LayoutChangeEvent,
|
|
31
|
-
PanResponder,
|
|
32
29
|
PanResponderGestureState,
|
|
33
|
-
View,
|
|
34
30
|
} from 'react-native'
|
|
31
|
+
import { Dimensions, Keyboard, PanResponder, View } from 'react-native'
|
|
35
32
|
|
|
36
33
|
import { SHEET_HIDDEN_STYLESHEET } from './constants'
|
|
37
34
|
import { ParentSheetContext, SheetInsideSheetContext } from './contexts'
|
|
38
35
|
import { resisted } from './helpers'
|
|
39
36
|
import { SheetProvider } from './SheetContext'
|
|
40
|
-
import { SheetProps, SnapPointsMode } from './types'
|
|
37
|
+
import type { SheetProps, SnapPointsMode } from './types'
|
|
41
38
|
import { useSheetOpenState } from './useSheetOpenState'
|
|
42
39
|
import { useSheetProviderProps } from './useSheetProviderProps'
|
|
43
40
|
|
|
@@ -215,118 +212,117 @@ export const SheetImplementationCustom = themeable(
|
|
|
215
212
|
const themeName = useThemeName()
|
|
216
213
|
const [isDragging, setIsDragging] = useState(false)
|
|
217
214
|
|
|
218
|
-
const panResponder = useMemo(
|
|
219
|
-
()
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
':root * { user-select: none !important; -webkit-user-select: none !important; }'
|
|
238
|
-
}
|
|
215
|
+
const panResponder = useMemo(() => {
|
|
216
|
+
if (disableDrag) return
|
|
217
|
+
if (!frameSize) return
|
|
218
|
+
if (isShowingInnerSheet) return
|
|
219
|
+
|
|
220
|
+
const minY = positions[0]
|
|
221
|
+
scrollBridge.paneMinY = minY
|
|
222
|
+
let startY = at.current
|
|
223
|
+
|
|
224
|
+
function setPanning(val: boolean) {
|
|
225
|
+
setIsDragging(val)
|
|
226
|
+
|
|
227
|
+
// make unselectable:
|
|
228
|
+
if (!SHEET_HIDDEN_STYLESHEET) return
|
|
229
|
+
if (!val) {
|
|
230
|
+
SHEET_HIDDEN_STYLESHEET.innerText = ''
|
|
231
|
+
} else {
|
|
232
|
+
SHEET_HIDDEN_STYLESHEET.innerText =
|
|
233
|
+
':root * { user-select: none !important; -webkit-user-select: none !important; }'
|
|
239
234
|
}
|
|
235
|
+
}
|
|
240
236
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
237
|
+
const release = ({ vy, dragAt }: { dragAt: number; vy: number }) => {
|
|
238
|
+
isExternalDrag = false
|
|
239
|
+
previouslyScrolling = false
|
|
240
|
+
setPanning(false)
|
|
241
|
+
const at = dragAt + startY
|
|
242
|
+
// seems liky vy goes up to about 4 at the very most (+ is down, - is up)
|
|
243
|
+
// lets base our multiplier on the total layout height
|
|
244
|
+
const end = at + frameSize * vy * 0.2
|
|
245
|
+
let closestPoint = 0
|
|
246
|
+
let dist = Infinity
|
|
247
|
+
for (let i = 0; i < positions.length; i++) {
|
|
248
|
+
const position = positions[i]
|
|
249
|
+
const curDist = end > position ? end - position : position - end
|
|
250
|
+
if (curDist < dist) {
|
|
251
|
+
dist = curDist
|
|
252
|
+
closestPoint = i
|
|
258
253
|
}
|
|
259
|
-
// have to call both because state may not change but need to snap back
|
|
260
|
-
setPosition(closestPoint)
|
|
261
|
-
animateTo(closestPoint)
|
|
262
254
|
}
|
|
255
|
+
// have to call both because state may not change but need to snap back
|
|
256
|
+
setPosition(closestPoint)
|
|
257
|
+
animateTo(closestPoint)
|
|
258
|
+
}
|
|
263
259
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
260
|
+
const finish = (_e: GestureResponderEvent, state: PanResponderGestureState) => {
|
|
261
|
+
release({
|
|
262
|
+
vy: state.vy,
|
|
263
|
+
dragAt: state.dy,
|
|
264
|
+
})
|
|
265
|
+
}
|
|
270
266
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
267
|
+
let previouslyScrolling = false
|
|
268
|
+
|
|
269
|
+
const onMoveShouldSet = (
|
|
270
|
+
_e: GestureResponderEvent,
|
|
271
|
+
{ dy }: PanResponderGestureState
|
|
272
|
+
) => {
|
|
273
|
+
const isScrolled = scrollBridge.y !== 0
|
|
274
|
+
const isDraggingUp = dy < 0
|
|
275
|
+
// we can treat near top instead of exactly to avoid trouble with springs
|
|
276
|
+
const isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY
|
|
277
|
+
if (isScrolled) {
|
|
278
|
+
previouslyScrolling = true
|
|
279
|
+
return false
|
|
280
|
+
}
|
|
281
|
+
// prevent drag once at top and pulling up
|
|
282
|
+
if (isNearTop) {
|
|
283
|
+
if (!isScrolled && isDraggingUp) {
|
|
284
|
+
// TODO: pulling past the limit breaks scroll on native, need to better make ScrollView
|
|
285
|
+
if (!isWeb) {
|
|
288
286
|
return false
|
|
289
287
|
}
|
|
290
288
|
}
|
|
291
|
-
// we could do some detection of other touchables and cancel here..
|
|
292
|
-
return Math.abs(dy) > 5
|
|
293
289
|
}
|
|
290
|
+
// we could do some detection of other touchables and cancel here..
|
|
291
|
+
return Math.abs(dy) > 5
|
|
292
|
+
}
|
|
294
293
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
294
|
+
const grant = () => {
|
|
295
|
+
setPanning(true)
|
|
296
|
+
stopSpring()
|
|
297
|
+
startY = at.current
|
|
298
|
+
}
|
|
300
299
|
|
|
301
|
-
|
|
300
|
+
let isExternalDrag = false
|
|
302
301
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
const to = dy + startY
|
|
309
|
-
animatedNumber.setValue(resisted(to, minY), { type: 'direct' })
|
|
302
|
+
scrollBridge.drag = (dy) => {
|
|
303
|
+
if (!isExternalDrag) {
|
|
304
|
+
isExternalDrag = true
|
|
305
|
+
grant()
|
|
310
306
|
}
|
|
307
|
+
const to = dy + startY
|
|
308
|
+
animatedNumber.setValue(resisted(to, minY), { type: 'direct' })
|
|
309
|
+
}
|
|
311
310
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
328
|
-
[disableDrag, isShowingInnerSheet, animateTo, frameSize, positions, setPosition]
|
|
329
|
-
)
|
|
311
|
+
scrollBridge.release = release
|
|
312
|
+
|
|
313
|
+
return PanResponder.create({
|
|
314
|
+
onMoveShouldSetPanResponder: onMoveShouldSet,
|
|
315
|
+
onPanResponderGrant: grant,
|
|
316
|
+
onPanResponderMove: (_e, { dy }) => {
|
|
317
|
+
const toFull = dy + startY
|
|
318
|
+
const to = resisted(toFull, minY)
|
|
319
|
+
animatedNumber.setValue(to, { type: 'direct' })
|
|
320
|
+
},
|
|
321
|
+
onPanResponderEnd: finish,
|
|
322
|
+
onPanResponderTerminate: finish,
|
|
323
|
+
onPanResponderRelease: finish,
|
|
324
|
+
})
|
|
325
|
+
}, [disableDrag, isShowingInnerSheet, animateTo, frameSize, positions, setPosition])
|
|
330
326
|
|
|
331
327
|
const handleAnimationViewLayout = useCallback(
|
|
332
328
|
(e: LayoutChangeEvent) => {
|
|
@@ -357,6 +353,7 @@ export const SheetImplementationCustom = themeable(
|
|
|
357
353
|
const animatedStyle = useAnimatedNumberStyle(animatedNumber, (val) => {
|
|
358
354
|
'worklet'
|
|
359
355
|
const translateY = frameSize === 0 ? hiddenSize : val
|
|
356
|
+
|
|
360
357
|
return {
|
|
361
358
|
transform: [{ translateY }],
|
|
362
359
|
}
|
|
@@ -440,6 +437,8 @@ export const SheetImplementationCustom = themeable(
|
|
|
440
437
|
// @ts-ignore for CSS driver this is necessary to attach the transition
|
|
441
438
|
animation,
|
|
442
439
|
})}
|
|
440
|
+
// @ts-ignore
|
|
441
|
+
disableClassName
|
|
443
442
|
style={[
|
|
444
443
|
{
|
|
445
444
|
position: 'absolute',
|
package/src/SheetScrollView.tsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { composeRefs } from '@tamagui/compose-refs'
|
|
2
|
-
import { GetRef } from '@tamagui/core'
|
|
3
|
-
import {
|
|
2
|
+
import type { GetRef } from '@tamagui/core'
|
|
3
|
+
import type { ScrollViewProps } from '@tamagui/scroll-view'
|
|
4
|
+
import { ScrollView } from '@tamagui/scroll-view'
|
|
4
5
|
import { forwardRef, useMemo, useRef } from 'react'
|
|
5
|
-
import { ScrollView as RNScrollView } from 'react-native'
|
|
6
|
+
import type { ScrollView as RNScrollView } from 'react-native'
|
|
6
7
|
|
|
7
8
|
import { useSheetContext } from './SheetContext'
|
|
8
|
-
import { SheetScopedProps } from './types'
|
|
9
|
+
import type { SheetScopedProps } from './types'
|
|
9
10
|
|
|
10
11
|
// TODO ideally would replicate https://github.com/ammarahm-ed/react-native-actions-sheet/blob/master/src/index.tsx
|
|
11
12
|
|
package/src/createSheet.tsx
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { useComposedRefs } from '@tamagui/compose-refs'
|
|
2
2
|
import { useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
GetProps,
|
|
5
|
-
Stack,
|
|
6
5
|
StackProps,
|
|
7
6
|
TamaguiComponent,
|
|
8
7
|
TamaguiComponentExpectingVariants,
|
|
9
8
|
} from '@tamagui/core'
|
|
9
|
+
import { Stack } from '@tamagui/core'
|
|
10
10
|
import { composeEventHandlers, withStaticProperties } from '@tamagui/helpers'
|
|
11
11
|
import { RemoveScroll } from '@tamagui/remove-scroll'
|
|
12
12
|
import { useDidFinishSSR } from '@tamagui/use-did-finish-ssr'
|
|
13
|
-
import { FunctionComponent, RefAttributes
|
|
14
|
-
import {
|
|
13
|
+
import type { FunctionComponent, RefAttributes } from 'react'
|
|
14
|
+
import { forwardRef, memo, useMemo } from 'react'
|
|
15
|
+
import type { View } from 'react-native'
|
|
16
|
+
import { Platform } from 'react-native'
|
|
15
17
|
|
|
16
18
|
import { SHEET_HANDLE_NAME, SHEET_NAME, SHEET_OVERLAY_NAME } from './constants'
|
|
17
19
|
import { getNativeSheet } from './nativeSheet'
|
|
18
20
|
import { useSheetContext } from './SheetContext'
|
|
19
21
|
import { SheetImplementationCustom } from './SheetImplementationCustom'
|
|
20
22
|
import { SheetScrollView } from './SheetScrollView'
|
|
21
|
-
import { SheetProps, SheetScopedProps } from './types'
|
|
23
|
+
import type { SheetProps, SheetScopedProps } from './types'
|
|
22
24
|
import { useSheetController } from './useSheetController'
|
|
23
25
|
import { useSheetOffscreenSize } from './useSheetOffscreenSize'
|
|
24
26
|
|
package/src/helpers.tsx
CHANGED
|
@@ -2,7 +2,7 @@ export function resisted(y: number, minY: number, maxOverflow = 25) {
|
|
|
2
2
|
if (y < minY) {
|
|
3
3
|
const past = minY - y
|
|
4
4
|
const pctPast = Math.min(maxOverflow, past) / maxOverflow
|
|
5
|
-
const diminishBy = 1.1 - 0.
|
|
5
|
+
const diminishBy = 1.1 - 0.15 ** pctPast
|
|
6
6
|
const extra = -diminishBy * maxOverflow
|
|
7
7
|
return minY + extra
|
|
8
8
|
}
|
package/src/nativeSheet.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { YStack } from '@tamagui/stacks'
|
|
2
|
-
import { FunctionComponent
|
|
2
|
+
import type { FunctionComponent } from 'react'
|
|
3
|
+
import { useEffect, useRef } from 'react'
|
|
3
4
|
import { View } from 'react-native'
|
|
4
5
|
|
|
5
6
|
import { SheetProvider } from './SheetContext'
|
|
6
|
-
import { SheetProps } from './types'
|
|
7
|
+
import type { SheetProps } from './types'
|
|
7
8
|
import { useSheetOpenState } from './useSheetOpenState'
|
|
8
9
|
import { useSheetProviderProps } from './useSheetProviderProps'
|
|
9
10
|
|
package/src/types.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AnimatedNumberStrategy, AnimationProp } from '@tamagui/core'
|
|
1
|
+
import type { AnimatedNumberStrategy, AnimationProp } from '@tamagui/core'
|
|
2
2
|
import type { ScopedProps } from '@tamagui/create-context'
|
|
3
3
|
import type { PortalProps } from '@tamagui/portal'
|
|
4
|
-
import { RemoveScroll } from '@tamagui/remove-scroll'
|
|
5
|
-
import
|
|
4
|
+
import type { RemoveScroll } from '@tamagui/remove-scroll'
|
|
5
|
+
import type { ReactNode } from 'react'
|
|
6
|
+
import type React from 'react'
|
|
6
7
|
|
|
7
8
|
export type SheetProps = ScopedProps<
|
|
8
9
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
2
2
|
|
|
3
|
-
import { SheetProps } from './types'
|
|
3
|
+
import type { SheetProps } from './types'
|
|
4
4
|
import { useSheetController } from './useSheetController'
|
|
5
5
|
|
|
6
6
|
export const useSheetOpenState = (props: SheetProps) => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { TamaguiElement
|
|
1
|
+
import type { TamaguiElement } from '@tamagui/core'
|
|
2
|
+
import { useConfiguration } from '@tamagui/core'
|
|
2
3
|
import { useConstant } from '@tamagui/use-constant'
|
|
3
4
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
4
5
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
|
5
6
|
|
|
6
|
-
import { ScrollBridge, SheetProps } from './types'
|
|
7
|
-
import { SheetOpenState } from './useSheetOpenState'
|
|
7
|
+
import type { ScrollBridge, SheetProps } from './types'
|
|
8
|
+
import type { SheetOpenState } from './useSheetOpenState'
|
|
8
9
|
|
|
9
10
|
export type SheetContextValue = ReturnType<typeof useSheetProviderProps>
|
|
10
11
|
|
|
@@ -30,7 +31,7 @@ export function useSheetProviderProps(
|
|
|
30
31
|
|
|
31
32
|
const snapPoints = useMemo(
|
|
32
33
|
() => (props.dismissOnSnapToBottom ? [...snapPointsProp, 0] : snapPointsProp),
|
|
33
|
-
|
|
34
|
+
|
|
34
35
|
[JSON.stringify(snapPointsProp), props.dismissOnSnapToBottom]
|
|
35
36
|
)
|
|
36
37
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SheetControllerContextValue } from './useSheetController';
|
|
2
|
+
import type { SheetControllerContextValue } from './useSheetController';
|
|
3
3
|
export declare const SheetController: ({ children, onOpenChange: onOpenChangeProp, ...value }: Partial<SheetControllerContextValue> & {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
}) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetController.d.ts","sourceRoot":"","sources":["../src/SheetController.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,OAAO,
|
|
1
|
+
{"version":3,"file":"SheetController.d.ts","sourceRoot":"","sources":["../src/SheetController.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAGvE,eAAO,MAAM,eAAe;eAI2B,MAAM,SAAS;iBAkBrE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { SnapPointsMode } from './types';
|
|
3
|
+
import type { SnapPointsMode } from './types';
|
|
4
4
|
export declare const SheetImplementationCustom: (props: Omit<{
|
|
5
5
|
open?: boolean | undefined;
|
|
6
6
|
defaultOpen?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetImplementationCustom.d.ts","sourceRoot":"","sources":["../src/SheetImplementationCustom.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SheetImplementationCustom.d.ts","sourceRoot":"","sources":["../src/SheetImplementationCustom.tsx"],"names":[],"mappings":";AA8BA,OAAO,EAAsC,IAAI,EAAE,MAAM,cAAc,CAAA;AAMvE,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,SAAS,CAAA;AAMzD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;6MAicrC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ScrollView as RNScrollView } from 'react-native';
|
|
2
|
+
import type { ScrollView as RNScrollView } from 'react-native';
|
|
3
3
|
export declare const SheetScrollView: import("react").ForwardRefExoticComponent<Omit<import("@tamagui/web/types/interfaces/TamaguiComponentPropsBaseBase").TamaguiComponentPropsBaseBase & import("react-native").ScrollViewProps, keyof import("@tamagui/core").StackStyleBase | "fullscreen"> & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & {
|
|
4
4
|
fullscreen?: boolean | undefined;
|
|
5
5
|
} & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>> & import("@tamagui/core").WithPseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetScrollView.d.ts","sourceRoot":"","sources":["../src/SheetScrollView.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SheetScrollView.d.ts","sourceRoot":"","sources":["../src/SheetScrollView.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,cAAc,CAAA;AAa9D,eAAO,MAAM,eAAe;;;;;;kDA6H3B,CAAA"}
|
package/types/createSheet.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GetProps, StackProps, TamaguiComponent, TamaguiComponentExpectingVariants } from '@tamagui/core';
|
|
2
|
-
import { FunctionComponent, RefAttributes } from 'react';
|
|
3
|
-
import { View } from 'react-native';
|
|
4
|
-
import { SheetProps, SheetScopedProps } from './types';
|
|
1
|
+
import type { GetProps, StackProps, TamaguiComponent, TamaguiComponentExpectingVariants } from '@tamagui/core';
|
|
2
|
+
import type { FunctionComponent, RefAttributes } from 'react';
|
|
3
|
+
import type { View } from 'react-native';
|
|
4
|
+
import type { SheetProps, SheetScopedProps } from './types';
|
|
5
5
|
type SharedSheetProps = {
|
|
6
6
|
open?: boolean;
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSheet.d.ts","sourceRoot":"","sources":["../src/createSheet.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"create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
-
import { SheetProps } from './types';
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
import type { SheetProps } from './types';
|
|
3
3
|
type SheetNativePlatforms = 'ios';
|
|
4
4
|
export declare function getNativeSheet(platform: SheetNativePlatforms): FunctionComponent<SheetProps> | null;
|
|
5
5
|
export declare function setupNativeSheet(platform: SheetNativePlatforms, Implementation: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeSheet.d.ts","sourceRoot":"","sources":["../src/nativeSheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"nativeSheet.d.ts","sourceRoot":"","sources":["../src/nativeSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAK9C,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,CAAC,QAAQ,EAAE,oBAAoB,EAAE,cAAc,EAAE,GAAG,QA8CnF"}
|
package/types/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AnimatedNumberStrategy, AnimationProp } from '@tamagui/core';
|
|
1
|
+
import type { AnimatedNumberStrategy, AnimationProp } from '@tamagui/core';
|
|
2
2
|
import type { ScopedProps } from '@tamagui/create-context';
|
|
3
3
|
import type { PortalProps } from '@tamagui/portal';
|
|
4
|
-
import { RemoveScroll } from '@tamagui/remove-scroll';
|
|
5
|
-
import
|
|
4
|
+
import type { RemoveScroll } from '@tamagui/remove-scroll';
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
import type React from 'react';
|
|
6
7
|
export type SheetProps = ScopedProps<{
|
|
7
8
|
open?: boolean;
|
|
8
9
|
defaultOpen?: boolean;
|
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,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,UAAU,GAAG,WAAW,CAClC;IACE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAChC,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,gBAAgB,CAAC,EAAE,qBAAqB,CAAA;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,eAAe,CAAC,EAAE,sBAAsB,CAAA;IAExC;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;IAEnC;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,E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,IAAI,CAAA;CAC7B,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SheetContextValue } from './useSheetProviderProps';
|
|
1
|
+
import type { SheetContextValue } from './useSheetProviderProps';
|
|
2
2
|
export declare const useSheetOffscreenSize: ({ snapPoints, position, screenSize, frameSize, snapPointsMode, }: SheetContextValue) => number;
|
|
3
3
|
//# sourceMappingURL=useSheetOffscreenSize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSheetOffscreenSize.d.ts","sourceRoot":"","sources":["../src/useSheetOffscreenSize.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"useSheetOffscreenSize.d.ts","sourceRoot":"","sources":["../src/useSheetOffscreenSize.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,eAAO,MAAM,qBAAqB,qEAM/B,iBAAiB,WAwCnB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SheetProps } from './types';
|
|
2
|
+
import type { SheetProps } from './types';
|
|
3
3
|
export declare const useSheetOpenState: (props: SheetProps) => {
|
|
4
4
|
open: boolean;
|
|
5
5
|
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSheetOpenState.d.ts","sourceRoot":"","sources":["../src/useSheetOpenState.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"useSheetOpenState.d.ts","sourceRoot":"","sources":["../src/useSheetOpenState.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGzC,eAAO,MAAM,iBAAiB,UAAW,UAAU;;;;;CAsBlD,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TamaguiElement } from '@tamagui/core';
|
|
1
|
+
import type { TamaguiElement } from '@tamagui/core';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ScrollBridge, SheetProps } from './types';
|
|
4
|
-
import { SheetOpenState } from './useSheetOpenState';
|
|
3
|
+
import type { ScrollBridge, SheetProps } from './types';
|
|
4
|
+
import type { SheetOpenState } from './useSheetOpenState';
|
|
5
5
|
export type SheetContextValue = ReturnType<typeof useSheetProviderProps>;
|
|
6
6
|
export declare function useSheetProviderProps(props: SheetProps, state: SheetOpenState, options?: {
|
|
7
7
|
onOverlayComponent?: (comp: any) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSheetProviderProps.d.ts","sourceRoot":"","sources":["../src/useSheetProviderProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"useSheetProviderProps.d.ts","sourceRoot":"","sources":["../src/useSheetProviderProps.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInD,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,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,CAAA;AAExE,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,cAAc,EACrB,OAAO,GAAE;IACP,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAA;CACpC;;;;;;;;;;;;;;gCADwB,GAAG,KAAK,IAAI;;;;;;;wBAoCjC,MAAM;;;EAgIhB"}
|