@tamagui/animate 1.129.19 → 1.130.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.
@@ -31,28 +31,34 @@ function Animate({
31
31
  lazyMount,
32
32
  type,
33
33
  present,
34
+ passThrough,
34
35
  ...props
35
36
  }) {
36
37
  const [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? !1 : present);
37
38
  (0, import_react.useEffect)(() => {
38
- lazyMount && present && (0, import_react.startTransition)(() => {
39
+ passThrough || lazyMount && present && (0, import_react.startTransition)(() => {
39
40
  setLazyMounted(present);
40
41
  });
41
42
  }, [lazyMount, present]);
42
43
  const mounted = present ? lazyMount ? lazyMounted : present : !1;
43
44
  return type === "presence" ? props.keepChildrenMounted ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
44
- initial: props.initial ? void 0 : !1,
45
- onExitComplete: props.onExitComplete,
46
- enterVariant: props.enterVariant,
47
- exitVariant: props.exitVariant,
48
- enterExitVariant: props.enterExitVariant,
49
- presenceAffectsLayout: !1,
50
- isPresent: present,
51
- custom: props.custom,
45
+ isPresent: !0,
46
+ ...(!passThrough && {
47
+ initial: props.initial ? void 0 : !1,
48
+ onExitComplete: props.onExitComplete,
49
+ enterVariant: props.enterVariant,
50
+ exitVariant: props.exitVariant,
51
+ enterExitVariant: props.enterExitVariant,
52
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
53
+ // but since we always re-render this component on open changes this should be fine to leave off?
54
+ presenceAffectsLayout: !1,
55
+ isPresent: present,
56
+ custom: props.custom
57
+ }),
52
58
  children
53
59
  }) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
54
60
  ...props,
55
- children: mounted ? children : null
61
+ children: mounted || passThrough ? children : null
56
62
  }) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
57
63
  children
58
64
  });
