@tamagui/popover 1.90.2 → 1.90.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/popover",
3
- "version": "1.90.2",
3
+ "version": "1.90.3",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -33,24 +33,24 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@floating-ui/react": "^0.26.6",
36
- "@tamagui/adapt": "1.90.2",
37
- "@tamagui/animate": "1.90.2",
38
- "@tamagui/aria-hidden": "1.90.2",
39
- "@tamagui/compose-refs": "1.90.2",
40
- "@tamagui/constants": "1.90.2",
41
- "@tamagui/core": "1.90.2",
42
- "@tamagui/dismissable": "1.90.2",
43
- "@tamagui/floating": "1.90.2",
44
- "@tamagui/focus-scope": "1.90.2",
45
- "@tamagui/helpers": "1.90.2",
46
- "@tamagui/polyfill-dev": "1.90.2",
47
- "@tamagui/popper": "1.90.2",
48
- "@tamagui/portal": "1.90.2",
49
- "@tamagui/remove-scroll": "1.90.2",
50
- "@tamagui/scroll-view": "1.90.2",
51
- "@tamagui/sheet": "1.90.2",
52
- "@tamagui/stacks": "1.90.2",
53
- "@tamagui/use-controllable-state": "1.90.2",
36
+ "@tamagui/adapt": "1.90.3",
37
+ "@tamagui/animate": "1.90.3",
38
+ "@tamagui/aria-hidden": "1.90.3",
39
+ "@tamagui/compose-refs": "1.90.3",
40
+ "@tamagui/constants": "1.90.3",
41
+ "@tamagui/core": "1.90.3",
42
+ "@tamagui/dismissable": "1.90.3",
43
+ "@tamagui/floating": "1.90.3",
44
+ "@tamagui/focus-scope": "1.90.3",
45
+ "@tamagui/helpers": "1.90.3",
46
+ "@tamagui/polyfill-dev": "1.90.3",
47
+ "@tamagui/popper": "1.90.3",
48
+ "@tamagui/portal": "1.90.3",
49
+ "@tamagui/remove-scroll": "1.90.3",
50
+ "@tamagui/scroll-view": "1.90.3",
51
+ "@tamagui/sheet": "1.90.3",
52
+ "@tamagui/stacks": "1.90.3",
53
+ "@tamagui/use-controllable-state": "1.90.3",
54
54
  "react-freeze": "^1.0.3"
55
55
  },
56
56
  "peerDependencies": {
@@ -58,7 +58,7 @@
58
58
  "react-native": "*"
59
59
  },
60
60
  "devDependencies": {
61
- "@tamagui/build": "1.90.2",
61
+ "@tamagui/build": "1.90.3",
62
62
  "react": "^18.2.0",
63
63
  "react-native": "^0.73.4"
64
64
  },
package/src/Popover.tsx CHANGED
@@ -410,9 +410,7 @@ const PopoverContentImpl = React.forwardRef<
410
410
  const { open, keepChildrenMounted } = context
411
411
  const popperContext = usePopperContext(__scopePopover || POPOVER_SCOPE)
412
412
 
413
- const contents = React.useMemo(() => {
414
- return isWeb ? <div style={{ display: 'contents' }}>{children}</div> : children
415
- }, [children])
413
+ const contents = isWeb ? <div style={dspContentsStyle}>{children}</div> : children
416
414
 
417
415
  if (context.breakpointActive) {
418
416
  // unwrap the PopoverScrollView if used, as it will use the SheetScrollView if that exists
@@ -426,7 +424,7 @@ const PopoverContentImpl = React.forwardRef<
426
424
  return child
427
425
  })
428
426
 
429
- let content = childrenWithoutScrollView as any
427
+ let content = <ResetPresence>{childrenWithoutScrollView}</ResetPresence>
430
428
 
431
429
  if (Platform.OS === 'android' || Platform.OS === 'ios') {
432
430
  content = (
@@ -434,11 +432,9 @@ const PopoverContentImpl = React.forwardRef<
434
432
  scope={__scopePopover || POPOVER_SCOPE}
435
433
  {...popperContext}
436
434
  >
437
- <ResetPresence>{childrenWithoutScrollView}</ResetPresence>
435
+ {childrenWithoutScrollView}
438
436
  </PopperContext.Provider>
439
437
  )
440
- } else {
441
- content = <ResetPresence>{content}</ResetPresence>
442
438
  }
443
439
 
444
440
  // doesn't show as popover yet on native, must use as sheet
@@ -459,14 +455,16 @@ const PopoverContentImpl = React.forwardRef<
459
455
 
460
456
  // const freeze = Boolean(isFullyHidden && freezeContentsWhenHidden)
461
457
 
458
+ const handleExitComplete = React.useCallback(() => {
459
+ setIsFullyHidden?.(true)
460
+ }, [setIsFullyHidden])
461
+
462
462
  return (
463
463
  <Animate
464
464
  type="presence"
465
465
  present={Boolean(open)}
466
466
  keepChildrenMounted={keepChildrenMounted}
467
- onExitComplete={() => {
468
- setIsFullyHidden && setIsFullyHidden(true)
469
- }}
467
+ onExitComplete={handleExitComplete}
470
468
  >
471
469
  <PopperContent
472
470
  __scopePopper={__scopePopover || POPOVER_SCOPE}
@@ -481,9 +479,7 @@ const PopoverContentImpl = React.forwardRef<
481
479
  allowPinchZoom
482
480
  // causes lots of bugs on touch web on site
483
481
  removeScrollBar={false}
484
- style={{
485
- display: 'contents',
486
- }}
482
+ style={dspContentsStyle}
487
483
  >
488
484
  <ResetPresence>
489
485
  <FocusScope
@@ -502,6 +498,10 @@ const PopoverContentImpl = React.forwardRef<
502
498
  )
503
499
  })
504
500
 
501
+ const dspContentsStyle = {
502
+ display: 'contents',
503
+ }
504
+
505
505
  /* -------------------------------------------------------------------------------------------------
506
506
  * PopoverClose
507
507
  * -----------------------------------------------------------------------------------------------*/
@@ -599,14 +599,16 @@ export const Popover = withStaticProperties(
599
599
  },
600
600
  })
601
601
 
602
+ const handleOpenChange = useEvent((val, via) => {
603
+ viaRef.current = via
604
+ setOpen(val)
605
+ })
606
+
602
607
  const sheetActive = useSheetBreakpointActive(sheetBreakpoint)
603
608
 
604
609
  const floatingContext = useFloatingContext({
605
610
  open,
606
- setOpen: (val, via) => {
607
- viaRef.current = via
608
- setOpen(val)
609
- },
611
+ setOpen: handleOpenChange,
610
612
  disable: sheetActive,
611
613
  hoverable,
612
614
  disableFocus: disableFocus,
@@ -623,6 +625,7 @@ export const Popover = withStaticProperties(
623
625
  anchorTo: setAnchorTo,
624
626
  }))
625
627
 
628
+ // needs to be entirely memoized!
626
629
  const popoverContext = {
627
630
  id,
628
631
  sheetBreakpoint,
@@ -630,10 +633,7 @@ export const Popover = withStaticProperties(
630
633
  triggerRef,
631
634
  open,
632
635
  breakpointActive: sheetActive,
633
- onOpenChange: (val, via) => {
634
- viaRef.current = via
635
- setOpen(val)
636
- },
636
+ onOpenChange: handleOpenChange,
637
637
  onOpenToggle: useEvent(() => {
638
638
  if (open && sheetActive) {
639
639
  return