@tamagui/sheet 1.0.1-beta.111 → 1.0.1-beta.114
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/Sheet.js +155 -32
- package/dist/cjs/Sheet.js.map +2 -2
- package/dist/esm/Sheet.js +158 -34
- package/dist/esm/Sheet.js.map +2 -2
- package/dist/jsx/Sheet.js +150 -32
- package/dist/jsx/Sheet.js.map +2 -2
- package/package.json +8 -8
- package/src/Sheet.tsx +247 -68
- package/types/Sheet.d.ts +3 -1
- package/types/Sheet.d.ts.map +1 -1
package/src/Sheet.tsx
CHANGED
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
mergeEvent,
|
|
10
10
|
styled,
|
|
11
11
|
themeable,
|
|
12
|
+
useConstant,
|
|
12
13
|
useEvent,
|
|
14
|
+
useIsomorphicLayoutEffect,
|
|
13
15
|
useThemeName,
|
|
14
16
|
withStaticProperties,
|
|
15
17
|
} from '@tamagui/core'
|
|
@@ -26,7 +28,6 @@ import React, {
|
|
|
26
28
|
useCallback,
|
|
27
29
|
useContext,
|
|
28
30
|
useEffect,
|
|
29
|
-
useLayoutEffect,
|
|
30
31
|
useMemo,
|
|
31
32
|
useRef,
|
|
32
33
|
useState,
|
|
@@ -36,6 +37,8 @@ import {
|
|
|
36
37
|
GestureResponderEvent,
|
|
37
38
|
PanResponder,
|
|
38
39
|
PanResponderGestureState,
|
|
40
|
+
ScrollView,
|
|
41
|
+
ScrollViewProps,
|
|
39
42
|
View,
|
|
40
43
|
} from 'react-native'
|
|
41
44
|
|
|
@@ -72,6 +75,14 @@ type PositionChangeHandler = (position: number) => void
|
|
|
72
75
|
|
|
73
76
|
type OpenChangeHandler = ((open: boolean) => void) | React.Dispatch<React.SetStateAction<boolean>>
|
|
74
77
|
|
|
78
|
+
type ScrollBridge = {
|
|
79
|
+
enabled: boolean
|
|
80
|
+
y: number
|
|
81
|
+
scrollStartY: number
|
|
82
|
+
drag: (dy: number) => void
|
|
83
|
+
release: (state: { dy: number; vy: number }) => void
|
|
84
|
+
}
|
|
85
|
+
|
|
75
86
|
type SheetContextValue = Required<
|
|
76
87
|
Pick<SheetProps, 'open' | 'position' | 'snapPoints' | 'dismissOnOverlayPress'>
|
|
77
88
|
> & {
|
|
@@ -81,6 +92,7 @@ type SheetContextValue = Required<
|
|
|
81
92
|
allowPinchZoom: RemoveScrollProps['allowPinchZoom']
|
|
82
93
|
contentRef: React.RefObject<TamaguiElement>
|
|
83
94
|
dismissOnSnapToBottom: boolean
|
|
95
|
+
scrollBridge: ScrollBridge
|
|
84
96
|
}
|
|
85
97
|
|
|
86
98
|
const [createSheetContext, createSheetScope] = createContextScope(SHEET_NAME)
|
|
@@ -89,6 +101,10 @@ const [SheetProvider, useSheetContext] = createSheetContext<SheetContextValue>(
|
|
|
89
101
|
{} as any
|
|
90
102
|
)
|
|
91
103
|
|
|
104
|
+
/* -------------------------------------------------------------------------------------------------
|
|
105
|
+
* SheetHandle
|
|
106
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
107
|
+
|
|
92
108
|
export const SheetHandleFrame = styled(XStack, {
|
|
93
109
|
name: SHEET_HANDLE_NAME,
|
|
94
110
|
height: 10,
|
|
@@ -132,6 +148,10 @@ export const SheetHandle = SheetHandleFrame.extractable(
|
|
|
132
148
|
}
|
|
133
149
|
)
|
|
134
150
|
|
|
151
|
+
/* -------------------------------------------------------------------------------------------------
|
|
152
|
+
* SheetOverlay
|
|
153
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
154
|
+
|
|
135
155
|
const SHEET_OVERLAY_NAME = 'SheetOverlay'
|
|
136
156
|
|
|
137
157
|
export const SheetOverlayFrame = styled(YStack, {
|
|
@@ -187,15 +207,98 @@ export const SheetOverlay = SheetOverlayFrame.extractable(
|
|
|
187
207
|
}
|
|
188
208
|
)
|
|
189
209
|
|
|
210
|
+
/* -------------------------------------------------------------------------------------------------
|
|
211
|
+
* SheetScrollView
|
|
212
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
213
|
+
|
|
214
|
+
const SHEET_SCROLL_VIEW_NAME = 'SheetScrollView'
|
|
215
|
+
|
|
216
|
+
export const SheetScrollView = forwardRef<ScrollView, ScrollViewProps>(
|
|
217
|
+
({ __scopeSheet, ...props }: SheetScopedProps<ScrollViewProps>, ref) => {
|
|
218
|
+
const { scrollBridge } = useSheetContext(SHEET_SCROLL_VIEW_NAME, __scopeSheet)
|
|
219
|
+
const [scrollEnabled, setScrollEnabled] = useState(true)
|
|
220
|
+
const state = useRef({
|
|
221
|
+
dy: 0,
|
|
222
|
+
// store a few recent dys to get velocity on release
|
|
223
|
+
dys: [] as number[],
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
const release = () => {
|
|
227
|
+
setScrollEnabled(true)
|
|
228
|
+
const recentDys = state.current.dys.slice(-10)
|
|
229
|
+
const dist = recentDys.length
|
|
230
|
+
? recentDys.reduce((a, b, i) => a + b - (recentDys[i - 1] ?? recentDys[0]), 0)
|
|
231
|
+
: 0
|
|
232
|
+
const avgDy = dist / recentDys.length
|
|
233
|
+
const vy = avgDy * 0.1
|
|
234
|
+
state.current.dys = []
|
|
235
|
+
scrollBridge.release({
|
|
236
|
+
dy: state.current.dy,
|
|
237
|
+
vy,
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<ScrollView
|
|
243
|
+
ref={ref}
|
|
244
|
+
onScrollBeginDrag={() => {
|
|
245
|
+
console.log('begin drag')
|
|
246
|
+
}}
|
|
247
|
+
scrollEventThrottle={16}
|
|
248
|
+
scrollEnabled={scrollEnabled}
|
|
249
|
+
onScroll={(e) => {
|
|
250
|
+
const { y } = e.nativeEvent.contentOffset
|
|
251
|
+
scrollBridge.y = y
|
|
252
|
+
if (y > 0) {
|
|
253
|
+
scrollBridge.scrollStartY = -1
|
|
254
|
+
}
|
|
255
|
+
}}
|
|
256
|
+
onResponderMove={(e) => {
|
|
257
|
+
const { pageY } = e.nativeEvent
|
|
258
|
+
if (scrollBridge.y === 0) {
|
|
259
|
+
if (scrollBridge.scrollStartY === -1) {
|
|
260
|
+
scrollBridge.scrollStartY = pageY
|
|
261
|
+
}
|
|
262
|
+
const dy = pageY - scrollBridge.scrollStartY
|
|
263
|
+
if (dy <= 0) {
|
|
264
|
+
setScrollEnabled(true)
|
|
265
|
+
return
|
|
266
|
+
}
|
|
267
|
+
setScrollEnabled(false)
|
|
268
|
+
scrollBridge.drag(dy)
|
|
269
|
+
state.current.dy = dy
|
|
270
|
+
state.current.dys.push(dy)
|
|
271
|
+
// only do every so often, cut down to 10 again
|
|
272
|
+
if (state.current.dys.length > 100) {
|
|
273
|
+
state.current.dys = state.current.dys.slice(-10)
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}}
|
|
277
|
+
onResponderRelease={release}
|
|
278
|
+
// todo release we can just grab the last dY and estimate vY using a sample of last dYs
|
|
279
|
+
{...props}
|
|
280
|
+
style={[
|
|
281
|
+
{
|
|
282
|
+
flex: 1,
|
|
283
|
+
},
|
|
284
|
+
props.style,
|
|
285
|
+
]}
|
|
286
|
+
/>
|
|
287
|
+
)
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
/* -------------------------------------------------------------------------------------------------
|
|
292
|
+
* Sheet
|
|
293
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
294
|
+
|
|
190
295
|
const selectionStyleSheet = isClient ? document.createElement('style') : null
|
|
191
296
|
if (selectionStyleSheet) {
|
|
192
297
|
document.head.appendChild(selectionStyleSheet)
|
|
193
298
|
}
|
|
194
299
|
|
|
195
|
-
const SHEET_FRAME_NAME = 'SheetFrame'
|
|
196
|
-
|
|
197
300
|
export const SheetFrameFrame = styled(YStack, {
|
|
198
|
-
name:
|
|
301
|
+
name: SHEET_NAME,
|
|
199
302
|
flex: 1,
|
|
200
303
|
backgroundColor: '$background',
|
|
201
304
|
borderTopLeftRadius: '$4',
|
|
@@ -208,7 +311,7 @@ export const SheetFrameFrame = styled(YStack, {
|
|
|
208
311
|
|
|
209
312
|
export const SheetFrame = SheetFrameFrame.extractable(
|
|
210
313
|
forwardRef(({ __scopeSheet, ...props }: SheetScopedProps<YStackProps>, forwardedRef) => {
|
|
211
|
-
const context = useSheetContext(
|
|
314
|
+
const context = useSheetContext(SHEET_NAME, __scopeSheet)
|
|
212
315
|
const composedContentRef = useComposedRefs(forwardedRef, context.contentRef)
|
|
213
316
|
return <SheetFrameFrame ref={composedContentRef} {...props} />
|
|
214
317
|
})
|
|
@@ -238,12 +341,27 @@ export const Sheet = withStaticProperties(
|
|
|
238
341
|
allowPinchZoom,
|
|
239
342
|
} = props
|
|
240
343
|
|
|
344
|
+
if (process.env.NODE_ENV === 'development') {
|
|
345
|
+
if (snapPointsProp.some((p) => p < 0 || p > 100)) {
|
|
346
|
+
console.warn(
|
|
347
|
+
`⚠️ Invalid snapPoint given, snapPoints must be between 0 and 100, equal to percent height of frame`
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
241
352
|
// allows for sheets to be controlled by other components
|
|
242
353
|
const controller = useContext(SheetControllerContext)
|
|
243
354
|
const isHidden = controller?.hidden || false
|
|
244
355
|
const disableDrag = disableDragProp ?? controller?.disableDrag
|
|
245
356
|
const themeName = useThemeName()
|
|
246
357
|
const contentRef = React.useRef<TamaguiElement>(null)
|
|
358
|
+
const scrollBridge = useConstant<ScrollBridge>(() => ({
|
|
359
|
+
enabled: false,
|
|
360
|
+
y: 0,
|
|
361
|
+
scrollStartY: -1,
|
|
362
|
+
drag: () => {},
|
|
363
|
+
release: () => {},
|
|
364
|
+
}))
|
|
247
365
|
|
|
248
366
|
const onChangeOpenInternal = (val: boolean) => {
|
|
249
367
|
controller?.onChangeOpen?.(val)
|
|
@@ -295,7 +413,7 @@ export const Sheet = withStaticProperties(
|
|
|
295
413
|
}
|
|
296
414
|
|
|
297
415
|
const [isResizing, setIsResizing] = useState(true)
|
|
298
|
-
|
|
416
|
+
useIsomorphicLayoutEffect(() => {
|
|
299
417
|
if (!isResizing) {
|
|
300
418
|
setIsResizing(true)
|
|
301
419
|
}
|
|
@@ -322,98 +440,158 @@ export const Sheet = withStaticProperties(
|
|
|
322
440
|
)
|
|
323
441
|
|
|
324
442
|
const animateTo = useEvent((position: number) => {
|
|
325
|
-
const
|
|
443
|
+
const current = positionValue.current
|
|
326
444
|
if (isHidden && open) return
|
|
327
|
-
if (!
|
|
445
|
+
if (!current) return
|
|
328
446
|
if (frameSize === 0) return
|
|
329
447
|
const hiddenValue = frameSize === 0 ? HIDDEN_SIZE : frameSize
|
|
330
448
|
const toValue = isHidden || position === -1 ? hiddenValue : positions[position]
|
|
331
|
-
if (
|
|
449
|
+
if (at.current === toValue) return
|
|
332
450
|
stopSpring()
|
|
333
451
|
if (isHidden || isResizing) {
|
|
334
452
|
if (isResizing) {
|
|
335
453
|
setIsResizing(false)
|
|
336
454
|
}
|
|
337
|
-
Animated.timing(
|
|
455
|
+
Animated.timing(current, {
|
|
338
456
|
useNativeDriver: !isWeb,
|
|
339
457
|
toValue,
|
|
340
458
|
duration: 0,
|
|
341
459
|
}).start()
|
|
460
|
+
at.current = toValue
|
|
342
461
|
return
|
|
343
462
|
}
|
|
344
463
|
// dont bounce on initial measure to bottom
|
|
345
|
-
const overshootClamping =
|
|
346
|
-
spring.current = Animated.spring(
|
|
464
|
+
const overshootClamping = at.current === HIDDEN_SIZE
|
|
465
|
+
spring.current = Animated.spring(current, {
|
|
347
466
|
useNativeDriver: !isWeb,
|
|
348
467
|
toValue,
|
|
349
468
|
overshootClamping,
|
|
350
469
|
...animationConfig,
|
|
351
470
|
})
|
|
352
|
-
spring.current.start(({ finished }) =>
|
|
471
|
+
spring.current.start(({ finished }) => {
|
|
472
|
+
if (finished) {
|
|
473
|
+
stopSpring()
|
|
474
|
+
}
|
|
475
|
+
})
|
|
353
476
|
})
|
|
354
477
|
|
|
355
|
-
|
|
478
|
+
useIsomorphicLayoutEffect(() => {
|
|
356
479
|
animateTo(position)
|
|
357
480
|
}, [isHidden, frameSize, position, animateTo])
|
|
358
481
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
function makeUnselectable(val: boolean) {
|
|
369
|
-
if (!selectionStyleSheet) return
|
|
370
|
-
if (!val) {
|
|
371
|
-
selectionStyleSheet.innerText = ``
|
|
372
|
-
} else {
|
|
373
|
-
selectionStyleSheet.innerText = `:root * { user-select: none !important; -webkit-user-select: none !important; }`
|
|
374
|
-
}
|
|
482
|
+
// native only fix
|
|
483
|
+
const at = useRef(0)
|
|
484
|
+
useEffect(() => {
|
|
485
|
+
positionValue.current!.addListener(({ value }) => {
|
|
486
|
+
at.current = value
|
|
487
|
+
})
|
|
488
|
+
return () => {
|
|
489
|
+
positionValue.current!.removeAllListeners()
|
|
375
490
|
}
|
|
491
|
+
}, [])
|
|
492
|
+
|
|
493
|
+
const panResponder = useMemo(
|
|
494
|
+
() => {
|
|
495
|
+
if (disableDrag) return
|
|
496
|
+
if (!frameSize) return
|
|
497
|
+
|
|
498
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
499
|
+
const pos = positionValue.current!
|
|
500
|
+
const minY = positions[0]
|
|
501
|
+
let startY = at.current
|
|
502
|
+
|
|
503
|
+
function makeUnselectable(val: boolean) {
|
|
504
|
+
if (!selectionStyleSheet) return
|
|
505
|
+
if (!val) {
|
|
506
|
+
selectionStyleSheet.innerText = ``
|
|
507
|
+
} else {
|
|
508
|
+
selectionStyleSheet.innerText = `:root * { user-select: none !important; -webkit-user-select: none !important; }`
|
|
509
|
+
}
|
|
510
|
+
}
|
|
376
511
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
512
|
+
const release = ({ vy, dy }: { dy: number; vy: number }) => {
|
|
513
|
+
isExternalDrag = false
|
|
514
|
+
previouslyScrolling = false
|
|
515
|
+
makeUnselectable(false)
|
|
516
|
+
const at = dy + startY
|
|
517
|
+
// seems liky vy goes up to about 4 at the very most (+ is down, - is up)
|
|
518
|
+
// lets base our multiplier on the total layout height
|
|
519
|
+
const end = at + frameSize * vy * 0.33
|
|
520
|
+
let closestPoint = 0
|
|
521
|
+
let dist = Infinity
|
|
522
|
+
for (let i = 0; i < positions.length; i++) {
|
|
523
|
+
const position = positions[i]
|
|
524
|
+
const curDist = end > position ? end - position : position - end
|
|
525
|
+
if (curDist < dist) {
|
|
526
|
+
dist = curDist
|
|
527
|
+
closestPoint = i
|
|
528
|
+
}
|
|
391
529
|
}
|
|
530
|
+
// have to call both because state may not change but need to snap back
|
|
531
|
+
setPosition(closestPoint)
|
|
532
|
+
animateTo(closestPoint)
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const finish = (_e: GestureResponderEvent, state: PanResponderGestureState) => {
|
|
536
|
+
release(state)
|
|
392
537
|
}
|
|
393
|
-
// have to call both because state may not change but need to snap back
|
|
394
|
-
setPosition(closestPoint)
|
|
395
|
-
animateTo(closestPoint)
|
|
396
|
-
}
|
|
397
538
|
|
|
398
|
-
|
|
399
|
-
|
|
539
|
+
let previouslyScrolling = false
|
|
540
|
+
|
|
541
|
+
const onMoveShouldSet = (_e: GestureResponderEvent, { dy }: PanResponderGestureState) => {
|
|
542
|
+
if (scrollBridge.y !== 0) {
|
|
543
|
+
previouslyScrolling = true
|
|
544
|
+
return false
|
|
545
|
+
}
|
|
546
|
+
if (scrollBridge.y === 0 && dy < 0) {
|
|
547
|
+
return false
|
|
548
|
+
}
|
|
549
|
+
if (previouslyScrolling) {
|
|
550
|
+
previouslyScrolling = false
|
|
551
|
+
return true
|
|
552
|
+
}
|
|
400
553
|
// we could do some detection of other touchables and cancel here..
|
|
401
|
-
return Math.abs(dy) >
|
|
402
|
-
}
|
|
403
|
-
|
|
554
|
+
return Math.abs(dy) > 8
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
const grant = () => {
|
|
404
558
|
makeUnselectable(true)
|
|
405
559
|
stopSpring()
|
|
406
|
-
startY =
|
|
407
|
-
}
|
|
408
|
-
|
|
560
|
+
startY = at.current
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
let isExternalDrag = false
|
|
564
|
+
|
|
565
|
+
scrollBridge.drag = (dy) => {
|
|
566
|
+
if (!isExternalDrag) {
|
|
567
|
+
isExternalDrag = true
|
|
568
|
+
grant()
|
|
569
|
+
}
|
|
409
570
|
const to = dy + startY
|
|
410
571
|
pos.setValue(resisted(to, minY))
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
scrollBridge.release = release
|
|
575
|
+
|
|
576
|
+
return PanResponder.create({
|
|
577
|
+
onMoveShouldSetPanResponder: (...args) => {
|
|
578
|
+
const res = onMoveShouldSet(...args)
|
|
579
|
+
// console.log('res', res, scrollBridge.y)
|
|
580
|
+
return res
|
|
581
|
+
},
|
|
582
|
+
onPanResponderGrant: grant,
|
|
583
|
+
onPanResponderMove: (_e, { dy }) => {
|
|
584
|
+
const to = dy + startY
|
|
585
|
+
pos.setValue(resisted(to, minY))
|
|
586
|
+
},
|
|
587
|
+
onPanResponderEnd: finish,
|
|
588
|
+
onPanResponderTerminate: finish,
|
|
589
|
+
onPanResponderRelease: finish,
|
|
590
|
+
})
|
|
591
|
+
},
|
|
592
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
593
|
+
[disableDrag, animateTo, frameSize, positions, setPosition]
|
|
594
|
+
)
|
|
417
595
|
|
|
418
596
|
let handleComponent: React.ReactElement | null = null
|
|
419
597
|
let overlayComponent: React.ReactElement | null = null
|
|
@@ -427,7 +605,7 @@ export const Sheet = withStaticProperties(
|
|
|
427
605
|
case 'SheetHandle':
|
|
428
606
|
handleComponent = child
|
|
429
607
|
break
|
|
430
|
-
case '
|
|
608
|
+
case 'Sheet':
|
|
431
609
|
frameComponent = child
|
|
432
610
|
break
|
|
433
611
|
case 'SheetOverlay':
|
|
@@ -458,6 +636,7 @@ export const Sheet = withStaticProperties(
|
|
|
458
636
|
snapPoints={snapPoints}
|
|
459
637
|
setPosition={setPosition}
|
|
460
638
|
setOpen={setOpen}
|
|
639
|
+
scrollBridge={scrollBridge}
|
|
461
640
|
>
|
|
462
641
|
{isResizing ? null : overlayComponent}
|
|
463
642
|
{/* no fancy hidden animation etc for handle for now */}
|
|
@@ -489,25 +668,25 @@ export const Sheet = withStaticProperties(
|
|
|
489
668
|
|
|
490
669
|
if (modal) {
|
|
491
670
|
return (
|
|
492
|
-
<Portal
|
|
671
|
+
<Portal>
|
|
493
672
|
<Theme name={themeName}>{contents}</Theme>
|
|
494
673
|
</Portal>
|
|
495
674
|
)
|
|
496
675
|
}
|
|
497
676
|
|
|
498
677
|
return contents
|
|
499
|
-
})
|
|
500
|
-
{
|
|
501
|
-
componentName: 'Sheet',
|
|
502
|
-
}
|
|
678
|
+
})
|
|
503
679
|
),
|
|
504
680
|
{
|
|
505
681
|
Handle: SheetHandle,
|
|
506
682
|
Frame: SheetFrame,
|
|
507
683
|
Overlay: SheetOverlay,
|
|
684
|
+
ScrollView: SheetScrollView,
|
|
508
685
|
}
|
|
509
686
|
)
|
|
510
687
|
|
|
688
|
+
/* -------------------------------------------------------------------------------------------------*/
|
|
689
|
+
|
|
511
690
|
function getPercentSize(point?: number, frameSize?: number) {
|
|
512
691
|
if (!frameSize) return 0
|
|
513
692
|
if (point === undefined) {
|
package/types/Sheet.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ScopedProps } from '@tamagui/create-context';
|
|
|
3
3
|
import { RemoveScroll } from '@tamagui/remove-scroll';
|
|
4
4
|
import { XStackProps } from '@tamagui/stacks';
|
|
5
5
|
import React, { ReactNode } from 'react';
|
|
6
|
-
import { Animated, View } from 'react-native';
|
|
6
|
+
import { Animated, ScrollView, ScrollViewProps, View } from 'react-native';
|
|
7
7
|
declare type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
|
|
8
8
|
export declare type SheetProps = ScopedProps<{
|
|
9
9
|
open?: boolean;
|
|
@@ -79,6 +79,7 @@ export declare const SheetOverlayFrame: import("@tamagui/core").TamaguiComponent
|
|
|
79
79
|
}>;
|
|
80
80
|
export declare type SheetOverlayProps = GetProps<typeof SheetOverlayFrame>;
|
|
81
81
|
export declare const SheetOverlay: ({ __scopeSheet, ...props }: SheetScopedProps<SheetOverlayProps>) => JSX.Element;
|
|
82
|
+
export declare const SheetScrollView: React.ForwardRefExoticComponent<ScrollViewProps & React.RefAttributes<ScrollView>>;
|
|
82
83
|
export declare const SheetFrameFrame: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
83
84
|
readonly fullscreen?: boolean | undefined;
|
|
84
85
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
@@ -156,6 +157,7 @@ export declare const Sheet: ((props: Omit<{
|
|
|
156
157
|
__scopeSheet?: import("@tamagui/create-context").Scope<any>;
|
|
157
158
|
} & React.RefAttributes<unknown>>;
|
|
158
159
|
Overlay: ({ __scopeSheet, ...props }: SheetScopedProps<SheetOverlayProps>) => JSX.Element;
|
|
160
|
+
ScrollView: React.ForwardRefExoticComponent<ScrollViewProps & React.RefAttributes<ScrollView>>;
|
|
159
161
|
};
|
|
160
162
|
declare type SheetControllerContextValue = {
|
|
161
163
|
disableDrag?: boolean;
|
package/types/Sheet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../src/Sheet.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../src/Sheet.tsx"],"names":[],"mappings":"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"}
|