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