@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.
@@ -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
- useIsomorphicLayoutEffect(() => {
235
- if (!isAbleToPosition) return
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
- }, [isAbleToPosition, position])
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
- <ParentSheetContext.Provider value={nextParentContext}>
505
- <SheetProvider {...providerProps} setHasScrollView={setHasScrollView}>
506
- <AnimatePresence custom={{ open }}>
507
- {shouldHideParentSheet || !open ? null : overlayComponent}
508
- </AnimatePresence>
509
-
510
- {snapPointsMode !== 'percent' && (
511
- <View
512
- style={{
513
- opacity: 0,
514
- position: 'absolute',
515
- top: 0,
516
- left: 0,
517
- right: 0,
518
- bottom: 0,
519
- pointerEvents: 'none',
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
- animatedStyle,
547
- ]}
548
- >
549
- {/* <AdaptProvider>{props.children}</AdaptProvider> */}
550
- {props.children}
551
- </AnimatedView>
552
- </SheetProvider>
553
- </ParentSheetContext.Provider>
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":"AAkBA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA4iBrC,CAAA"}
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"}