@tamagui/animate 1.129.19 → 1.130.0
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/Animate.cjs +16 -10
- package/dist/cjs/Animate.js +16 -10
- package/dist/cjs/Animate.js.map +1 -1
- package/dist/cjs/Animate.native.js +16 -13
- package/dist/cjs/Animate.native.js.map +2 -2
- package/dist/esm/Animate.js +16 -10
- package/dist/esm/Animate.js.map +1 -1
- package/dist/esm/Animate.mjs +16 -10
- package/dist/esm/Animate.mjs.map +1 -1
- package/dist/esm/Animate.native.js +16 -12
- package/dist/esm/Animate.native.js.map +1 -1
- package/package.json +3 -3
- package/src/Animate.tsx +21 -12
- package/types/Animate.d.ts +2 -1
- package/types/Animate.d.ts.map +2 -2
package/dist/cjs/Animate.cjs
CHANGED
|
@@ -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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
});
|
package/dist/cjs/Animate.js
CHANGED
|
@@ -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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
package/dist/cjs/Animate.js.map
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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,
|
|
5
|
-
"names": ["Animate", "children", "lazyMount", "type", "present", "props", "lazyMounted", "setLazyMounted", "useState", "useEffect", "startTransition", "mounted", "keepChildrenMounted", "_jsx", "PresenceChild", "initial", "undefined", "onExitComplete", "enterVariant", "exitVariant", "enterExitVariant", "presenceAffectsLayout", "
|
|
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
|
}
|
package/dist/esm/Animate.js
CHANGED
|
@@ -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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
package/dist/esm/Animate.js.map
CHANGED
|
@@ -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;
|
|
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
|
}
|
package/dist/esm/Animate.mjs
CHANGED
|
@@ -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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
});
|
package/dist/esm/Animate.mjs.map
CHANGED
|
@@ -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","
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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","
|
|
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.
|
|
3
|
+
"version": "1.130.0",
|
|
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.
|
|
16
|
+
"@tamagui/animate-presence": "1.130.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tamagui/build": "1.
|
|
19
|
+
"@tamagui/build": "1.130.0"
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
83
|
+
return (
|
|
84
|
+
<AnimatePresence {...props}>
|
|
85
|
+
{mounted || passThrough ? children : null}
|
|
86
|
+
</AnimatePresence>
|
|
87
|
+
)
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
return <>{children}</>
|
package/types/Animate.d.ts
CHANGED
|
@@ -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
|
package/types/Animate.d.ts.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mappings": "AAAA,cAAc,4BAA4B,2BAA2B;
|
|
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'\
|
|
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
|
}
|