@tamagui/sheet 1.0.1-beta.139 → 1.0.1-beta.142
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 +43 -51
- package/dist/cjs/Sheet.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/useAnimated.js +106 -0
- package/dist/cjs/useAnimated.js.map +7 -0
- package/dist/esm/Sheet.js +45 -56
- package/dist/esm/Sheet.js.map +2 -2
- package/dist/esm/useAnimated.js +80 -0
- package/dist/esm/useAnimated.js.map +7 -0
- package/dist/jsx/Sheet.js +53 -67
- package/dist/jsx/Sheet.js.map +2 -2
- package/dist/jsx/useAnimated.js +80 -0
- package/dist/jsx/useAnimated.js.map +7 -0
- package/package.json +9 -8
- package/src/Sheet.tsx +54 -70
- package/src/types.tsx +2 -2
- package/types/SHEET_HANDLE_NAME.d.ts +0 -0
- package/types/Sheet.d.ts +21 -21
- package/types/SheetContext.d.ts +1 -1
- package/types/SheetScrollView.d.ts +0 -0
- package/types/index.d.ts +0 -0
- package/types/types.d.ts +2 -2
- package/types/useAnimated.d.ts +19 -0
- package/types/useAnimation.d.ts +1 -0
- package/dist/cjs/Drawer.js +0 -284
- package/dist/cjs/Drawer.js.map +0 -7
- package/dist/cjs/RemoveScrollProps.js +0 -17
- package/dist/cjs/RemoveScrollProps.js.map +0 -7
- package/dist/esm/Drawer.js +0 -264
- package/dist/esm/Drawer.js.map +0 -7
- package/dist/esm/RemoveScrollProps.js +0 -1
- package/dist/esm/RemoveScrollProps.js.map +0 -7
- package/dist/jsx/Drawer.js +0 -220
- package/dist/jsx/Drawer.js.map +0 -7
- package/dist/jsx/RemoveScrollProps.js +0 -1
- package/dist/jsx/RemoveScrollProps.js.map +0 -7
package/src/Sheet.tsx
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
Slot,
|
|
5
5
|
TamaguiElement,
|
|
6
6
|
Theme,
|
|
7
|
+
getAnimationDriver,
|
|
7
8
|
isClient,
|
|
8
|
-
isWeb,
|
|
9
9
|
mergeEvent,
|
|
10
10
|
styled,
|
|
11
11
|
themeable,
|
|
@@ -30,13 +30,7 @@ import React, {
|
|
|
30
30
|
useRef,
|
|
31
31
|
useState,
|
|
32
32
|
} from 'react'
|
|
33
|
-
import {
|
|
34
|
-
Animated,
|
|
35
|
-
GestureResponderEvent,
|
|
36
|
-
PanResponder,
|
|
37
|
-
PanResponderGestureState,
|
|
38
|
-
View,
|
|
39
|
-
} from 'react-native'
|
|
33
|
+
import { GestureResponderEvent, PanResponder, PanResponderGestureState, View } from 'react-native'
|
|
40
34
|
|
|
41
35
|
import { SHEET_HANDLE_NAME, SHEET_NAME } from './SHEET_HANDLE_NAME'
|
|
42
36
|
import { SheetProvider, useSheetContext } from './SheetContext'
|
|
@@ -199,12 +193,18 @@ export const Sheet = withStaticProperties(
|
|
|
199
193
|
|
|
200
194
|
if (process.env.NODE_ENV === 'development') {
|
|
201
195
|
if (snapPointsProp.some((p) => p < 0 || p > 100)) {
|
|
196
|
+
// eslint-disable-next-line no-console
|
|
202
197
|
console.warn(
|
|
203
198
|
`⚠️ Invalid snapPoint given, snapPoints must be between 0 and 100, equal to percent height of frame`
|
|
204
199
|
)
|
|
205
200
|
}
|
|
206
201
|
}
|
|
207
202
|
|
|
203
|
+
const driver = getAnimationDriver()
|
|
204
|
+
if (!driver) {
|
|
205
|
+
throw new Error(`Must set animations in tamagui.config.ts`)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
208
|
// allows for sheets to be controlled by other components
|
|
209
209
|
const controller = useContext(SheetControllerContext)
|
|
210
210
|
const isHidden = controller?.hidden || false
|
|
@@ -268,10 +268,14 @@ export const Sheet = withStaticProperties(
|
|
|
268
268
|
[dismissOnSnapToBottom, snapPoints.length, setPosition_, setOpen]
|
|
269
269
|
)
|
|
270
270
|
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
271
|
+
const animatedNumber = driver.useAnimatedNumber(HIDDEN_SIZE)
|
|
272
|
+
|
|
273
|
+
// native only fix
|
|
274
|
+
const at = useRef(0)
|
|
275
|
+
driver.useAnimatedNumberReaction(animatedNumber, (value) => {
|
|
276
|
+
at.current = value
|
|
277
|
+
scrollBridge.paneY = value
|
|
278
|
+
})
|
|
275
279
|
|
|
276
280
|
const [isResizing, setIsResizing] = useState(true)
|
|
277
281
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -281,10 +285,8 @@ export const Sheet = withStaticProperties(
|
|
|
281
285
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
282
286
|
}, [modal])
|
|
283
287
|
|
|
284
|
-
const spring = useRef<Animated.CompositeAnimation | null>(null)
|
|
285
288
|
function stopSpring() {
|
|
286
|
-
|
|
287
|
-
spring.current = null
|
|
289
|
+
animatedNumber.stop()
|
|
288
290
|
if (scrollBridge.onFinishAnimate) {
|
|
289
291
|
scrollBridge.onFinishAnimate()
|
|
290
292
|
scrollBridge.onFinishAnimate = undefined
|
|
@@ -305,7 +307,7 @@ export const Sheet = withStaticProperties(
|
|
|
305
307
|
)
|
|
306
308
|
|
|
307
309
|
const animateTo = useEvent((position: number) => {
|
|
308
|
-
const current =
|
|
310
|
+
const current = animatedNumber.getValue()
|
|
309
311
|
if (isHidden && open) return
|
|
310
312
|
if (!current) return
|
|
311
313
|
if (frameSize === 0) return
|
|
@@ -317,26 +319,19 @@ export const Sheet = withStaticProperties(
|
|
|
317
319
|
if (isResizing) {
|
|
318
320
|
setIsResizing(false)
|
|
319
321
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
toValue,
|
|
322
|
+
animatedNumber.setValue(toValue, {
|
|
323
|
+
type: 'timing',
|
|
323
324
|
duration: 0,
|
|
324
|
-
})
|
|
325
|
+
})
|
|
325
326
|
at.current = toValue
|
|
326
327
|
return
|
|
327
328
|
}
|
|
328
329
|
// dont bounce on initial measure to bottom
|
|
329
330
|
const overshootClamping = at.current === HIDDEN_SIZE
|
|
330
|
-
|
|
331
|
-
useNativeDriver: !isWeb,
|
|
332
|
-
toValue,
|
|
333
|
-
overshootClamping,
|
|
331
|
+
animatedNumber.setValue(toValue, {
|
|
334
332
|
...animationConfig,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (finished) {
|
|
338
|
-
stopSpring()
|
|
339
|
-
}
|
|
333
|
+
type: 'spring',
|
|
334
|
+
overshootClamping,
|
|
340
335
|
})
|
|
341
336
|
})
|
|
342
337
|
|
|
@@ -344,25 +339,11 @@ export const Sheet = withStaticProperties(
|
|
|
344
339
|
animateTo(position)
|
|
345
340
|
}, [isHidden, frameSize, position, animateTo])
|
|
346
341
|
|
|
347
|
-
// native only fix
|
|
348
|
-
const at = useRef(0)
|
|
349
|
-
useEffect(() => {
|
|
350
|
-
positionValue.current!.addListener(({ value }) => {
|
|
351
|
-
at.current = value
|
|
352
|
-
scrollBridge.paneY = value
|
|
353
|
-
})
|
|
354
|
-
return () => {
|
|
355
|
-
positionValue.current!.removeAllListeners()
|
|
356
|
-
}
|
|
357
|
-
}, [])
|
|
358
|
-
|
|
359
342
|
const panResponder = useMemo(
|
|
360
343
|
() => {
|
|
361
344
|
if (disableDrag) return
|
|
362
345
|
if (!frameSize) return
|
|
363
346
|
|
|
364
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
365
|
-
const pos = positionValue.current!
|
|
366
347
|
const minY = positions[0]
|
|
367
348
|
scrollBridge.paneMinY = minY
|
|
368
349
|
let startY = at.current
|
|
@@ -419,8 +400,12 @@ export const Sheet = withStaticProperties(
|
|
|
419
400
|
return true
|
|
420
401
|
}
|
|
421
402
|
const isDraggingUp = dy < 0
|
|
422
|
-
|
|
423
|
-
|
|
403
|
+
const isAtTop = scrollBridge.paneY <= scrollBridge.paneMinY
|
|
404
|
+
// prevent drag once at top and pulling up
|
|
405
|
+
if (isAtTop) {
|
|
406
|
+
if (!isScrolled && isDraggingUp) {
|
|
407
|
+
return false
|
|
408
|
+
}
|
|
424
409
|
}
|
|
425
410
|
// we could do some detection of other touchables and cancel here..
|
|
426
411
|
return Math.abs(dy) > 8
|
|
@@ -434,25 +419,13 @@ export const Sheet = withStaticProperties(
|
|
|
434
419
|
|
|
435
420
|
let isExternalDrag = false
|
|
436
421
|
|
|
437
|
-
function setPositionValue(next: number) {
|
|
438
|
-
// useful to debug any "jumping"
|
|
439
|
-
// if (process.env.NODE_ENV === 'development') {
|
|
440
|
-
// const moveAmt = Math.abs(pos['_value'] - next)
|
|
441
|
-
// if (moveAmt > 50) {
|
|
442
|
-
// console.warn('!!!!!!!!!!!!jump!', moveAmt)
|
|
443
|
-
// // debugger
|
|
444
|
-
// }
|
|
445
|
-
// }
|
|
446
|
-
pos.setValue(next)
|
|
447
|
-
}
|
|
448
|
-
|
|
449
422
|
scrollBridge.drag = (dy) => {
|
|
450
423
|
if (!isExternalDrag) {
|
|
451
424
|
isExternalDrag = true
|
|
452
425
|
grant()
|
|
453
426
|
}
|
|
454
427
|
const to = dy + startY
|
|
455
|
-
|
|
428
|
+
animatedNumber.setValue(resisted(to, minY), { type: 'direct' })
|
|
456
429
|
}
|
|
457
430
|
|
|
458
431
|
scrollBridge.release = release
|
|
@@ -462,7 +435,7 @@ export const Sheet = withStaticProperties(
|
|
|
462
435
|
onPanResponderGrant: grant,
|
|
463
436
|
onPanResponderMove: (_e, { dy }) => {
|
|
464
437
|
const to = dy + startY
|
|
465
|
-
|
|
438
|
+
animatedNumber.setValue(resisted(to, minY), { type: 'direct' })
|
|
466
439
|
},
|
|
467
440
|
onPanResponderEnd: finish,
|
|
468
441
|
onPanResponderTerminate: finish,
|
|
@@ -492,6 +465,7 @@ export const Sheet = withStaticProperties(
|
|
|
492
465
|
overlayComponent = child
|
|
493
466
|
break
|
|
494
467
|
default:
|
|
468
|
+
// eslint-disable-next-line no-console
|
|
495
469
|
console.warn('Warning: passed invalid child to Sheet', child)
|
|
496
470
|
}
|
|
497
471
|
}
|
|
@@ -499,11 +473,18 @@ export const Sheet = withStaticProperties(
|
|
|
499
473
|
|
|
500
474
|
const preventShown = controller?.hidden && controller?.open
|
|
501
475
|
|
|
476
|
+
const animatedStyle = driver.useAnimatedNumberStyle(animatedNumber, (val) => {
|
|
477
|
+
return {
|
|
478
|
+
transform: [{ translateY: frameSize === 0 ? HIDDEN_SIZE : val }],
|
|
479
|
+
}
|
|
480
|
+
})
|
|
481
|
+
|
|
502
482
|
if (preventShown) {
|
|
503
483
|
return null
|
|
504
484
|
}
|
|
505
485
|
|
|
506
|
-
|
|
486
|
+
// temp until reanimated useAnimatedNumber fix
|
|
487
|
+
const AnimatedView = driver['NumberView'] ?? driver.View
|
|
507
488
|
|
|
508
489
|
const contents = (
|
|
509
490
|
<SheetProvider
|
|
@@ -522,7 +503,7 @@ export const Sheet = withStaticProperties(
|
|
|
522
503
|
>
|
|
523
504
|
{isResizing ? null : overlayComponent}
|
|
524
505
|
|
|
525
|
-
<
|
|
506
|
+
<AnimatedView
|
|
526
507
|
ref={ref}
|
|
527
508
|
{...panResponder?.panHandlers}
|
|
528
509
|
onLayout={(e) => {
|
|
@@ -534,13 +515,15 @@ export const Sheet = withStaticProperties(
|
|
|
534
515
|
})
|
|
535
516
|
}}
|
|
536
517
|
pointerEvents={open ? 'auto' : 'none'}
|
|
537
|
-
style={
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
518
|
+
style={[
|
|
519
|
+
{
|
|
520
|
+
position: 'absolute',
|
|
521
|
+
zIndex: 10,
|
|
522
|
+
width: '100%',
|
|
523
|
+
height: '100%',
|
|
524
|
+
},
|
|
525
|
+
animatedStyle,
|
|
526
|
+
]}
|
|
544
527
|
>
|
|
545
528
|
{handleComponent}
|
|
546
529
|
|
|
@@ -554,7 +537,7 @@ export const Sheet = withStaticProperties(
|
|
|
554
537
|
>
|
|
555
538
|
{isResizing ? null : frameComponent}
|
|
556
539
|
</RemoveScroll>
|
|
557
|
-
</
|
|
540
|
+
</AnimatedView>
|
|
558
541
|
</SheetProvider>
|
|
559
542
|
)
|
|
560
543
|
|
|
@@ -582,11 +565,12 @@ export const Sheet = withStaticProperties(
|
|
|
582
565
|
function getPercentSize(point?: number, frameSize?: number) {
|
|
583
566
|
if (!frameSize) return 0
|
|
584
567
|
if (point === undefined) {
|
|
568
|
+
// eslint-disable-next-line no-console
|
|
585
569
|
console.warn(`No snapPoint`)
|
|
586
570
|
return 0
|
|
587
571
|
}
|
|
588
572
|
const pct = point / 100
|
|
589
|
-
const next = frameSize - pct * frameSize
|
|
573
|
+
const next = Math.round(frameSize - pct * frameSize)
|
|
590
574
|
return next
|
|
591
575
|
}
|
|
592
576
|
|
package/src/types.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AnimatedNumberStrategy } from '@tamagui/core'
|
|
1
2
|
import { ScopedProps } from '@tamagui/create-context'
|
|
2
3
|
import { RemoveScroll } from '@tamagui/remove-scroll'
|
|
3
4
|
import React, { ReactNode } from 'react'
|
|
4
|
-
import { Animated } from 'react-native'
|
|
5
5
|
|
|
6
6
|
export type SheetProps = ScopedProps<
|
|
7
7
|
{
|
|
@@ -15,7 +15,7 @@ export type SheetProps = ScopedProps<
|
|
|
15
15
|
children?: ReactNode
|
|
16
16
|
dismissOnOverlayPress?: boolean
|
|
17
17
|
dismissOnSnapToBottom?: boolean
|
|
18
|
-
animationConfig?:
|
|
18
|
+
animationConfig?: AnimatedNumberStrategy
|
|
19
19
|
handleDisableScroll?: boolean
|
|
20
20
|
disableDrag?: boolean
|
|
21
21
|
modal?: boolean
|
|
File without changes
|
package/types/Sheet.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { GetProps } from '@tamagui/core';
|
|
2
2
|
import { XStackProps } from '@tamagui/stacks';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { View } from 'react-native';
|
|
5
5
|
import { SheetScopedProps } from './types';
|
|
6
6
|
export { createSheetScope } from './SheetContext';
|
|
7
|
-
export declare const SheetHandleFrame: import("@tamagui/core").TamaguiComponent<Omit<import("react-native").ViewProps, "
|
|
7
|
+
export declare const SheetHandleFrame: 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<{
|
|
8
8
|
readonly fullscreen?: boolean | undefined;
|
|
9
9
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
10
10
|
}, "open"> & {
|
|
11
11
|
readonly open?: boolean | undefined;
|
|
12
|
-
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "
|
|
12
|
+
} & import("@tamagui/core").MediaProps<Partial<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<{
|
|
13
13
|
readonly fullscreen?: boolean | undefined;
|
|
14
14
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
15
15
|
}, "open"> & {
|
|
16
16
|
readonly open?: boolean | undefined;
|
|
17
|
-
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "
|
|
17
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<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<{
|
|
18
18
|
readonly fullscreen?: boolean | undefined;
|
|
19
19
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
20
20
|
}, "open"> & {
|
|
@@ -26,17 +26,17 @@ export declare const SheetHandleFrame: import("@tamagui/core").TamaguiComponent<
|
|
|
26
26
|
readonly open?: boolean | undefined;
|
|
27
27
|
}>;
|
|
28
28
|
export declare const SheetHandle: ({ __scopeSheet, ...props }: SheetScopedProps<XStackProps>) => JSX.Element;
|
|
29
|
-
export declare const SheetOverlayFrame: import("@tamagui/core").TamaguiComponent<Omit<import("react-native").ViewProps, "
|
|
29
|
+
export declare const SheetOverlayFrame: 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<{
|
|
30
30
|
readonly fullscreen?: boolean | undefined;
|
|
31
31
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
32
32
|
}, "closed"> & {
|
|
33
33
|
closed?: boolean | undefined;
|
|
34
|
-
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "
|
|
34
|
+
} & import("@tamagui/core").MediaProps<Partial<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<{
|
|
35
35
|
readonly fullscreen?: boolean | undefined;
|
|
36
36
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
37
37
|
}, "closed"> & {
|
|
38
38
|
closed?: boolean | undefined;
|
|
39
|
-
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "
|
|
39
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<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<{
|
|
40
40
|
readonly fullscreen?: boolean | undefined;
|
|
41
41
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
42
42
|
}, "closed"> & {
|
|
@@ -49,26 +49,26 @@ export declare const SheetOverlayFrame: import("@tamagui/core").TamaguiComponent
|
|
|
49
49
|
}>;
|
|
50
50
|
export declare type SheetOverlayProps = GetProps<typeof SheetOverlayFrame>;
|
|
51
51
|
export declare const SheetOverlay: ({ __scopeSheet, ...props }: SheetScopedProps<SheetOverlayProps>) => JSX.Element;
|
|
52
|
-
export declare const SheetFrameFrame: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").ViewProps, "
|
|
52
|
+
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"> & {
|
|
53
53
|
readonly fullscreen?: boolean | undefined;
|
|
54
54
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
55
|
-
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "
|
|
55
|
+
} & import("@tamagui/core").MediaProps<Partial<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"> & {
|
|
56
56
|
readonly fullscreen?: boolean | undefined;
|
|
57
57
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
58
|
-
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "
|
|
58
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<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"> & {
|
|
59
59
|
readonly fullscreen?: boolean | undefined;
|
|
60
60
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
61
|
-
}>>) | (Omit<import("react-native").ViewProps, "
|
|
61
|
+
}>>) | (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<{
|
|
62
62
|
readonly fullscreen?: boolean | undefined;
|
|
63
63
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
64
64
|
}, string | number> & {
|
|
65
65
|
[x: string]: undefined;
|
|
66
|
-
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "
|
|
66
|
+
} & import("@tamagui/core").MediaProps<Partial<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<{
|
|
67
67
|
readonly fullscreen?: boolean | undefined;
|
|
68
68
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
69
69
|
}, string | number> & {
|
|
70
70
|
[x: string]: undefined;
|
|
71
|
-
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "
|
|
71
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<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<{
|
|
72
72
|
readonly fullscreen?: boolean | undefined;
|
|
73
73
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
74
74
|
}, string | number> & {
|
|
@@ -82,13 +82,13 @@ export declare const SheetFrameFrame: import("@tamagui/core").TamaguiComponent<(
|
|
|
82
82
|
} & {
|
|
83
83
|
[x: string]: undefined;
|
|
84
84
|
})>;
|
|
85
|
-
export declare const SheetFrame: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "
|
|
85
|
+
export declare const SheetFrame: React.ForwardRefExoticComponent<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"> & {
|
|
86
86
|
readonly fullscreen?: boolean | undefined;
|
|
87
87
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
88
|
-
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "
|
|
88
|
+
} & import("@tamagui/core").MediaProps<Partial<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"> & {
|
|
89
89
|
readonly fullscreen?: boolean | undefined;
|
|
90
90
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
91
|
-
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "
|
|
91
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<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"> & {
|
|
92
92
|
readonly fullscreen?: boolean | undefined;
|
|
93
93
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
94
94
|
}>> & {
|
|
@@ -97,7 +97,7 @@ export declare const SheetFrame: React.ForwardRefExoticComponent<Omit<import("re
|
|
|
97
97
|
export declare const Sheet: ((props: Omit<{
|
|
98
98
|
open?: boolean | undefined;
|
|
99
99
|
defaultOpen?: boolean | undefined;
|
|
100
|
-
onChangeOpen?: (
|
|
100
|
+
onChangeOpen?: (((open: boolean) => void) | React.Dispatch<React.SetStateAction<boolean>>) | undefined;
|
|
101
101
|
position?: number | undefined;
|
|
102
102
|
defaultPosition?: number | undefined;
|
|
103
103
|
snapPoints?: number[] | undefined;
|
|
@@ -105,7 +105,7 @@ export declare const Sheet: ((props: Omit<{
|
|
|
105
105
|
children?: React.ReactNode;
|
|
106
106
|
dismissOnOverlayPress?: boolean | undefined;
|
|
107
107
|
dismissOnSnapToBottom?: boolean | undefined;
|
|
108
|
-
animationConfig?:
|
|
108
|
+
animationConfig?: import("@tamagui/core").AnimatedNumberStrategy | undefined;
|
|
109
109
|
handleDisableScroll?: boolean | undefined;
|
|
110
110
|
disableDrag?: boolean | undefined;
|
|
111
111
|
modal?: boolean | undefined;
|
|
@@ -116,13 +116,13 @@ export declare const Sheet: ((props: Omit<{
|
|
|
116
116
|
themeInverse?: boolean | undefined;
|
|
117
117
|
}) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
|
|
118
118
|
Handle: ({ __scopeSheet, ...props }: SheetScopedProps<XStackProps>) => JSX.Element;
|
|
119
|
-
Frame: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "
|
|
119
|
+
Frame: React.ForwardRefExoticComponent<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"> & {
|
|
120
120
|
readonly fullscreen?: boolean | undefined;
|
|
121
121
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
122
|
-
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "
|
|
122
|
+
} & import("@tamagui/core").MediaProps<Partial<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"> & {
|
|
123
123
|
readonly fullscreen?: boolean | undefined;
|
|
124
124
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
125
|
-
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "
|
|
125
|
+
}>> & import("@tamagui/core").PseudoProps<Partial<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"> & {
|
|
126
126
|
readonly fullscreen?: boolean | undefined;
|
|
127
127
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
128
128
|
}>> & {
|
package/types/SheetContext.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const createSheetContext: <ContextValueType extends object | null
|
|
|
18
18
|
displayName: string;
|
|
19
19
|
}, (consumerName: string, scope: import("@tamagui/create-context").Scope<ContextValueType | undefined>) => ContextValueType], createSheetScope: import("@tamagui/create-context").CreateScope;
|
|
20
20
|
export declare const SheetProvider: {
|
|
21
|
-
(props: Required<Pick<SheetProps, "
|
|
21
|
+
(props: Required<Pick<SheetProps, "open" | "position" | "snapPoints" | "dismissOnOverlayPress">> & {
|
|
22
22
|
hidden: boolean;
|
|
23
23
|
setPosition: PositionChangeHandler;
|
|
24
24
|
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
File without changes
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/types/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AnimatedNumberStrategy } from '@tamagui/core';
|
|
1
2
|
import { ScopedProps } from '@tamagui/create-context';
|
|
2
3
|
import { RemoveScroll } from '@tamagui/remove-scroll';
|
|
3
4
|
import React, { ReactNode } from 'react';
|
|
4
|
-
import { Animated } from 'react-native';
|
|
5
5
|
export declare type SheetProps = ScopedProps<{
|
|
6
6
|
open?: boolean;
|
|
7
7
|
defaultOpen?: boolean;
|
|
@@ -13,7 +13,7 @@ export declare type SheetProps = ScopedProps<{
|
|
|
13
13
|
children?: ReactNode;
|
|
14
14
|
dismissOnOverlayPress?: boolean;
|
|
15
15
|
dismissOnSnapToBottom?: boolean;
|
|
16
|
-
animationConfig?:
|
|
16
|
+
animationConfig?: AnimatedNumberStrategy;
|
|
17
17
|
handleDisableScroll?: boolean;
|
|
18
18
|
disableDrag?: boolean;
|
|
19
19
|
modal?: boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Animated, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
import { SharedValue } from 'react-native-reanimated';
|
|
3
|
+
export declare function useAnimated(): {
|
|
4
|
+
View: any;
|
|
5
|
+
Text: any;
|
|
6
|
+
};
|
|
7
|
+
declare type UniversalAnimatedNumber<A> = {
|
|
8
|
+
getInstance(): A;
|
|
9
|
+
getValue(): number;
|
|
10
|
+
setValue(next: number): void;
|
|
11
|
+
};
|
|
12
|
+
export declare function useAnimatedNumberReanimated(initial: number): UniversalAnimatedNumber<SharedValue<number>>;
|
|
13
|
+
export declare function useAnimatedNumberReactionReanimated(value: UniversalAnimatedNumber<SharedValue<number>>, cb: (current: number) => void): void;
|
|
14
|
+
export declare function useAnimatedNumberStyleReanimated<V extends UniversalAnimatedNumber<Animated.Value>>(value: V, getStyle: (value: V) => ViewStyle | TextStyle): ViewStyle | TextStyle;
|
|
15
|
+
export declare function useAnimatedNumber(initial: number): UniversalAnimatedNumber<Animated.Value>;
|
|
16
|
+
export declare function useAnimatedNumberReaction(value: UniversalAnimatedNumber<Animated.Value>, cb: (current: number) => void): void;
|
|
17
|
+
export declare function useAnimatedNumberStyle<V extends UniversalAnimatedNumber<Animated.Value>>(value: V, getStyle: (value: V) => ViewStyle | TextStyle): ViewStyle | TextStyle;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=useAnimated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=useAnimation.d.ts.map
|