@@ -23,11 +23,12 @@ function Animate({
23
23
  lazyMount,
24
24
  type,
25
25
  present,
26
+ passThrough,
26
27
  ...props
27
28
  }) {
28
29
  const [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? !1 : present);
29
30
  (0, import_react.useEffect)(() => {
30
- lazyMount && present && (0, import_react.startTransition)(() => {
31
+ passThrough || lazyMount && present && (0, import_react.startTransition)(() => {
31
32
  setLazyMounted(present);
32
33
  });
33
34
  }, [lazyMount, present]);
@@ -35,16 +36,21 @@ function Animate({
35
36
  return type === "presence" ? props.keepChildrenMounted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
36
37
  import_animate_presence.PresenceChild,
37
38
  {
38
- initial: props.initial ? void 0 : !1,
39
- onExitComplete: props.onExitComplete,
40
- enterVariant: props.enterVariant,
41
- exitVariant: props.exitVariant,
42
- enterExitVariant: props.enterExitVariant,
43
- presenceAffectsLayout: !1,
44
- isPresent: present,
45
- custom: props.custom,
39
+ isPresent: !0,
40
+ ...!passThrough && {
41
+ initial: props.initial ? void 0 : !1,
42
+ onExitComplete: props.onExitComplete,
43
+ enterVariant: props.enterVariant,
44
+ exitVariant: props.exitVariant,
45
+ enterExitVariant: props.enterExitVariant,
46
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
47
+ // but since we always re-render this component on open changes this should be fine to leave off?
48
+ presenceAffectsLayout: !1,
49
+ isPresent: present,
50
+ custom: props.custom
51
+ },
46
52
  children
47
53
  }
48
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, { ...props, children: mounted ? children : null }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
54
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, { ...props, children: mounted || passThrough ? children : null }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
49
55
  }
50
56
  //# sourceMappingURL=Animate.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Animate.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA+C,sCAC/C,eAAqD,kBA0D7C;AAvBD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkC;AAChC,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,YAAY,KAAQ,OAAO;AAE1E,8BAAU,MAAM;AACd,IAAK,aACA,eACL,8BAAgB,MAAM;AACpB,qBAAe,OAAO;AAAA,IACxB,CAAC;AAAA,EACH,GAAG,CAAC,WAAW,OAAO,CAAC;AAGvB,QAAM,UAAW,UAAkB,YAAY,cAAc,UAAlC;AAE3B,SAAI,SAAS,aACP,MAAM,sBAEN;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,MAAM,UAAU,SAAY;AAAA,MACrC,gBAAgB,MAAM;AAAA,MACtB,cAAc,MAAM;AAAA,MACpB,aAAa,MAAM;AAAA,MACnB,kBAAkB,MAAM;AAAA,MAGxB,uBAAuB;AAAA,MACvB,WAAW;AAAA,MACX,QAAQ,MAAM;AAAA,MAEb;AAAA;AAAA,EACH,IAIG,4CAAC,2CAAiB,GAAG,OAAQ,oBAAU,WAAW,MAAK,IAGzD,2EAAG,UAAS;AACrB;",
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA+C,sCAC/C,eAAqD,kBA4D7C;AAzBD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkC;AAChC,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,YAAY,KAAQ,OAAO;AAE1E,8BAAU,MAAM;AACd,IAAI,eACC,aACA,eACL,8BAAgB,MAAM;AACpB,qBAAe,OAAO;AAAA,IACxB,CAAC;AAAA,EACH,GAAG,CAAC,WAAW,OAAO,CAAC;AAGvB,QAAM,UAAW,UAAkB,YAAY,cAAc,UAAlC;AAE3B,SAAI,SAAS,aACP,MAAM,sBAEN;AAAA,IAAC;AAAA;AAAA,MACC,WAAS;AAAA,MACR,GAAI,CAAC,eAAe;AAAA,QACnB,SAAS,MAAM,UAAU,SAAY;AAAA,QACrC,gBAAgB,MAAM;AAAA,QACtB,cAAc,MAAM;AAAA,QACpB,aAAa,MAAM;AAAA,QACnB,kBAAkB,MAAM;AAAA;AAAA;AAAA,QAGxB,uBAAuB;AAAA,QACvB,WAAW;AAAA,QACX,QAAQ,MAAM;AAAA,MAChB;AAAA,MAEC;AAAA;AAAA,EACH,IAKF,4CAAC,2CAAiB,GAAG,OAClB,qBAAW,cAAc,WAAW,MACvC,IAIG,2EAAG,UAAS;AACrB;",
5
5
  "names": []
6
6
  }
@@ -20,9 +20,9 @@ __export(Animate_exports, {
20
20
  module.exports = __toCommonJS(Animate_exports);
21
21
  var import_jsx_runtime = require("react/jsx-runtime"), import_animate_presence = require("@tamagui/animate-presence"), import_react = require("react");
22
22
  function Animate(param) {
23
- var { children, lazyMount, type, present, ...props } = param, [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? !1 : present);
23
+ var { children, lazyMount, type, present, passThrough, ...props } = param, [lazyMounted, setLazyMounted] = (0, import_react.useState)(lazyMount ? !1 : present);
24
24
  (0, import_react.useEffect)(function() {
25
- lazyMount && present && (0, import_react.startTransition)(function() {
25
+ passThrough || lazyMount && present && (0, import_react.startTransition)(function() {
26
26
  setLazyMounted(present);
27
27
  });
28
28
  }, [
@@ -31,20 +31,23 @@ function Animate(param) {
31
31
  ]);
32
32
  var mounted = present ? lazyMount ? lazyMounted : present : !1;
33
33
  return type === "presence" ? props.keepChildrenMounted ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.PresenceChild, {
34
- initial: props.initial ? void 0 : !1,
35
- onExitComplete: props.onExitComplete,
36
- enterVariant: props.enterVariant,
37
- exitVariant: props.exitVariant,
38
- enterExitVariant: props.enterExitVariant,
39
- // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
40
- // but since we always re-render this component on open changes this should be fine to leave off?
41
- presenceAffectsLayout: !1,
42
- isPresent: present,
43
- custom: props.custom,
34
+ isPresent: !0,
35
+ ...!passThrough && {
36
+ initial: props.initial ? void 0 : !1,
37
+ onExitComplete: props.onExitComplete,
38
+ enterVariant: props.enterVariant,
39
+ exitVariant: props.exitVariant,
40
+ enterExitVariant: props.enterExitVariant,
41
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
42
+ // but since we always re-render this component on open changes this should be fine to leave off?
43
+ presenceAffectsLayout: !1,
44
+ isPresent: present,
45
+ custom: props.custom
46
+ },
44
47
  children
45
48
  }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
46
49
  ...props,
47
- children: mounted ? children : null
50
+ children: mounted || passThrough ? children : null
48
51
  }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
49
52
  children
50
53
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Animate.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;uDACA,0BAA+C,sCAC/C,eAAqD;AAmC9C,SAASA,QAAQ,OAMT;MANS,EACtBC,UACAC,WACAC,MACAC,SACA,GAAGC,MAAAA,IALmB,OAOhB,CAACC,aAAaC,cAAAA,QAAkBC,uBAASN,YAAY,KAAQE,OAAAA;AAEnEK,8BAAU,WAAA;AACR,IAAKP,aACAE,eACLM,8BAAgB,WAAA;AACdH,qBAAeH,OAAAA;IACjB,CAAA;EACF,GAAG;IAACF;IAAWE;GAAQ;AAGvB,MAAMO,UAAWP,UAAkBF,YAAYI,cAAcF,UAAlC;AAE3B,SAAID,SAAS,aACPE,MAAMO,sBAEN,uCAAAC,KAACC,uCAAAA;IACCC,SAASV,MAAMU,UAAUC,SAAY;IACrCC,gBAAgBZ,MAAMY;IACtBC,cAAcb,MAAMa;IACpBC,aAAad,MAAMc;IACnBC,kBAAkBf,MAAMe;;;IAGxBC,uBAAuB;IACvBC,WAAWlB;IACXmB,QAAQlB,MAAMkB;;OAOb,uCAAAV,KAACW,yCAAAA;IAAiB,GAAGnB;cAAQM,UAAUV,WAAW;OAGpD,uCAAAY,KAAA,mBAAAY,UAAA;;;AACT;",
5
- "names": ["Animate", "children", "lazyMount", "type", "present", "props", "lazyMounted", "setLazyMounted", "useState", "useEffect", "startTransition", "mounted", "keepChildrenMounted", "_jsx", "PresenceChild", "initial", "undefined", "onExitComplete", "enterVariant", "exitVariant", "enterExitVariant", "presenceAffectsLayout", "isPresent", "custom", "AnimatePresence", "_Fragment"]
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;uDACA,0BAA+C,sCAC/C,eAAqD;AAmC9C,SAASA,QAAQ,OAOT;MAPS,EACtBC,UACAC,WACAC,MACAC,SACAC,aACA,GAAGC,MAAAA,IANmB,OAQhB,CAACC,aAAaC,cAAAA,QAAkBC,uBAASP,YAAY,KAAQE,OAAAA;AAEnEM,8BAAU,WAAA;AACR,IAAIL,eACCH,aACAE,eACLO,8BAAgB,WAAA;AACdH,qBAAeJ,OAAAA;IACjB,CAAA;EACF,GAAG;IAACF;IAAWE;GAAQ;AAGvB,MAAMQ,UAAWR,UAAkBF,YAAYK,cAAcH,UAAlC;AAE3B,SAAID,SAAS,aACPG,MAAMO,sBAEN,uCAAAC,KAACC,uCAAAA;IACCC,WAAS;IACR,GAAI,CAACX,eAAe;MACnBY,SAASX,MAAMW,UAAUC,SAAY;MACrCC,gBAAgBb,MAAMa;MACtBC,cAAcd,MAAMc;MACpBC,aAAaf,MAAMe;MACnBC,kBAAkBhB,MAAMgB;;;MAGxBC,uBAAuB;MACvBP,WAAWZ;MACXoB,QAAQlB,MAAMkB;IAChB;;OAQJ,uCAAAV,KAACW,yCAAAA;IAAiB,GAAGnB;cAClBM,WAAWP,cAAcJ,WAAW;OAKpC,uCAAAa,KAAA,mBAAAY,UAAA;;;AACT;",
5
+ "names": ["Animate", "children", "lazyMount", "type", "present", "passThrough", "props", "lazyMounted", "setLazyMounted", "useState", "useEffect", "startTransition", "mounted", "keepChildrenMounted", "_jsx", "PresenceChild", "isPresent", "initial", "undefined", "onExitComplete", "enterVariant", "exitVariant", "enterExitVariant", "presenceAffectsLayout", "custom", "AnimatePresence", "_Fragment"]
6
6
  }
@@ -6,11 +6,12 @@ function Animate({
6
6
  lazyMount,
7
7
  type,
8
8
  present,
9
+ passThrough,
9
10
  ...props
10
11
  }) {
11
12
  const [lazyMounted, setLazyMounted] = useState(lazyMount ? !1 : present);
12
13
  useEffect(() => {
13
- lazyMount && present && startTransition(() => {
14
+ passThrough || lazyMount && present && startTransition(() => {
14
15
  setLazyMounted(present);
15
16
  });
16
17
  }, [lazyMount, present]);
@@ -18,17 +19,22 @@ function Animate({
18
19
  return type === "presence" ? props.keepChildrenMounted ? /* @__PURE__ */ jsx(
19
20
  PresenceChild,
20
21
  {
21
- initial: props.initial ? void 0 : !1,
22
- onExitComplete: props.onExitComplete,
23
- enterVariant: props.enterVariant,
24
- exitVariant: props.exitVariant,
25
- enterExitVariant: props.enterExitVariant,
26
- presenceAffectsLayout: !1,
27
- isPresent: present,
28
- custom: props.custom,
22
+ isPresent: !0,
23
+ ...!passThrough && {
24
+ initial: props.initial ? void 0 : !1,
25
+ onExitComplete: props.onExitComplete,
26
+ enterVariant: props.enterVariant,
27
+ exitVariant: props.exitVariant,
28
+ enterExitVariant: props.enterExitVariant,
29
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
30
+ // but since we always re-render this component on open changes this should be fine to leave off?
31
+ presenceAffectsLayout: !1,
32
+ isPresent: present,
33
+ custom: props.custom
34
+ },
29
35
  children
30
36
  }
31
- ) : /* @__PURE__ */ jsx(AnimatePresence, { ...props, children: mounted ? children : null }) : /* @__PURE__ */ jsx(Fragment, { children });
37
+ ) : /* @__PURE__ */ jsx(AnimatePresence, { ...props, children: mounted || passThrough ? children : null }) : /* @__PURE__ */ jsx(Fragment, { children });
32
38
  }
33
39
  export {
34
40
  Animate
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Animate.tsx"],
4
- "mappings": "AACA,SAAS,iBAAiB,qBAAqB;AAC/C,SAAS,iBAAiB,WAAW,gBAAgB;AA0D7C,SAoBC,UApBD;AAvBD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkC;AAChC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,YAAY,KAAQ,OAAO;AAE1E,YAAU,MAAM;AACd,IAAK,aACA,WACL,gBAAgB,MAAM;AACpB,qBAAe,OAAO;AAAA,IACxB,CAAC;AAAA,EACH,GAAG,CAAC,WAAW,OAAO,CAAC;AAGvB,QAAM,UAAW,UAAkB,YAAY,cAAc,UAAlC;AAE3B,SAAI,SAAS,aACP,MAAM,sBAEN;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,MAAM,UAAU,SAAY;AAAA,MACrC,gBAAgB,MAAM;AAAA,MACtB,cAAc,MAAM;AAAA,MACpB,aAAa,MAAM;AAAA,MACnB,kBAAkB,MAAM;AAAA,MAGxB,uBAAuB;AAAA,MACvB,WAAW;AAAA,MACX,QAAQ,MAAM;AAAA,MAEb;AAAA;AAAA,EACH,IAIG,oBAAC,mBAAiB,GAAG,OAAQ,oBAAU,WAAW,MAAK,IAGzD,gCAAG,UAAS;AACrB;",
4
+ "mappings": "AACA,SAAS,iBAAiB,qBAAqB;AAC/C,SAAS,iBAAiB,WAAW,gBAAgB;AA4D7C,SA2BC,UA3BD;AAzBD,SAAS,QAAQ;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkC;AAChC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,YAAY,KAAQ,OAAO;AAE1E,YAAU,MAAM;AACd,IAAI,eACC,aACA,WACL,gBAAgB,MAAM;AACpB,qBAAe,OAAO;AAAA,IACxB,CAAC;AAAA,EACH,GAAG,CAAC,WAAW,OAAO,CAAC;AAGvB,QAAM,UAAW,UAAkB,YAAY,cAAc,UAAlC;AAE3B,SAAI,SAAS,aACP,MAAM,sBAEN;AAAA,IAAC;AAAA;AAAA,MACC,WAAS;AAAA,MACR,GAAI,CAAC,eAAe;AAAA,QACnB,SAAS,MAAM,UAAU,SAAY;AAAA,QACrC,gBAAgB,MAAM;AAAA,QACtB,cAAc,MAAM;AAAA,QACpB,aAAa,MAAM;AAAA,QACnB,kBAAkB,MAAM;AAAA;AAAA;AAAA,QAGxB,uBAAuB;AAAA,QACvB,WAAW;AAAA,QACX,QAAQ,MAAM;AAAA,MAChB;AAAA,MAEC;AAAA;AAAA,EACH,IAKF,oBAAC,mBAAiB,GAAG,OAClB,qBAAW,cAAc,WAAW,MACvC,IAIG,gCAAG,UAAS;AACrB;",
5
5
  "names": []
6
6
  }
@@ -6,28 +6,34 @@ function Animate({
6
6
  lazyMount,
7
7
  type,
8
8
  present,
9
+ passThrough,
9
10
  ...props
10
11
  }) {
11
12
  const [lazyMounted, setLazyMounted] = useState(lazyMount ? !1 : present);
12
13
  useEffect(() => {
13
- lazyMount && present && startTransition(() => {
14
+ passThrough || lazyMount && present && startTransition(() => {
14
15
  setLazyMounted(present);
15
16
  });
16
17
  }, [lazyMount, present]);
17
18
  const mounted = present ? lazyMount ? lazyMounted : present : !1;
18
19
  return type === "presence" ? props.keepChildrenMounted ? /* @__PURE__ */jsx(PresenceChild, {
19
- initial: props.initial ? void 0 : !1,
20
- onExitComplete: props.onExitComplete,
21
- enterVariant: props.enterVariant,
22
- exitVariant: props.exitVariant,
23
- enterExitVariant: props.enterExitVariant,
24
- presenceAffectsLayout: !1,
25
- isPresent: present,
26
- custom: props.custom,
20
+ isPresent: !0,
21
+ ...(!passThrough && {
22
+ initial: props.initial ? void 0 : !1,
23
+ onExitComplete: props.onExitComplete,
24
+ enterVariant: props.enterVariant,
25
+ exitVariant: props.exitVariant,
26
+ enterExitVariant: props.enterExitVariant,
27
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
28
+ // but since we always re-render this component on open changes this should be fine to leave off?
29
+ presenceAffectsLayout: !1,
30
+ isPresent: present,
31
+ custom: props.custom
32
+ }),
27
33
  children
28
34
  }) : /* @__PURE__ */jsx(AnimatePresence, {
29
35
  ...props,
30
- children: mounted ? children : null
36
+ children: mounted || passThrough ? children : null
31
37
  }) : /* @__PURE__ */jsx(Fragment, {
32
38
  children
33
39
  });
@@ -1 +1 @@
1
- {"version":3,"names":["AnimatePresence","PresenceChild","startTransition","useEffect","useState","Fragment","jsx","Animate","children","lazyMount","type","present","props","lazyMounted","setLazyMounted","mounted","keepChildrenMounted","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","isPresent","custom"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,eAAA,EAAiBC,aAAA,QAAqB;AAC/C,SAASC,eAAA,EAAiBC,SAAA,EAAWC,QAAA,QAAgB;AA0D7C,SAoBCC,QAAA,EApBDC,GAAA;AAvBD,SAASC,QAAQ;EACtBC,QAAA;EACAC,SAAA;EACAC,IAAA;EACAC,OAAA;EACA,GAAGC;AACL,GAAkC;EAChC,MAAM,CAACC,WAAA,EAAaC,cAAc,IAAIV,QAAA,CAASK,SAAA,GAAY,KAAQE,OAAO;EAE1ER,SAAA,CAAU,MAAM;IACTM,SAAA,IACAE,OAAA,IACLT,eAAA,CAAgB,MAAM;MACpBY,cAAA,CAAeH,OAAO;IACxB,CAAC;EACH,GAAG,CAACF,SAAA,EAAWE,OAAO,CAAC;EAGvB,MAAMI,OAAA,GAAWJ,OAAA,GAAkBF,SAAA,GAAYI,WAAA,GAAcF,OAAA,GAAlC;EAE3B,OAAID,IAAA,KAAS,aACPE,KAAA,CAAMI,mBAAA,GAEN,eAAAV,GAAA,CAACL,aAAA;IACCgB,OAAA,EAASL,KAAA,CAAMK,OAAA,GAAU,SAAY;IACrCC,cAAA,EAAgBN,KAAA,CAAMM,cAAA;IACtBC,YAAA,EAAcP,KAAA,CAAMO,YAAA;IACpBC,WAAA,EAAaR,KAAA,CAAMQ,WAAA;IACnBC,gBAAA,EAAkBT,KAAA,CAAMS,gBAAA;IAGxBC,qBAAA,EAAuB;IACvBC,SAAA,EAAWZ,OAAA;IACXa,MAAA,EAAQZ,KAAA,CAAMY,MAAA;IAEbhB;EAAA,CACH,IAIG,eAAAF,GAAA,CAACN,eAAA;IAAiB,GAAGY,KAAA;IAAQJ,QAAA,EAAAO,OAAA,GAAUP,QAAA,GAAW;EAAA,CAAK,IAGzD,eAAAF,GAAA,CAAAD,QAAA;IAAGG;EAAA,CAAS;AACrB","ignoreList":[]}
1
+ {"version":3,"names":["AnimatePresence","PresenceChild","startTransition","useEffect","useState","Fragment","jsx","Animate","children","lazyMount","type","present","passThrough","props","lazyMounted","setLazyMounted","mounted","keepChildrenMounted","isPresent","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","custom"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,eAAA,EAAiBC,aAAA,QAAqB;AAC/C,SAASC,eAAA,EAAiBC,SAAA,EAAWC,QAAA,QAAgB;AA4D7C,SA2BCC,QAAA,EA3BDC,GAAA;AAzBD,SAASC,QAAQ;EACtBC,QAAA;EACAC,SAAA;EACAC,IAAA;EACAC,OAAA;EACAC,WAAA;EACA,GAAGC;AACL,GAAkC;EAChC,MAAM,CAACC,WAAA,EAAaC,cAAc,IAAIX,QAAA,CAASK,SAAA,GAAY,KAAQE,OAAO;EAE1ER,SAAA,CAAU,MAAM;IACVS,WAAA,IACCH,SAAA,IACAE,OAAA,IACLT,eAAA,CAAgB,MAAM;MACpBa,cAAA,CAAeJ,OAAO;IACxB,CAAC;EACH,GAAG,CAACF,SAAA,EAAWE,OAAO,CAAC;EAGvB,MAAMK,OAAA,GAAWL,OAAA,GAAkBF,SAAA,GAAYK,WAAA,GAAcH,OAAA,GAAlC;EAE3B,OAAID,IAAA,KAAS,aACPG,KAAA,CAAMI,mBAAA,GAEN,eAAAX,GAAA,CAACL,aAAA;IACCiB,SAAA,EAAS;IACR,IAAI,CAACN,WAAA,IAAe;MACnBO,OAAA,EAASN,KAAA,CAAMM,OAAA,GAAU,SAAY;MACrCC,cAAA,EAAgBP,KAAA,CAAMO,cAAA;MACtBC,YAAA,EAAcR,KAAA,CAAMQ,YAAA;MACpBC,WAAA,EAAaT,KAAA,CAAMS,WAAA;MACnBC,gBAAA,EAAkBV,KAAA,CAAMU,gBAAA;MAAA;MAAA;MAGxBC,qBAAA,EAAuB;MACvBN,SAAA,EAAWP,OAAA;MACXc,MAAA,EAAQZ,KAAA,CAAMY;IAChB;IAECjB;EAAA,CACH,IAKF,eAAAF,GAAA,CAACN,eAAA;IAAiB,GAAGa,KAAA;IAClBL,QAAA,EAAAQ,OAAA,IAAWJ,WAAA,GAAcJ,QAAA,GAAW;EAAA,CACvC,IAIG,eAAAF,GAAA,CAAAD,QAAA;IAAGG;EAAA,CAAS;AACrB","ignoreList":[]}
@@ -7,30 +7,34 @@ function Animate(param) {
7
7
  lazyMount,
8
8
  type,
9
9
  present,
10
+ passThrough,
10
11
  ...props
11
12
  } = param,
12
13
  [lazyMounted, setLazyMounted] = useState(lazyMount ? !1 : present);
13
14
  useEffect(function () {
14
- lazyMount && present && startTransition(function () {
15
+ passThrough || lazyMount && present && startTransition(function () {
15
16
  setLazyMounted(present);
16
17
  });
17
18
  }, [lazyMount, present]);
18
19
  var mounted = present ? lazyMount ? lazyMounted : present : !1;
19
20
  return type === "presence" ? props.keepChildrenMounted ? /* @__PURE__ */_jsx(PresenceChild, {
20
- initial: props.initial ? void 0 : !1,
21
- onExitComplete: props.onExitComplete,
22
- enterVariant: props.enterVariant,
23
- exitVariant: props.exitVariant,
24
- enterExitVariant: props.enterExitVariant,
25
- // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
26
- // but since we always re-render this component on open changes this should be fine to leave off?
27
- presenceAffectsLayout: !1,
28
- isPresent: present,
29
- custom: props.custom,
21
+ isPresent: !0,
22
+ ...(!passThrough && {
23
+ initial: props.initial ? void 0 : !1,
24
+ onExitComplete: props.onExitComplete,
25
+ enterVariant: props.enterVariant,
26
+ exitVariant: props.exitVariant,
27
+ enterExitVariant: props.enterExitVariant,
28
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
29
+ // but since we always re-render this component on open changes this should be fine to leave off?
30
+ presenceAffectsLayout: !1,
31
+ isPresent: present,
32
+ custom: props.custom
33
+ }),
30
34
  children
31
35
  }) : /* @__PURE__ */_jsx(AnimatePresence, {
32
36
  ...props,
33
- children: mounted ? children : null
37
+ children: mounted || passThrough ? children : null
34
38
  }) : /* @__PURE__ */_jsx(_Fragment, {
35
39
  children
36
40
  });
@@ -1 +1 @@
1
- {"version":3,"names":["jsx","_jsx","Fragment","_Fragment","AnimatePresence","PresenceChild","startTransition","useEffect","useState","Animate","param","children","lazyMount","type","present","props","lazyMounted","setLazyMounted","mounted","keepChildrenMounted","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","isPresent","custom"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,GAAA,IAAAC,IAAA,EAAAC,QAAiB,IAAAC,SAAA,QAAqB;AAC/C,SAASC,eAAA,EAAiBC,aAAW,mCAAgB;AA0D7C,SAoBCC,eApBD,EAAAC,SAAA,EAAAC,QAAA;AAvBD,SAASC,QAAQC,KAAA;EACtB;MAAAC,QAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,OAAA;MAAA,GAAAC;IAAA,IAAAL,KAAA;IAAA,CAAAM,WAAA,EAAAC,cAAA,IAAAT,QAAA,CAAAI,SAAA,QAAAE,OAAA;EACAP,SAAA;IACAK,SAAA,IAAAE,OAAA,IAAAR,eAAA;MACAW,cAAA,CAAAH,OAAA;IACA,CAAG;EACL,CAAkC,GAChCF,SAAO,EAEPE,OAAA,CACE,CAAK;EAGH,IAAAI,OAAA,GAAAJ,OAAe,GAAAF,SAAO,GAAAI,WAAA,GAAAF,OAAA;EAAA,OACvBD,IAAA,kBAAAE,KAAA,CAAAI,mBAAA,kBAAAlB,IAAA,CAAAI,aAAA;IACHe,OAAI,EAAAL,KAAW,CAAAK,OAAQ;IAGvBC,cAAiB,EAAAN,KAAA,CAAAM,cAA8B;IAE/CC,YAAI,EAASP,KAAA,CAAAO,YACP;IAECC,WAAA,EAAAR,KAAA,CAAAQ,WAAA;IAAAC,gBAAA,EAAAT,KAAA,CAAAS,gBAAA;IAAA;IACsC;IACfC,qBACR,EAAM;IAAAC,SACpB,EAAAZ,OAAa;IAAMa,MACnB,EAAAZ,KAAA,CAAAY,MAAkB;IAAMhB;EAGD,KACvB,eAAWV,IAAA,CAAAG,eAAA;IAAA,GACXW,KAAA;IAAcJ,QAEb,EAAAO,OAAA,GAAAP,QAAA;EAAA,oBAAAV,IAAA,CAAAE,SAAA;IACHQ;EAQR","ignoreList":[]}
1
+ {"version":3,"names":["jsx","_jsx","Fragment","_Fragment","AnimatePresence","PresenceChild","startTransition","useEffect","useState","Animate","param","children","lazyMount","type","present","passThrough","props","lazyMounted","setLazyMounted","mounted","keepChildrenMounted","isPresent","initial","onExitComplete","enterVariant","exitVariant","enterExitVariant","presenceAffectsLayout","custom"],"sources":["../../src/Animate.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,GAAA,IAAAC,IAAA,EAAAC,QAAiB,IAAAC,SAAA,QAAqB;AAC/C,SAASC,eAAA,EAAiBC,aAAW,mCAAgB;AA4D7C,SA2BCC,eA3BD,EAAAC,SAAA,EAAAC,QAAA;AAzBD,SAASC,QAAQC,KAAA;EACtB;MAAAC,QAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,OAAA;MAAAC,WAAA;MAAA,GAAAC;IAAA,IAAAN,KAAA;IAAA,CAAAO,WAAA,EAAAC,cAAA,IAAAV,QAAA,CAAAI,SAAA,QAAAE,OAAA;EACAP,SAAA;IACAQ,WAAA,IAAAH,SAAA,IAAAE,OAAA,IAAAR,eAAA;MACAY,cAAA,CAAAJ,OAAA;IACA;EACA,GAAG,CAC6BF,SAAA,EAChCE,OAAO,CAEP;EACE,IAAIK,OAAA,GAAAL,OACC,GAAAF,SACA,GAAAK,WACL,GAAAH,OAAgB;EACd,OAAAD,IAAA,eAAsB,GAAAG,KAAA,CAAAI,mBAAA,kBAAAnB,IAAA,CAAAI,aAAA;IACxBgB,SAAC;IACH,IAAI,CAAAN,WAAW;MAGfO,OAAM,EAAAN,KAAW,CAAAM,OAAkB,YAAY;MAE/CC,cAAa,EAAAP,KAAA,CAAAO,cACD;MAELC,YAAA,EAAAR,KAAA,CAAAQ,YAAA;MAAAC,WAAA,EAAAT,KAAA,CAAAS,WAAA;MACCC,gBAAS,EAAAV,KAAA,CAAAU,gBAAA;MACR;MAAoB;MACkBC,qBACrB,GAAM;MAAAN,SACtB,EAAAP,OAAc;MAAMc,MACpB,EAAAZ,KAAA,CAAAY;IAAmB;IACKjB;EAAA,oBAAAV,IAAA,CAAAG,eAAA;IAAA,GAAAY,KAGxB;IAAuBL,QACvB,EAAAQ,OAAW,IAAAJ,WAAA,GAAAJ,QAAA;EAAA,oBACGV,IAAA,CAAAE,SAAA;IAAAQ;EAChB;AAEC;AAAA,SAaXF,OAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/animate",
3
- "version": "1.129.19",
3
+ "version": "1.130.1",
4
4
  "source": "src/index.ts",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -13,10 +13,10 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@tamagui/animate-presence": "1.129.19"
16
+ "@tamagui/animate-presence": "1.130.1"
17
17
  },
18
18
  "devDependencies": {
19
- "@tamagui/build": "1.129.19"
19
+ "@tamagui/build": "1.130.1"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "tamagui-build",
package/src/Animate.tsx CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { AnimatePresenceProps } from '@tamagui/animate-presence'
2
2
  import { AnimatePresence, PresenceChild } from '@tamagui/animate-presence'
3
3
  import { startTransition, useEffect, useState } from 'react'
4
- import type { JSX } from 'react/jsx-runtime'
5
4
 
6
5
  type BaseProps = {
7
6
  children: React.ReactNode
7
+ passThrough?: boolean
8
8
  }
9
9
 
10
10
  type PresenceProps = AnimatePresenceProps & {
@@ -40,11 +40,13 @@ export function Animate({
40
40
  lazyMount,
41
41
  type,
42
42
  present,
43
+ passThrough,
43
44
  ...props
44
45
  }: AnimateProps): React.ReactNode {
45
46
  const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present)
46
47
 
47
48
  useEffect(() => {
49
+ if (passThrough) return
48
50
  if (!lazyMount) return
49
51
  if (!present) return
50
52
  startTransition(() => {
@@ -59,23 +61,30 @@ export function Animate({
59
61
  if (props.keepChildrenMounted) {
60
62
  return (
61
63
  <PresenceChild
62
- initial={props.initial ? undefined : false}
63
- onExitComplete={props.onExitComplete}
64
- enterVariant={props.enterVariant}
65
- exitVariant={props.exitVariant}
66
- enterExitVariant={props.enterExitVariant}
67
- // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
68
- // but since we always re-render this component on open changes this should be fine to leave off?
69
- presenceAffectsLayout={false}
70
- isPresent={present}
71
- custom={props.custom}
64
+ isPresent
65
+ {...(!passThrough && {
66
+ initial: props.initial ? undefined : false,
67
+ onExitComplete: props.onExitComplete,
68
+ enterVariant: props.enterVariant,
69
+ exitVariant: props.exitVariant,
70
+ enterExitVariant: props.enterExitVariant,
71
+ // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu
72
+ // but since we always re-render this component on open changes this should be fine to leave off?
73
+ presenceAffectsLayout: false,
74
+ isPresent: present,
75
+ custom: props.custom,
76
+ })}
72
77
  >
73
78
  {children as any}
74
79
  </PresenceChild>
75
80
  )
76
81
  }
77
82
 
78
- return <AnimatePresence {...props}>{mounted ? children : null}</AnimatePresence>
83
+ return (
84
+ <AnimatePresence {...props}>
85
+ {mounted || passThrough ? children : null}
86
+ </AnimatePresence>
87
+ )
79
88
  }
80
89
 
81
90
  return <>{children}</>
@@ -1,6 +1,7 @@
1
1
  import type { AnimatePresenceProps } from "@tamagui/animate-presence";
2
2
  type BaseProps = {
3
3
  children: React.ReactNode;
4
+ passThrough?: boolean;
4
5
  };
5
6
  type PresenceProps = AnimatePresenceProps & {
6
7
  type: "presence";
@@ -27,7 +28,7 @@ export type AnimateProps = BaseProps & PresenceProps;
27
28
  *
28
29
  *
29
30
  */
30
- export declare function Animate({ children, lazyMount, type, present,...props }: AnimateProps): React.ReactNode;
31
+ export declare function Animate({ children, lazyMount, type, present, passThrough,...props }: AnimateProps): React.ReactNode;
31
32
  export {};
32
33
 
33
34
  //# sourceMappingURL=Animate.d.ts.map
@@ -1,11 +1,11 @@
1
1
  {
2
- "mappings": "AAAA,cAAc,4BAA4B,2BAA2B;KAKhE,YAAY;CACf,UAAU,MAAM;AACjB;KAEI,gBAAgB,uBAAuB;CAC1C,MAAM;CACN;CACA;CACA;AACD;AAED,YAAY,eAAe,YAAY;;;;;;;;;;;;;;;;;;;AAqBvC,OAAO,iBAAS,QAAQ,EACtB,UACA,WACA,MACA,QACA,GAAG,OACU,EAAZ,eAAe,MAAM",
2
+ "mappings": "AAAA,cAAc,4BAA4B,2BAA2B;KAIhE,YAAY;CACf,UAAU,MAAM;CAChB;AACD;KAEI,gBAAgB,uBAAuB;CAC1C,MAAM;CACN;CACA;CACA;AACD;AAED,YAAY,eAAe,YAAY;;;;;;;;;;;;;;;;;;;AAqBvC,OAAO,iBAAS,QAAQ,EACtB,UACA,WACA,MACA,SACA,YACA,GAAG,OACU,EAAZ,eAAe,MAAM",
3
3
  "names": [],
4
4
  "sources": [
5
5
  "src/Animate.tsx"
6
6
  ],
7
7
  "sourcesContent": [
8
- "import type { AnimatePresenceProps } from '@tamagui/animate-presence'\nimport { AnimatePresence, PresenceChild } from '@tamagui/animate-presence'\nimport { startTransition, useEffect, useState } from 'react'\nimport type { JSX } from 'react/jsx-runtime'\n\ntype BaseProps = {\n children: React.ReactNode\n}\n\ntype PresenceProps = AnimatePresenceProps & {\n type: 'presence'\n present: boolean\n keepChildrenMounted?: boolean\n lazyMount?: boolean\n}\n\nexport type AnimateProps = BaseProps & PresenceProps\n\n/**\n * Because mounting and unmounting children can be expensive, this gives us the\n * option to avoid that.\n *\n * type: 'presence' will act just like AnimatePresence, except you use `present`\n * instead of conditional children.\n * Note that this does avoid reconciling the children even when present={false}\n * so no extra cost to perf over AnimatePresence.\n *\n * type: 'presence' with keepChildrenMounted true *always* render the children so you pay\n * the cost up-front to mount them, but then you avoid the mount cost at the start\n * of the animation.\n *\n * There's no \"right way\" it just depends on the use case, this component just makes\n * it easier to choose the strategy yourself.\n *\n *\n */\n\nexport function Animate({\n children,\n lazyMount,\n type,\n present,\n ...props\n}: AnimateProps): React.ReactNode {\n const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present)\n\n useEffect(() => {\n if (!lazyMount) return\n if (!present) return\n startTransition(() => {\n setLazyMounted(present)\n })\n }, [lazyMount, present])\n\n // always immediately unmount\n const mounted = !present ? false : lazyMount ? lazyMounted : present\n\n if (type === 'presence') {\n if (props.keepChildrenMounted) {\n return (\n <PresenceChild\n initial={props.initial ? undefined : false}\n onExitComplete={props.onExitComplete}\n enterVariant={props.enterVariant}\n exitVariant={props.exitVariant}\n enterExitVariant={props.enterExitVariant}\n // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu\n // but since we always re-render this component on open changes this should be fine to leave off?\n presenceAffectsLayout={false}\n isPresent={present}\n custom={props.custom}\n >\n {children as any}\n </PresenceChild>\n )\n }\n\n return <AnimatePresence {...props}>{mounted ? children : null}</AnimatePresence>\n }\n\n return <>{children}</>\n}\n"
8
+ "import type { AnimatePresenceProps } from '@tamagui/animate-presence'\nimport { AnimatePresence, PresenceChild } from '@tamagui/animate-presence'\nimport { startTransition, useEffect, useState } from 'react'\n\ntype BaseProps = {\n children: React.ReactNode\n passThrough?: boolean\n}\n\ntype PresenceProps = AnimatePresenceProps & {\n type: 'presence'\n present: boolean\n keepChildrenMounted?: boolean\n lazyMount?: boolean\n}\n\nexport type AnimateProps = BaseProps & PresenceProps\n\n/**\n * Because mounting and unmounting children can be expensive, this gives us the\n * option to avoid that.\n *\n * type: 'presence' will act just like AnimatePresence, except you use `present`\n * instead of conditional children.\n * Note that this does avoid reconciling the children even when present={false}\n * so no extra cost to perf over AnimatePresence.\n *\n * type: 'presence' with keepChildrenMounted true *always* render the children so you pay\n * the cost up-front to mount them, but then you avoid the mount cost at the start\n * of the animation.\n *\n * There's no \"right way\" it just depends on the use case, this component just makes\n * it easier to choose the strategy yourself.\n *\n *\n */\n\nexport function Animate({\n children,\n lazyMount,\n type,\n present,\n passThrough,\n ...props\n}: AnimateProps): React.ReactNode {\n const [lazyMounted, setLazyMounted] = useState(lazyMount ? false : present)\n\n useEffect(() => {\n if (passThrough) return\n if (!lazyMount) return\n if (!present) return\n startTransition(() => {\n setLazyMounted(present)\n })\n }, [lazyMount, present])\n\n // always immediately unmount\n const mounted = !present ? false : lazyMount ? lazyMounted : present\n\n if (type === 'presence') {\n if (props.keepChildrenMounted) {\n return (\n <PresenceChild\n isPresent\n {...(!passThrough && {\n initial: props.initial ? undefined : false,\n onExitComplete: props.onExitComplete,\n enterVariant: props.enterVariant,\n exitVariant: props.exitVariant,\n enterExitVariant: props.enterExitVariant,\n // BUGFIX: this causes continous re-renders if keepChildrenMounted is true, see HeaderMenu\n // but since we always re-render this component on open changes this should be fine to leave off?\n presenceAffectsLayout: false,\n isPresent: present,\n custom: props.custom,\n })}\n >\n {children as any}\n </PresenceChild>\n )\n }\n\n return (\n <AnimatePresence {...props}>\n {mounted || passThrough ? children : null}\n </AnimatePresence>\n )\n }\n\n return <>{children}</>\n}\n"
9
9
  ],
10
10
  "version": 3
11
11
  }