@tamagui/core 1.126.14 → 1.126.16

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.
@@ -11516,11 +11516,49 @@ __export(index_exports, {
11516
11516
  Text: () => Text,
11517
11517
  View: () => View,
11518
11518
  createTamagui: () => createTamagui,
11519
- getElementLayoutEvent: () => getElementLayoutEvent
11519
+ getElementLayoutEvent: () => getElementLayoutEvent,
11520
+ setOnLayoutStrategy: () => setOnLayoutStrategy
11520
11521
  });
11521
11522
  module.exports = __toCommonJS(index_exports);
11522
11523
  var import_react_native_media_driver = __toESM(require_index_native9()), import_react_native_use_responder_events = __toESM(require_index_native10()), import_web2 = __toESM(require_index_native8()), import_react2 = __toESM(require("react"));
11523
11524
 
11525
+ // src/addNativeValidStyles.native.ts
11526
+ var import_helpers = __toESM(require_index_native3());
11527
+ function getReactNativeVersion() {
11528
+ var version = process.env.REACT_NATIVE_VERSION || "";
11529
+ if (!process.env.REACT_NATIVE_VERSION)
11530
+ try {
11531
+ var ReactNativeOfficalVersion = require("react-native/Libraries/Core/ReactNativeVersion");
11532
+ if (ReactNativeOfficalVersion) {
11533
+ var { version: { major, minor, patch } } = ReactNativeOfficalVersion;
11534
+ version = `${major}.${minor}.${patch}`;
11535
+ }
11536
+ } catch {
11537
+ } finally {
11538
+ version || (version = "0.77");
11539
+ }
11540
+ var [major1, minor1, patch1] = version.split(".");
11541
+ return [
11542
+ +major1,
11543
+ +minor1,
11544
+ +patch1
11545
+ ];
11546
+ }
11547
+ function addNativeValidStyles() {
11548
+ var [major, minor] = getReactNativeVersion();
11549
+ if (major === 0 && minor >= 77) {
11550
+ var additional = {
11551
+ boxSizing: !0,
11552
+ mixBlendMode: !0,
11553
+ outlineWidth: !0,
11554
+ outlineStyle: !0,
11555
+ outlineSpread: !0,
11556
+ outlineColor: !0
11557
+ };
11558
+ Object.assign(import_helpers.validStyles, additional), Object.assign(import_helpers.stylePropsAll, additional);
11559
+ }
11560
+ }
11561
+
11524
11562
  // src/createOptimizedView.native.tsx
11525
11563
  var import_react = __toESM(require("react"));
