@tamagui/accordion 2.0.0-1768992908401 → 2.0.0-1769041757506

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.
Files changed (2) hide show
  1. package/package.json +14 -14
  2. package/src/Accordion.tsx +12 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/accordion",
3
- "version": "2.0.0-1768992908401",
3
+ "version": "2.0.0-1769041757506",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -23,18 +23,18 @@
23
23
  "lint:fix": "biome check --write src"
24
24
  },
25
25
  "dependencies": {
26
- "@tamagui/collapsible": "2.0.0-1768992908401",
27
- "@tamagui/collection": "2.0.0-1768992908401",
28
- "@tamagui/compose-refs": "2.0.0-1768992908401",
29
- "@tamagui/constants": "2.0.0-1768992908401",
30
- "@tamagui/core": "2.0.0-1768992908401",
31
- "@tamagui/create-context": "2.0.0-1768992908401",
32
- "@tamagui/helpers": "2.0.0-1768992908401",
33
- "@tamagui/polyfill-dev": "2.0.0-1768992908401",
34
- "@tamagui/stacks": "2.0.0-1768992908401",
35
- "@tamagui/text": "2.0.0-1768992908401",
36
- "@tamagui/use-controllable-state": "2.0.0-1768992908401",
37
- "@tamagui/use-direction": "2.0.0-1768992908401"
26
+ "@tamagui/collapsible": "2.0.0-1769041757506",
27
+ "@tamagui/collection": "2.0.0-1769041757506",
28
+ "@tamagui/compose-refs": "2.0.0-1769041757506",
29
+ "@tamagui/constants": "2.0.0-1769041757506",
30
+ "@tamagui/core": "2.0.0-1769041757506",
31
+ "@tamagui/create-context": "2.0.0-1769041757506",
32
+ "@tamagui/helpers": "2.0.0-1769041757506",
33
+ "@tamagui/polyfill-dev": "2.0.0-1769041757506",
34
+ "@tamagui/stacks": "2.0.0-1769041757506",
35
+ "@tamagui/text": "2.0.0-1769041757506",
36
+ "@tamagui/use-controllable-state": "2.0.0-1769041757506",
37
+ "@tamagui/use-direction": "2.0.0-1769041757506"
38
38
  },
39
39
  "exports": {
40
40
  "./package.json": "./package.json",
@@ -52,7 +52,7 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@tamagui/build": "2.0.0-1768992908401",
55
+ "@tamagui/build": "2.0.0-1769041757506",
56
56
  "react": "*"
57
57
  },
58
58
  "publishConfig": {
package/src/Accordion.tsx CHANGED
@@ -579,16 +579,23 @@ const AccordionContent = AccordionContentFrame.styleable(function AccordionConte
579
579
  const HeightAnimator = View.styleable((props, ref) => {
580
580
  const itemContext = useAccordionItemContext()
581
581
  const { children, ...rest } = props
582
- const [height, setHeight] = React.useState(0)
582
+ const [measuredHeight, setMeasuredHeight] = React.useState<number>(0)
583
+ const hasMeasured = measuredHeight > 0
584
+
585
+ // when open and not measured yet, use auto so SSR shows content
586
+ // once measured, use numeric height for animations
587
+ const height = itemContext.open ? (hasMeasured ? measuredHeight : 'auto') : 0
583
588
 
584
589
  return (
585
- <View ref={ref} height={itemContext.open ? height : 0} position="relative" {...rest}>
590
+ <View ref={ref} height={height} position="relative" {...rest}>
586
591
  <View
587
592
  position="absolute"
588
- width="100%"
593
+ top={0}
594
+ left={0}
595
+ right={0}
589
596
  onLayout={({ nativeEvent }) => {
590
- if (nativeEvent.layout.height) {
591
- setHeight(nativeEvent.layout.height)
597
+ if (nativeEvent.layout.height && nativeEvent.layout.height !== measuredHeight) {
598
+ setMeasuredHeight(nativeEvent.layout.height)
592
599
  }
593
600
  }}
594
601
  >