@multiplatform.one/theme 10.11.0 → 10.12.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/theme/nativeTransitionProps.cjs +2 -2
- package/dist/cjs/theme/nativeTransitionProps.native.cjs +3 -2
- package/dist/cjs/theme/nativeTransitionProps.native.js +3 -2
- package/dist/cjs/theme/nativeTransitionProps.native.js.map +1 -1
- package/dist/esm/theme/nativeTransitionProps.mjs +2 -2
- package/dist/esm/theme/nativeTransitionProps.mjs.map +1 -1
- package/dist/esm/theme/nativeTransitionProps.native.js +3 -2
- package/dist/esm/theme/nativeTransitionProps.native.js.map +1 -1
- package/package.json +5 -5
- package/src/theme/nativeTransitionProps.hooks.spec.tsx +64 -0
- package/src/theme/nativeTransitionProps.ts +5 -4
- package/src/theme/transitionProps.spec.ts +9 -3
- package/types/theme/nativeTransitionProps.d.ts +2 -2
- package/types/theme/nativeTransitionProps.d.ts.map +1 -1
|
@@ -24,8 +24,7 @@ module.exports = __toCommonJS(nativeTransitionProps_exports);
|
|
|
24
24
|
var import_reactNative = require("./animations/reactNative.cjs");
|
|
25
25
|
function transitionProps(role, extra = []) {
|
|
26
26
|
const isRole = isMotionRole(role);
|
|
27
|
-
const transition = isRole ? role.transition : role;
|
|
28
|
-
if (transition === void 0) return {};
|
|
27
|
+
const transition = (isRole ? role.transition : role) ?? instant;
|
|
29
28
|
if (!isRole) return { transition };
|
|
30
29
|
const properties = [...role.animateOnly, ...extra].flatMap((property) => nativeLonghands[property] ?? [property]).join(", ");
|
|
31
30
|
if (typeof transition !== "string") return { transition: {
|
|
@@ -44,6 +43,7 @@ function transitionProps(role, extra = []) {
|
|
|
44
43
|
} } : {}
|
|
45
44
|
} };
|
|
46
45
|
}
|
|
46
|
+
const instant = "0ms";
|
|
47
47
|
function isSpring(stop) {
|
|
48
48
|
const config = import_reactNative.animationConfig[stop];
|
|
49
49
|
return config !== void 0 && config.type !== "timing";
|
|
@@ -26,9 +26,9 @@ module.exports = __toCommonJS(nativeTransitionProps_exports);
|
|
|
26
26
|
var import_reactNative = require("./animations/reactNative.native.js");
|
|
27
27
|
function transitionProps(role) {
|
|
28
28
|
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
29
|
+
var _ref;
|
|
29
30
|
var isRole = isMotionRole(role);
|
|
30
|
-
var transition = isRole ? role.transition : role;
|
|
31
|
-
if (transition === void 0) return {};
|
|
31
|
+
var transition = (_ref = isRole ? role.transition : role) !== null && _ref !== void 0 ? _ref : instant;
|
|
32
32
|
if (!isRole) return { transition };
|
|
33
33
|
var properties = [...role.animateOnly, ...extra].flatMap(function(property) {
|
|
34
34
|
var _nativeLonghands_property;
|
|
@@ -50,6 +50,7 @@ function transitionProps(role) {
|
|
|
50
50
|
} } : {}
|
|
51
51
|
} };
|
|
52
52
|
}
|
|
53
|
+
var instant = "0ms";
|
|
53
54
|
function isSpring(stop) {
|
|
54
55
|
var config = import_reactNative.animationConfig[stop];
|
|
55
56
|
return config !== void 0 && config.type !== "timing";
|
|
@@ -26,9 +26,9 @@ module.exports = __toCommonJS(nativeTransitionProps_exports);
|
|
|
26
26
|
var import_reactNative = require("./animations/reactNative.native.js");
|
|
27
27
|
function transitionProps(role) {
|
|
28
28
|
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
29
|
+
var _ref;
|
|
29
30
|
var isRole = isMotionRole(role);
|
|
30
|
-
var transition = isRole ? role.transition : role;
|
|
31
|
-
if (transition === void 0) return {};
|
|
31
|
+
var transition = (_ref = isRole ? role.transition : role) !== null && _ref !== void 0 ? _ref : instant;
|
|
32
32
|
if (!isRole) return { transition };
|
|
33
33
|
var properties = [...role.animateOnly, ...extra].flatMap(function(property) {
|
|
34
34
|
var _nativeLonghands_property;
|
|
@@ -50,6 +50,7 @@ function transitionProps(role) {
|
|
|
50
50
|
} } : {}
|
|
51
51
|
} };
|
|
52
52
|
}
|
|
53
|
+
var instant = "0ms";
|
|
53
54
|
function isSpring(stop) {
|
|
54
55
|
var config = import_reactNative.animationConfig[stop];
|
|
55
56
|
return config !== void 0 && config.type !== "timing";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeTransitionProps.native.js","names":[],"sources":["cjs/theme/nativeTransitionProps.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar nativeTransitionProps_exports = {};\n__export(nativeTransitionProps_exports, {\n transitionProps: () => transitionProps\n});\nmodule.exports = __toCommonJS(nativeTransitionProps_exports);\nvar import_reactNative = require(\"./animations/reactNative\");\nfunction transitionProps(role) {\n var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];\n var isRole = isMotionRole(role);\n var transition = isRole ? role.transition : role
|
|
1
|
+
{"version":3,"file":"nativeTransitionProps.native.js","names":[],"sources":["cjs/theme/nativeTransitionProps.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar nativeTransitionProps_exports = {};\n__export(nativeTransitionProps_exports, {\n transitionProps: () => transitionProps\n});\nmodule.exports = __toCommonJS(nativeTransitionProps_exports);\nvar import_reactNative = require(\"./animations/reactNative\");\nfunction transitionProps(role) {\n var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];\n var _ref;\n var isRole = isMotionRole(role);\n var transition = (_ref = isRole ? role.transition : role) !== null && _ref !== void 0 ? _ref : instant;\n if (!isRole) return {\n transition\n };\n var properties = [\n ...role.animateOnly,\n ...extra\n ].flatMap(function(property) {\n var _nativeLonghands_property;\n return (_nativeLonghands_property = nativeLonghands[property]) !== null && _nativeLonghands_property !== void 0 ? _nativeLonghands_property : [\n property\n ];\n }).join(\", \");\n if (typeof transition !== \"string\") return {\n transition: {\n ...transition,\n properties\n }\n };\n var exit = typeof role.exit === \"string\" && role.exit !== transition ? role.exit : void 0;\n var clamp = isSpring(transition) && !presetBounce.has(transition);\n return {\n transition: {\n preset: transition,\n properties,\n ...clamp ? {\n spring: {\n overshootClamping: true\n }\n } : {},\n ...exit ? {\n exit: {\n preset: exit,\n properties\n }\n } : {}\n }\n };\n}\nvar instant = \"0ms\";\nfunction isSpring(stop) {\n var config = import_reactNative.animationConfig[stop];\n return config !== void 0 && config.type !== \"timing\";\n}\nvar presetBounce = /* @__PURE__ */ new Set([\n \"bouncy\",\n \"superBouncy\"\n]);\nvar nativeLonghands = {\n borderColor: [\n \"borderColor\",\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\"\n ]\n};\nfunction isMotionRole(value) {\n return typeof value === \"object\" && value !== null && \"transition\" in value && \"animateOnly\" in value && Array.isArray(value.animateOnly);\n}\n//# sourceMappingURL=nativeTransitionProps.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gCAAgC,CAAC;AACrC,SAAS,+BAA+B,EACtC,uBAAuB,gBACzB,CAAC;AACD,OAAO,UAAU,aAAa,6BAA6B;AAC3D,IAAI,qBAAqB,QAAQ,oCAA0B;AAC3D,SAAS,gBAAgB,MAAM;CAC7B,IAAI,QAAQ,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAC9E,IAAI;CACJ,IAAI,SAAS,aAAa,IAAI;CAC9B,IAAI,cAAc,OAAO,SAAS,KAAK,aAAa,UAAU,QAAQ,SAAS,KAAK,IAAI,OAAO;CAC/F,IAAI,CAAC,QAAQ,OAAO,EAClB,WACF;CACA,IAAI,aAAa,CACf,GAAG,KAAK,aACR,GAAG,KACL,CAAC,CAAC,QAAQ,SAAS,UAAU;EAC3B,IAAI;EACJ,QAAQ,4BAA4B,gBAAgB,eAAe,QAAQ,8BAA8B,KAAK,IAAI,4BAA4B,CAC5I,QACF;CACF,CAAC,CAAC,CAAC,KAAK,IAAI;CACZ,IAAI,OAAO,eAAe,UAAU,OAAO,EACzC,YAAY;EACV,GAAG;EACH;CACF,EACF;CACA,IAAI,OAAO,OAAO,KAAK,SAAS,YAAY,KAAK,SAAS,aAAa,KAAK,OAAO,KAAK;CACxF,IAAI,QAAQ,SAAS,UAAU,KAAK,CAAC,aAAa,IAAI,UAAU;CAChE,OAAO,EACL,YAAY;EACV,QAAQ;EACR;EACA,GAAG,QAAQ,EACT,QAAQ,EACN,mBAAmB,KACrB,EACF,IAAI,CAAC;EACL,GAAG,OAAO,EACR,MAAM;GACJ,QAAQ;GACR;EACF,EACF,IAAI,CAAC;CACP,EACF;AACF;AACA,IAAI,UAAU;AACd,SAAS,SAAS,MAAM;CACtB,IAAI,SAAS,mBAAmB,gBAAgB;CAChD,OAAO,WAAW,KAAK,KAAK,OAAO,SAAS;AAC9C;AACA,IAAI,+BAA+B,IAAI,IAAI,CACzC,UACA,aACF,CAAC;AACD,IAAI,kBAAkB,EACpB,aAAa;CACX;CACA;CACA;CACA;CACA;AACF,EACF;AACA,SAAS,aAAa,OAAO;CAC3B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,gBAAgB,SAAS,iBAAiB,SAAS,MAAM,QAAQ,MAAM,WAAW;AAC1I"}
|
|
@@ -2,8 +2,7 @@ import { animationConfig } from "./animations/reactNative.mjs";
|
|
|
2
2
|
|
|
3
3
|
function transitionProps(role, extra = []) {
|
|
4
4
|
const isRole = isMotionRole(role);
|
|
5
|
-
const transition = isRole ? role.transition : role;
|
|
6
|
-
if (transition === void 0) return {};
|
|
5
|
+
const transition = (isRole ? role.transition : role) ?? instant;
|
|
7
6
|
if (!isRole) return { transition };
|
|
8
7
|
const properties = [...role.animateOnly, ...extra].flatMap((property) => nativeLonghands[property] ?? [property]).join(", ");
|
|
9
8
|
if (typeof transition !== "string") return { transition: {
|
|
@@ -22,6 +21,7 @@ function transitionProps(role, extra = []) {
|
|
|
22
21
|
} } : {}
|
|
23
22
|
} };
|
|
24
23
|
}
|
|
24
|
+
const instant = "0ms";
|
|
25
25
|
function isSpring(stop) {
|
|
26
26
|
const config = animationConfig[stop];
|
|
27
27
|
return config !== void 0 && config.type !== "timing";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeTransitionProps.js","names":["nativeAnimationConfig"],"sources":["esm/theme/nativeTransitionProps.js"],"sourcesContent":["import { animationConfig as nativeAnimationConfig } from \"./animations/reactNative\";\nfunction transitionProps(role, extra = []) {\n const isRole = isMotionRole(role);\n const transition = isRole ? role.transition : role
|
|
1
|
+
{"version":3,"file":"nativeTransitionProps.js","names":["nativeAnimationConfig"],"sources":["esm/theme/nativeTransitionProps.js"],"sourcesContent":["import { animationConfig as nativeAnimationConfig } from \"./animations/reactNative\";\nfunction transitionProps(role, extra = []) {\n const isRole = isMotionRole(role);\n const transition = (isRole ? role.transition : role) ?? instant;\n if (!isRole) return { transition };\n const properties = [...role.animateOnly, ...extra].flatMap((property) => nativeLonghands[property] ?? [property]).join(\", \");\n if (typeof transition !== \"string\") return { transition: { ...transition, properties } };\n const exit = typeof role.exit === \"string\" && role.exit !== transition ? role.exit : void 0;\n const clamp = isSpring(transition) && !presetBounce.has(transition);\n return {\n transition: {\n preset: transition,\n properties,\n ...clamp ? { spring: { overshootClamping: true } } : {},\n ...exit ? { exit: { preset: exit, properties } } : {}\n }\n };\n}\nconst instant = \"0ms\";\nfunction isSpring(stop) {\n const config = nativeAnimationConfig[stop];\n return config !== void 0 && config.type !== \"timing\";\n}\nconst presetBounce = /* @__PURE__ */ new Set([\"bouncy\", \"superBouncy\"]);\nconst nativeLonghands = {\n borderColor: [\n \"borderColor\",\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\"\n ]\n};\nfunction isMotionRole(value) {\n return typeof value === \"object\" && value !== null && \"transition\" in value && \"animateOnly\" in value && Array.isArray(value.animateOnly);\n}\nexport {\n transitionProps\n};\n//# sourceMappingURL=nativeTransitionProps.js.map\n"],"mappings":";;;AACA,SAAS,gBAAgB,MAAM,QAAQ,CAAC,GAAG;CACzC,MAAM,SAAS,aAAa,IAAI;CAChC,MAAM,cAAc,SAAS,KAAK,aAAa,SAAS;CACxD,IAAI,CAAC,QAAQ,OAAO,EAAE,WAAW;CACjC,MAAM,aAAa,CAAC,GAAG,KAAK,aAAa,GAAG,KAAK,CAAC,CAAC,SAAS,aAAa,gBAAgB,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI;CAC3H,IAAI,OAAO,eAAe,UAAU,OAAO,EAAE,YAAY;EAAE,GAAG;EAAY;CAAW,EAAE;CACvF,MAAM,OAAO,OAAO,KAAK,SAAS,YAAY,KAAK,SAAS,aAAa,KAAK,OAAO,KAAK;CAC1F,MAAM,QAAQ,SAAS,UAAU,KAAK,CAAC,aAAa,IAAI,UAAU;CAClE,OAAO,EACL,YAAY;EACV,QAAQ;EACR;EACA,GAAG,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,KAAK,EAAE,IAAI,CAAC;EACtD,GAAG,OAAO,EAAE,MAAM;GAAE,QAAQ;GAAM;EAAW,EAAE,IAAI,CAAC;CACtD,EACF;AACF;AACA,MAAM,UAAU;AAChB,SAAS,SAAS,MAAM;CACtB,MAAM,SAASA,gBAAsB;CACrC,OAAO,WAAW,KAAK,KAAK,OAAO,SAAS;AAC9C;AACA,MAAM,+BAA+B,IAAI,IAAI,CAAC,UAAU,aAAa,CAAC;AACtE,MAAM,kBAAkB,EACtB,aAAa;CACX;CACA;CACA;CACA;CACA;AACF,EACF;AACA,SAAS,aAAa,OAAO;CAC3B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,gBAAgB,SAAS,iBAAiB,SAAS,MAAM,QAAQ,MAAM,WAAW;AAC1I"}
|
|
@@ -2,9 +2,9 @@ import { animationConfig } from "./animations/reactNative.native.js";
|
|
|
2
2
|
|
|
3
3
|
function transitionProps(role) {
|
|
4
4
|
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
5
|
+
var _ref;
|
|
5
6
|
var isRole = isMotionRole(role);
|
|
6
|
-
var transition = isRole ? role.transition : role;
|
|
7
|
-
if (transition === void 0) return {};
|
|
7
|
+
var transition = (_ref = isRole ? role.transition : role) !== null && _ref !== void 0 ? _ref : instant;
|
|
8
8
|
if (!isRole) return { transition };
|
|
9
9
|
var properties = [...role.animateOnly, ...extra].flatMap(function(property) {
|
|
10
10
|
var _nativeLonghands_property;
|
|
@@ -26,6 +26,7 @@ function transitionProps(role) {
|
|
|
26
26
|
} } : {}
|
|
27
27
|
} };
|
|
28
28
|
}
|
|
29
|
+
var instant = "0ms";
|
|
29
30
|
function isSpring(stop) {
|
|
30
31
|
var config = animationConfig[stop];
|
|
31
32
|
return config !== void 0 && config.type !== "timing";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeTransitionProps.native.js","names":["nativeAnimationConfig"],"sources":["esm/theme/nativeTransitionProps.native.js"],"sourcesContent":["import { animationConfig as nativeAnimationConfig } from \"./animations/reactNative\";\nfunction transitionProps(role) {\n var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];\n var isRole = isMotionRole(role);\n var transition = isRole ? role.transition : role
|
|
1
|
+
{"version":3,"file":"nativeTransitionProps.native.js","names":["nativeAnimationConfig"],"sources":["esm/theme/nativeTransitionProps.native.js"],"sourcesContent":["import { animationConfig as nativeAnimationConfig } from \"./animations/reactNative\";\nfunction transitionProps(role) {\n var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];\n var _ref;\n var isRole = isMotionRole(role);\n var transition = (_ref = isRole ? role.transition : role) !== null && _ref !== void 0 ? _ref : instant;\n if (!isRole) return {\n transition\n };\n var properties = [\n ...role.animateOnly,\n ...extra\n ].flatMap(function(property) {\n var _nativeLonghands_property;\n return (_nativeLonghands_property = nativeLonghands[property]) !== null && _nativeLonghands_property !== void 0 ? _nativeLonghands_property : [\n property\n ];\n }).join(\", \");\n if (typeof transition !== \"string\") return {\n transition: {\n ...transition,\n properties\n }\n };\n var exit = typeof role.exit === \"string\" && role.exit !== transition ? role.exit : void 0;\n var clamp = isSpring(transition) && !presetBounce.has(transition);\n return {\n transition: {\n preset: transition,\n properties,\n ...clamp ? {\n spring: {\n overshootClamping: true\n }\n } : {},\n ...exit ? {\n exit: {\n preset: exit,\n properties\n }\n } : {}\n }\n };\n}\nvar instant = \"0ms\";\nfunction isSpring(stop) {\n var config = nativeAnimationConfig[stop];\n return config !== void 0 && config.type !== \"timing\";\n}\nvar presetBounce = /* @__PURE__ */ new Set([\n \"bouncy\",\n \"superBouncy\"\n]);\nvar nativeLonghands = {\n borderColor: [\n \"borderColor\",\n \"borderTopColor\",\n \"borderRightColor\",\n \"borderBottomColor\",\n \"borderLeftColor\"\n ]\n};\nfunction isMotionRole(value) {\n return typeof value === \"object\" && value !== null && \"transition\" in value && \"animateOnly\" in value && Array.isArray(value.animateOnly);\n}\nexport {\n transitionProps\n};\n//# sourceMappingURL=nativeTransitionProps.js.map\n"],"mappings":";;;AACA,SAAS,gBAAgB,MAAM;CAC7B,IAAI,QAAQ,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAC9E,IAAI;CACJ,IAAI,SAAS,aAAa,IAAI;CAC9B,IAAI,cAAc,OAAO,SAAS,KAAK,aAAa,UAAU,QAAQ,SAAS,KAAK,IAAI,OAAO;CAC/F,IAAI,CAAC,QAAQ,OAAO,EAClB,WACF;CACA,IAAI,aAAa,CACf,GAAG,KAAK,aACR,GAAG,KACL,CAAC,CAAC,QAAQ,SAAS,UAAU;EAC3B,IAAI;EACJ,QAAQ,4BAA4B,gBAAgB,eAAe,QAAQ,8BAA8B,KAAK,IAAI,4BAA4B,CAC5I,QACF;CACF,CAAC,CAAC,CAAC,KAAK,IAAI;CACZ,IAAI,OAAO,eAAe,UAAU,OAAO,EACzC,YAAY;EACV,GAAG;EACH;CACF,EACF;CACA,IAAI,OAAO,OAAO,KAAK,SAAS,YAAY,KAAK,SAAS,aAAa,KAAK,OAAO,KAAK;CACxF,IAAI,QAAQ,SAAS,UAAU,KAAK,CAAC,aAAa,IAAI,UAAU;CAChE,OAAO,EACL,YAAY;EACV,QAAQ;EACR;EACA,GAAG,QAAQ,EACT,QAAQ,EACN,mBAAmB,KACrB,EACF,IAAI,CAAC;EACL,GAAG,OAAO,EACR,MAAM;GACJ,QAAQ;GACR;EACF,EACF,IAAI,CAAC;CACP,EACF;AACF;AACA,IAAI,UAAU;AACd,SAAS,SAAS,MAAM;CACtB,IAAI,SAASA,gBAAsB;CACnC,OAAO,WAAW,KAAK,KAAK,OAAO,SAAS;AAC9C;AACA,IAAI,+BAA+B,IAAI,IAAI,CACzC,UACA,aACF,CAAC;AACD,IAAI,kBAAkB,EACpB,aAAa;CACX;CACA;CACA;CACA;CACA;AACF,EACF;AACA,SAAS,aAAa,OAAO;CAC3B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,gBAAgB,SAAS,iBAAiB,SAAS,MAAM,QAAQ,MAAM,WAAW;AAC1I"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/theme",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.12.0",
|
|
4
4
|
"description": "Tamagui theme system for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multiplatform",
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"access": "public"
|
|
164
164
|
},
|
|
165
165
|
"dependencies": {
|
|
166
|
-
"@multiplatform.one/platform": "^10.
|
|
167
|
-
"@multiplatform.one/store": "^10.
|
|
166
|
+
"@multiplatform.one/platform": "^10.12.0",
|
|
167
|
+
"@multiplatform.one/store": "^10.12.0",
|
|
168
168
|
"@tamagui/animations-react-native": "3.2.3",
|
|
169
169
|
"@tamagui/colors": "3.2.3",
|
|
170
170
|
"@tamagui/config": "3.2.3",
|
|
@@ -178,8 +178,8 @@
|
|
|
178
178
|
},
|
|
179
179
|
"devDependencies": {
|
|
180
180
|
"@expo/prebuild-config": "58.0.19",
|
|
181
|
-
"@multiplatform.one/config": "10.
|
|
182
|
-
"@multiplatform.one/test-utils": "10.
|
|
181
|
+
"@multiplatform.one/config": "10.12.0",
|
|
182
|
+
"@multiplatform.one/test-utils": "10.12.0",
|
|
183
183
|
"@tamagui/animations-css": "3.2.3",
|
|
184
184
|
"@tamagui/animations-reanimated": "3.2.3",
|
|
185
185
|
"@tamagui/build": "3.2.3",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment happy-dom
|
|
3
|
+
*
|
|
4
|
+
* FZ-12715: Tamagui only calls `useAnimations` while `transition` is in a
|
|
5
|
+
* component's props. A native part whose role is still at animation `none`
|
|
6
|
+
* and then gains a transition (a knob flip, a late reduced-motion read, a
|
|
7
|
+
* conditional role) must keep the same hooks across both renders.
|
|
8
|
+
*/
|
|
9
|
+
import { createElement } from "react";
|
|
10
|
+
import { cleanup, render } from "@testing-library/react";
|
|
11
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
12
|
+
import { TamaguiProvider, View } from "tamagui";
|
|
13
|
+
import { createDefaultThemeConfig } from "./createDefaultThemeConfig";
|
|
14
|
+
import { motionFor } from "./motion";
|
|
15
|
+
import type { MotionRole } from "./motion";
|
|
16
|
+
import { transitionProps } from "./nativeTransitionProps";
|
|
17
|
+
|
|
18
|
+
const config = createDefaultThemeConfig().tamagui;
|
|
19
|
+
|
|
20
|
+
afterEach(cleanup);
|
|
21
|
+
|
|
22
|
+
function Part({ role }: { role: MotionRole }) {
|
|
23
|
+
return createElement(View, { testID: "part", ...transitionProps(role) });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function tree(role: MotionRole) {
|
|
27
|
+
return createElement(
|
|
28
|
+
TamaguiProvider,
|
|
29
|
+
{ config, defaultTheme: "light", disableInjectCSS: true },
|
|
30
|
+
createElement(Part, { role }),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe("native transitionProps across a role change", () => {
|
|
35
|
+
it.each([
|
|
36
|
+
["none", "quick"],
|
|
37
|
+
["quick", "none"],
|
|
38
|
+
] as const)("keeps the transition key from %s to %s", (from, to) => {
|
|
39
|
+
expect(transitionProps(motionFor(from).control)).toHaveProperty("transition");
|
|
40
|
+
expect(transitionProps(motionFor(to).control)).toHaveProperty("transition");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("adds no hooks to a live part when its role gains a transition", () => {
|
|
44
|
+
const errors = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
45
|
+
const { rerender, getByTestId } = render(tree(motionFor("none").control));
|
|
46
|
+
rerender(tree(motionFor("quick").control));
|
|
47
|
+
rerender(tree(motionFor("none").control));
|
|
48
|
+
expect(getByTestId("part")).toBeTruthy();
|
|
49
|
+
const hookErrors = errors.mock.calls
|
|
50
|
+
.flat()
|
|
51
|
+
.map(String)
|
|
52
|
+
.filter((line) => /hooks|Should have a queue/i.test(line));
|
|
53
|
+
errors.mockRestore();
|
|
54
|
+
expect(hookErrors).toEqual([]);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("runs animation none as the registered 0ms timing, never the driver's default spring", () => {
|
|
58
|
+
const transition = transitionProps(motionFor("none").control).transition as {
|
|
59
|
+
preset: string;
|
|
60
|
+
};
|
|
61
|
+
expect(transition.preset).toBe("0ms");
|
|
62
|
+
expect(config.animations.animations).toHaveProperty("0ms");
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -8,17 +8,16 @@ import { animationConfig as nativeAnimationConfig } from "./animations/reactNati
|
|
|
8
8
|
* The React Native driver resolves an undefined `transition` to an empty
|
|
9
9
|
* config and animates with a default spring (LC-59), so keeping the key at
|
|
10
10
|
* animation `none` would put motion on every part that is meant to be still.
|
|
11
|
-
* Native
|
|
11
|
+
* Native passes the registered `0ms` timing instead.
|
|
12
12
|
*/
|
|
13
13
|
export function transitionProps(
|
|
14
14
|
role: MotionRole | TransitionProp | undefined,
|
|
15
15
|
extra: readonly string[] = [],
|
|
16
16
|
): {
|
|
17
|
-
transition
|
|
17
|
+
transition: TransitionProp;
|
|
18
18
|
} {
|
|
19
19
|
const isRole = isMotionRole(role);
|
|
20
|
-
const transition = isRole ? role.transition : role;
|
|
21
|
-
if (transition === undefined) return {};
|
|
20
|
+
const transition = (isRole ? role.transition : role) ?? instant;
|
|
22
21
|
if (!isRole) return { transition };
|
|
23
22
|
const properties = [...role.animateOnly, ...extra]
|
|
24
23
|
.flatMap((property) => nativeLonghands[property] ?? [property])
|
|
@@ -36,6 +35,8 @@ export function transitionProps(
|
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
37
|
|
|
38
|
+
const instant: TransitionKeys = "0ms";
|
|
39
|
+
|
|
39
40
|
function isSpring(stop: string): boolean {
|
|
40
41
|
const config = nativeAnimationConfig[stop as keyof typeof nativeAnimationConfig] as
|
|
41
42
|
| { type?: string }
|
|
@@ -29,9 +29,15 @@ describe("role property scopes", () => {
|
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
it("
|
|
33
|
-
expect(nativeTransitionProps(motionFor("none").control)).toEqual({
|
|
34
|
-
|
|
32
|
+
it("runs disabled native transitions at 0ms and expands the border colour longhands", () => {
|
|
33
|
+
expect(nativeTransitionProps(motionFor("none").control)).toEqual({
|
|
34
|
+
transition: {
|
|
35
|
+
preset: "0ms",
|
|
36
|
+
properties:
|
|
37
|
+
"backgroundColor, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, color, opacity, transform",
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
expect(nativeTransitionProps(undefined)).toEqual({ transition: "0ms" });
|
|
35
41
|
expect(nativeTransitionProps("quick")).toEqual({ transition: "quick" });
|
|
36
42
|
const properties =
|
|
37
43
|
"backgroundColor, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, color, opacity, transform, maxHeight";
|
|
@@ -6,9 +6,9 @@ import type { TransitionProp } from "tamagui";
|
|
|
6
6
|
* The React Native driver resolves an undefined `transition` to an empty
|
|
7
7
|
* config and animates with a default spring (LC-59), so keeping the key at
|
|
8
8
|
* animation `none` would put motion on every part that is meant to be still.
|
|
9
|
-
* Native
|
|
9
|
+
* Native passes the registered `0ms` timing instead.
|
|
10
10
|
*/
|
|
11
11
|
export declare function transitionProps(role: MotionRole | TransitionProp | undefined, extra?: readonly string[]): {
|
|
12
|
-
transition
|
|
12
|
+
transition: TransitionProp;
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=nativeTransitionProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeTransitionProps.d.ts","sourceRoot":"","sources":["../../src/theme/nativeTransitionProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9D;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,EAC7C,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B;IACD,UAAU,
|
|
1
|
+
{"version":3,"file":"nativeTransitionProps.d.ts","sourceRoot":"","sources":["../../src/theme/nativeTransitionProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9D;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,EAC7C,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B;IACD,UAAU,EAAE,cAAc,CAAC;CAC5B,CAkBA"}
|