@tamagui/sheet 1.134.5 → 1.135.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/SheetImplementationCustom.cjs +62 -58
- package/dist/cjs/SheetImplementationCustom.js +20 -18
- package/dist/cjs/SheetImplementationCustom.js.map +1 -1
- package/dist/cjs/SheetImplementationCustom.native.js +71 -67
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetImplementationCustom.js +21 -18
- package/dist/esm/SheetImplementationCustom.js.map +1 -1
- package/dist/esm/SheetImplementationCustom.mjs +63 -59
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +68 -66
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetImplementationCustom.js +21 -18
- package/dist/jsx/SheetImplementationCustom.js.map +1 -1
- package/dist/jsx/SheetImplementationCustom.mjs +63 -59
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.js +72 -68
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/package.json +19 -19
- package/src/SheetImplementationCustom.tsx +63 -65
- package/types/SheetImplementationCustom.d.ts.map +1 -1
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useIsomorphicLayoutEffect,
|
|
9
9
|
} from '@tamagui/constants'
|
|
10
10
|
import {
|
|
11
|
+
LayoutMeasurementController,
|
|
11
12
|
Stack,
|
|
12
13
|
Theme,
|
|
13
14
|
useConfiguration,
|
|
@@ -195,18 +196,6 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
|
|
|
195
196
|
})
|
|
196
197
|
})
|
|
197
198
|
|
|
198
|
-
const isAbleToPosition = (() => {
|
|
199
|
-
if (disableAnimation) {
|
|
200
|
-
return false
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (!frameSize || !screenSize || isHidden || (hasntMeasured && !open)) {
|
|
204
|
-
return false
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return true
|
|
208
|
-
})()
|
|
209
|
-
|
|
210
199
|
useIsomorphicLayoutEffect(() => {
|
|
211
200
|
// we need to do a *three* step process for the css driver
|
|
212
201
|
// first render off screen for ssr safety (hiddenSize)
|
|
@@ -228,11 +217,18 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
|
|
|
228
217
|
}, 10)
|
|
229
218
|
}
|
|
230
219
|
)
|
|
220
|
+
return
|
|
231
221
|
}
|
|
232
|
-
}, [hasntMeasured, screenSize, frameSize])
|
|
233
222
|
|
|
234
|
-
|
|
235
|
-
|
|
223
|
+
if (disableAnimation) {
|
|
224
|
+
return
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (!frameSize || !screenSize || isHidden || (hasntMeasured && !open)) {
|
|
228
|
+
return
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// finally, animate
|
|
236
232
|
animateTo(position)
|
|
237
233
|
|
|
238
234
|
// reset scroll bridge
|
|
@@ -240,7 +236,7 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
|
|
|
240
236
|
scrollBridge.scrollLock = false
|
|
241
237
|
scrollBridge.scrollStartY = -1
|
|
242
238
|
}
|
|
243
|
-
}, [
|
|
239
|
+
}, [hasntMeasured, disableAnimation, isHidden, frameSize, screenSize, open, position])
|
|
244
240
|
|
|
245
241
|
const disableDrag = props.disableDrag ?? controller?.disableDrag
|
|
246
242
|
const themeName = useThemeName()
|
|
@@ -501,56 +497,58 @@ export const SheetImplementationCustom = React.forwardRef<View, SheetProps>(
|
|
|
501
497
|
// })
|
|
502
498
|
|
|
503
499
|
let contents = (
|
|
504
|
-
<
|
|
505
|
-
<
|
|
506
|
-
<
|
|
507
|
-
{
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}}
|
|
521
|
-
onLayout={handleMaxContentViewLayout}
|
|
522
|
-
/>
|
|
523
|
-
)}
|
|
524
|
-
|
|
525
|
-
<AnimatedView
|
|
526
|
-
ref={ref}
|
|
527
|
-
{...panResponder?.panHandlers}
|
|
528
|
-
onLayout={handleAnimationViewLayout}
|
|
529
|
-
// @ts-ignore for CSS driver this is necessary to attach the transition
|
|
530
|
-
// also motion driver at least though i suspect all drivers?
|
|
531
|
-
animation={isDragging || disableAnimation ? null : animation}
|
|
532
|
-
// @ts-ignore
|
|
533
|
-
disableClassName
|
|
534
|
-
style={[
|
|
535
|
-
{
|
|
536
|
-
position: 'absolute',
|
|
537
|
-
zIndex,
|
|
538
|
-
width: '100%',
|
|
539
|
-
height: forcedContentHeight,
|
|
540
|
-
minHeight: forcedContentHeight,
|
|
541
|
-
opacity: !shouldHideParentSheet ? opacity : 0,
|
|
542
|
-
...((shouldHideParentSheet || !open) && {
|
|
500
|
+
<LayoutMeasurementController disable={!open}>
|
|
501
|
+
<ParentSheetContext.Provider value={nextParentContext}>
|
|
502
|
+
<SheetProvider {...providerProps} setHasScrollView={setHasScrollView}>
|
|
503
|
+
<AnimatePresence custom={{ open }}>
|
|
504
|
+
{shouldHideParentSheet || !open ? null : overlayComponent}
|
|
505
|
+
</AnimatePresence>
|
|
506
|
+
|
|
507
|
+
{snapPointsMode !== 'percent' && (
|
|
508
|
+
<View
|
|
509
|
+
style={{
|
|
510
|
+
opacity: 0,
|
|
511
|
+
position: 'absolute',
|
|
512
|
+
top: 0,
|
|
513
|
+
left: 0,
|
|
514
|
+
right: 0,
|
|
515
|
+
bottom: 0,
|
|
543
516
|
pointerEvents: 'none',
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
517
|
+
}}
|
|
518
|
+
onLayout={handleMaxContentViewLayout}
|
|
519
|
+
/>
|
|
520
|
+
)}
|
|
521
|
+
|
|
522
|
+
<AnimatedView
|
|
523
|
+
ref={ref}
|
|
524
|
+
{...panResponder?.panHandlers}
|
|
525
|
+
onLayout={handleAnimationViewLayout}
|
|
526
|
+
// @ts-ignore for CSS driver this is necessary to attach the transition
|
|
527
|
+
// also motion driver at least though i suspect all drivers?
|
|
528
|
+
animation={isDragging || disableAnimation ? null : animation}
|
|
529
|
+
// @ts-ignore
|
|
530
|
+
disableClassName
|
|
531
|
+
style={[
|
|
532
|
+
{
|
|
533
|
+
position: 'absolute',
|
|
534
|
+
zIndex,
|
|
535
|
+
width: '100%',
|
|
536
|
+
height: forcedContentHeight,
|
|
537
|
+
minHeight: forcedContentHeight,
|
|
538
|
+
opacity: !shouldHideParentSheet ? opacity : 0,
|
|
539
|
+
...((shouldHideParentSheet || !open) && {
|
|
540
|
+
pointerEvents: 'none',
|
|
541
|
+
}),
|
|
542
|
+
},
|
|
543
|
+
animatedStyle,
|
|
544
|
+
]}
|
|
545
|
+
>
|
|
546
|
+
{/* <AdaptProvider>{props.children}</AdaptProvider> */}
|
|
547
|
+
{props.children}
|
|
548
|
+
</AnimatedView>
|
|
549
|
+
</SheetProvider>
|
|
550
|
+
</ParentSheetContext.Provider>
|
|
551
|
+
</LayoutMeasurementController>
|
|
554
552
|
)
|
|
555
553
|
|
|
556
554
|
if (process.env.TAMAGUI_TARGET === 'native' && !USE_NATIVE_PORTAL) {
|
|
@@ -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":"AAmBA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAOvC,OAAO,EAAsC,IAAI,EAAE,MAAM,cAAc,CAAA;AAIvE,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,SAAS,CAAA;AAWzD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAyiBrC,CAAA"}
|