11526
11564
  function createOptimizedView(children, viewProps, baseViews2) {
@@ -11735,7 +11773,11 @@ var getRect = function(node) {
11735
11773
  };
11736
11774
 
11737
11775
  // src/hooks/useElementLayout.tsx
11738
- var import_constants = __toESM(require_index_native2()), import_web = __toESM(require_index_native8()), LayoutHandlers = /* @__PURE__ */ new WeakMap(), Nodes = /* @__PURE__ */ new Set(), NodeRectCache = /* @__PURE__ */ new WeakMap(), ParentRectCache = /* @__PURE__ */ new WeakMap(), rAF = typeof window < "u" ? window.requestAnimationFrame : void 0;
11776
+ var import_constants = __toESM(require_index_native2()), import_web = __toESM(require_index_native8()), LayoutHandlers = /* @__PURE__ */ new WeakMap(), Nodes = /* @__PURE__ */ new Set(), status = "active";
11777
+ function setOnLayoutStrategy(state) {
11778
+ status = state;
11779
+ }
11780
+ var NodeRectCache = /* @__PURE__ */ new WeakMap(), ParentRectCache = /* @__PURE__ */ new WeakMap(), rAF = typeof window < "u" ? window.requestAnimationFrame : void 0;
11739
11781
  if (import_constants.isClient && rAF) {
11740
11782
  let updateLayoutIfChanged = function(node) {
11741
11783
  var nodeRect = node.getBoundingClientRect(), parentNode = node.parentElement, parentRect = parentNode == null ? void 0 : parentNode.getBoundingClientRect(), onLayout = LayoutHandlers.get(node);
@@ -11751,15 +11793,20 @@ if (import_constants.isClient && rAF) {
11751
11793
  }
11752
11794
  }
11753
11795
  }, layoutOnAnimationFrame = function() {
11754
- Nodes.forEach(updateLayoutIfChanged), rAF(layoutOnAnimationFrame);
11796
+ var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
11797
+ if (lastFrameAt = now, status !== "inactive") {
11798
+ var expectedFrameTime = 16.67, hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
11799
+ hasRecentSyncWork || Nodes.forEach(updateLayoutIfChanged);
11800
+ }
11801
+ rAF(layoutOnAnimationFrame);
11755
11802
  };
11756
- updateLayoutIfChanged2 = updateLayoutIfChanged, layoutOnAnimationFrame2 = layoutOnAnimationFrame, avoidUpdates = !0, queuedUpdates = /* @__PURE__ */ new Map(), (0, import_web.___onDidFinishClientRender)(function() {
11803
+ updateLayoutIfChanged2 = updateLayoutIfChanged, layoutOnAnimationFrame2 = layoutOnAnimationFrame, avoidUpdates = !0, queuedUpdates = /* @__PURE__ */ new Map(), lastFrameAt = Date.now(), numDroppedFramesUntilPause = 2, (0, import_web.___onDidFinishClientRender)(function() {
11757
11804
  avoidUpdates = !1, queuedUpdates && (queuedUpdates.forEach(function(cb) {
11758
11805
  return cb();
11759
11806
  }), queuedUpdates.clear());
11760
11807
  }), rAF(layoutOnAnimationFrame);
11761
11808
  }
11762
- var avoidUpdates, queuedUpdates, updateLayoutIfChanged2, layoutOnAnimationFrame2, getElementLayoutEvent = function(target) {
11809
+ var avoidUpdates, queuedUpdates, lastFrameAt, numDroppedFramesUntilPause, updateLayoutIfChanged2, layoutOnAnimationFrame2, getElementLayoutEvent = function(target) {
11763
11810
  var res = null;
11764
11811
  if (measureLayout(target, null, function(x, y, width, height, left, top) {
11765
11812
  res = {
@@ -11803,43 +11850,6 @@ var avoidUpdates, queuedUpdates, updateLayoutIfChanged2, layoutOnAnimationFrame2
11803
11850
  // src/vendor/Pressability.native.tsx
11804
11851
  var Pressability = require_fake_react_native().default, usePressability = (init_idFn(), __toCommonJS(idFn_exports)).default;
11805
11852
 
11806
- // src/addNativeValidStyles.native.ts
11807
- var import_helpers = __toESM(require_index_native3());
11808
- function getReactNativeVersion() {
11809
- var version = process.env.REACT_NATIVE_VERSION || "";
11810
- if (!process.env.REACT_NATIVE_VERSION)
11811
- try {
11812
- var ReactNativeOfficalVersion = require("react-native/Libraries/Core/ReactNativeVersion");
11813
- if (ReactNativeOfficalVersion) {
11814
- var { version: { major, minor, patch } } = ReactNativeOfficalVersion;
11815
- version = `${major}.${minor}.${patch}`;
11816
- }
11817
- } catch {
11818
- } finally {
11819
- version || (version = "0.77");
11820
- }
11821
- var [major1, minor1, patch1] = version.split(".");
11822
- return [
11823
- +major1,
11824
- +minor1,
11825
- +patch1
11826
- ];
11827
- }
11828
- function addNativeValidStyles() {
11829
- var [major, minor] = getReactNativeVersion();
11830
- if (major === 0 && minor >= 77) {
11831
- var additional = {
11832
- boxSizing: !0,
11833
- mixBlendMode: !0,
11834
- outlineWidth: !0,
11835
- outlineStyle: !0,
11836
- outlineSpread: !0,
11837
- outlineColor: !0
11838
- };
11839
- Object.assign(import_helpers.validStyles, additional), Object.assign(import_helpers.stylePropsAll, additional);
11840
- }
11841
- }
11842
-
11843
11853
  // src/index.tsx
11844
11854
  __reExport(index_exports, __toESM(require_index_native8()), module.exports);
11845
11855
  addNativeValidStyles();
@@ -11902,6 +11912,7 @@ var dontComposePressabilityKeys = {
11902
11912
  Text,
11903
11913
  View,
11904
11914
  createTamagui,
11905
- getElementLayoutEvent
11915
+ getElementLayoutEvent,
11916
+ setOnLayoutStrategy
11906
11917
  });
11907
11918
  //# sourceMappingURL=test.js.map