tamagui 1.116.3 → 1.116.5

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/native.js CHANGED
@@ -3165,12 +3165,13 @@ var require_useMedia_native = __commonJS({
3165
3165
  }), (0, import_constants4.useIsomorphicLayoutEffect)(function() {
3166
3166
  var update = function() {
3167
3167
  return setState(function(prev) {
3168
+ var keys = getCurrentKeys();
3168
3169
  return getSnapshot(
3169
3170
  prev,
3170
3171
  // because the !didHydrateOnce logic we can't update as we render
3171
3172
  // we need to get the current keys in case we added
3172
3173
  // these only ever add keys so likely ok?
3173
- getCurrentKeys()
3174
+ keys
3174
3175
  );
3175
3176
  });
3176
3177
  };
@@ -15715,14 +15716,19 @@ var require_GorhomPortal_native = __commonJS({
15715
15716
  }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PortalHostNonNative, {
15716
15717
  ...props
15717
15718
  });
15718
- }), allPortalHosts = /* @__PURE__ */ new Map();
15719
+ }), allPortalHosts = /* @__PURE__ */ new Map(), listeners = {};
15719
15720
  function PortalHostWeb(props) {
15720
15721
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
15721
15722
  style: {
15722
15723
  display: "contents"
15723
15724
  },
15724
15725
  ref: function(node) {
15725
- node ? allPortalHosts.set(props.name, node) : allPortalHosts.delete(props.name);
15726
+ if (node) {
15727
+ var _listeners_props_name;
15728
+ allPortalHosts.set(props.name, node), (_listeners_props_name = listeners[props.name]) === null || _listeners_props_name === void 0 || _listeners_props_name.forEach(function(x) {
15729
+ return x(node);
15730
+ });
15731
+ } else allPortalHosts.delete(props.name);
15726
15732
  }
15727
15733
  });
15728
15734
  }
@@ -15752,8 +15758,21 @@ var require_GorhomPortal_native = __commonJS({
15752
15758
  });
15753
15759
  }), PortalItemWeb = function(props) {
15754
15760
  if (!props.hostName) throw new Error("No name");
15755
- var hostNode = allPortalHosts.get(props.hostName);
15756
- return hostNode ? /* @__PURE__ */ (0, import_react_dom.createPortal)(props.children, hostNode) : null;
15761
+ var cur = allPortalHosts.get(props.hostName), [node, setNode] = (0, import_react3.useState)(cur);
15762
+ return cur && !node && setNode(cur), (0, import_react3.useEffect)(function() {
15763
+ var _listeners, _props_hostName;
15764
+ if (props.hostName && !node) {
15765
+ var listener = function(node2) {
15766
+ setNode(node2);
15767
+ };
15768
+ return (_listeners = listeners)[_props_hostName = props.hostName] || (_listeners[_props_hostName] = /* @__PURE__ */ new Set()), listeners[props.hostName].add(listener), function() {
15769
+ var _listeners_props_hostName;
15770
+ (_listeners_props_hostName = listeners[props.hostName]) === null || _listeners_props_hostName === void 0 || _listeners_props_hostName.delete(listener);
15771
+ };
15772
+ }
15773
+ }, [
15774
+ node
15775
+ ]), node ? /* @__PURE__ */ (0, import_react_dom.createPortal)(props.children, node) : null;
15757
15776
  }, NonNativePortalComponent = function(props) {
15758
15777
  var { name: _providedName, hostName, handleOnMount: _providedHandleOnMount, handleOnUnmount: _providedHandleOnUnmount, handleOnUpdate: _providedHandleOnUpdate, children, passthrough } = props, { addPortal: addUpdatePortal2, removePortal: removePortal2 } = usePortal(hostName), id = (0, import_react3.useId)(), name = _providedName || id, handleOnMount = (0, import_core12.useEvent)(function() {
15759
15778
  _providedHandleOnMount ? _providedHandleOnMount(function() {
@@ -16161,8 +16180,10 @@ var require_Adapt_native = __commonJS({
16161
16180
  children: props.children
16162
16181
  });
16163
16182
  }, useAdaptIsActiveGiven = function(param) {
16164
- var { when, platform: platform2 } = param, media = (0, import_core12.useMedia)(), enabled = !platform2;
16165
- return platform2 === "touch" && (enabled = import_constants4.isTouchable), platform2 === "native" && (enabled = !import_constants4.isWeb), platform2 === "web" && (enabled = import_constants4.isWeb), platform2 === "ios" && (enabled = import_constants4.isIos), platform2 === "android" && (enabled = import_constants4.isAndroid), when && typeof when == "string" && !media[when] && (enabled = !1), enabled;
16183
+ var { when, platform: platform2 } = param, media = (0, import_core12.useMedia)();
16184
+ if (when == null && platform2 == null) return !1;
16185
+ var enabled = !1;
16186
+ return platform2 === "touch" ? enabled = import_constants4.isTouchable : platform2 === "native" ? enabled = !import_constants4.isWeb : platform2 === "web" ? enabled = import_constants4.isWeb : platform2 === "ios" ? enabled = import_constants4.isIos : platform2 === "android" && (enabled = import_constants4.isAndroid), platform2 && enabled == !1 ? !1 : (when && typeof when == "string" && (enabled = media[when]), enabled);
16166
16187
  }, useAdaptIsActive = function(scope) {
16167
16188
  var props = useAdaptContext(scope);
16168
16189
  return useAdaptIsActiveGiven(props);
@@ -18734,17 +18755,17 @@ var require_Dialog_native = __commonJS({
18734
18755
  })
18735
18756
  });
18736
18757
  }, DialogPortal = function(props) {
18737
- var { __scopeDialog, forceMount, children, ...frameProps } = props, context = useDialogContext(PORTAL_NAME, __scopeDialog), isShowing = forceMount || context.open, [isFullyHidden, setIsFullyHidden] = React4.useState(!isShowing);
18758
+ var { __scopeDialog, forceMount, children, ...frameProps } = props, context = useDialogContext(PORTAL_NAME, __scopeDialog), isShowing = forceMount || context.open, [isFullyHidden, setIsFullyHidden] = React4.useState(!isShowing), isAdapted = (0, import_adapt.useAdaptIsActive)();
18738
18759
  isShowing && isFullyHidden && setIsFullyHidden(!1);
18739
18760
  var handleExitComplete = React4.useCallback(function() {
18740
18761
  setIsFullyHidden(!0);
18741
- }, []), contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_animate_presence.AnimatePresence, {
18742
- onExitComplete: handleExitComplete,
18743
- children: isShowing ? children : null
18744
- }), isAdapted = (0, import_adapt.useAdaptIsActive)();
18745
- if (isAdapted) return children;
18762
+ }, []);
18746
18763
  if (context.modal) {
18747
- if (isFullyHidden) return null;
18764
+ var contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_animate_presence.AnimatePresence, {
18765
+ onExitComplete: handleExitComplete,
18766
+ children: isShowing || isAdapted ? children : null
18767
+ });
18768
+ if (isFullyHidden && !isAdapted) return null;
18748
18769
  var framedContents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PortalProvider2, {
18749
18770
  scope: __scopeDialog,
18750
18771
  forceMount,
@@ -18765,7 +18786,7 @@ var require_Dialog_native = __commonJS({
18765
18786
  }
18766
18787
  return framedContents;
18767
18788
  }
18768
- return contents;
18789
+ return children;
18769
18790
  }, PassthroughTheme = function(param) {
18770
18791
  var { children } = param, themeName = (0, import_core12.useThemeName)();
18771
18792
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.Theme, {