tamagui 1.124.6 → 1.124.8

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
@@ -2010,13 +2010,17 @@ var require_useControllableState_native = __commonJS({
2010
2010
  var import_use_event = require_index_native8(), React4 = __toESM2(require("react")), import_start_transition = require_index_native9(), emptyCallbackFn = function(_) {
2011
2011
  return _();
2012
2012
  };
2013
- function useControllableState(param) {
2014
- var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = param, [state, setState] = React4.useState(prop ?? defaultProp), previous = React4.useRef(state), propWins = strategy === "prop-wins" && prop !== void 0, value = propWins ? prop : state, onChangeCb = (0, import_use_event.useEvent)(onChange || idFn), transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
2015
- prop !== state && transitionFn(function() {
2016
- setState(function(prev) {
2017
- if (prev !== prop) return previous.current = prop, prop;
2013
+ function useControllableState(props) {
2014
+ var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = props, [state, setState] = React4.useState(prop ?? defaultProp), previous = React4.useRef(state), propWins = strategy === "prop-wins" && prop !== void 0, value = propWins ? prop : state, onChangeCb = (0, import_use_event.useEvent)(onChange || idFn), transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
2015
+ React4.useEffect(function() {
2016
+ "prop" in props && prop !== state && transitionFn(function() {
2017
+ setState(function(prev) {
2018
+ if (prev !== prop) return previous.current = prop, prop;
2019
+ });
2018
2020
  });
2019
- }), React4.useEffect(function() {
2021
+ }, [
2022
+ prop
2023
+ ]), React4.useEffect(function() {
2020
2024
  propWins || state !== previous.current && (previous.current = state, onChangeCb(state));
2021
2025
  }, [
2022
2026
  onChangeCb,
@@ -7368,16 +7372,17 @@ var require_useThemeState_native = __commonJS({
7368
7372
  isNew: !0
7369
7373
  } : state;
7370
7374
  }, getSnapshotFrom = function(lastState, props, propsKey) {
7371
- var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate2 = arguments.length > 7 ? arguments[7] : void 0, parentState = states.get(parentId);
7375
+ var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate2 = arguments.length > 7 ? arguments[7] : void 0, { debug } = props, parentState = states.get(parentId);
7372
7376
  themes || (themes = (0, import_config.getConfig)().themes);
7373
7377
  var name = !propsKey && pendingUpdate2 !== "force" ? null : getNewThemeName(parentState == null ? void 0 : parentState.name, props, pendingUpdate2 === "force" ? !0 : !!needsUpdate), isSameAsParent = !!(!name && propsKey);
7374
- if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
7378
+ if (process.env.NODE_ENV === "development" && debug && debug !== "profile") {
7375
7379
  var message = ` \xB7 useTheme(${id}) snapshot ${name}, parent ${parentState == null ? void 0 : parentState.id} needsUpdate ${needsUpdate}`;
7376
7380
  console.info(message);
7377
7381
  }
7378
7382
  if (parentState && isSameAsParent) return parentState;
7379
7383
  if (!name) {
7380
7384
  var next = lastState ?? parentState;
7385
+ if (!next) throw new Error("No theme and no parent?");
7381
7386
  if (needsUpdate && pendingUpdate2) {
7382
7387
  var updated = {
7383
7388
  ...parentState || lastState
@@ -7397,7 +7402,14 @@ var require_useThemeState_native = __commonJS({
7397
7402
  inverses,
7398
7403
  isInverse
7399
7404
  };
7400
- return process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile" && (console.groupCollapsed(` \xB7 useTheme(${id}) \u23ED\uFE0F2 ${name}`), console.info("state", nextState), console.groupEnd()), isRoot && (rootThemeState = nextState), pendingUpdate2 !== "force" && lastState && !needsUpdate ? (Object.assign(lastState, nextState), lastState) : nextState;
7405
+ isRoot && (rootThemeState = nextState);
7406
+ var shouldAvoidRerender = pendingUpdate2 !== "force" && lastState && !needsUpdate && nextState.name === lastState.name;
7407
+ return process.env.NODE_ENV === "development" && debug && debug !== "profile" && (console.groupCollapsed(` \xB7 useTheme(${id}) \u23ED\uFE0F ${name} shouldAvoidRerender: ${shouldAvoidRerender}`), console.info({
7408
+ lastState,
7409
+ needsUpdate,
7410
+ nextState,
7411
+ pendingUpdate: pendingUpdate2
7412
+ }), console.groupEnd()), shouldAvoidRerender ? (Object.assign(lastState, nextState), lastState) : nextState;
7401
7413
  };
7402
7414
  function scheduleUpdate(id) {
7403
7415
  for (var queue = [
@@ -10832,7 +10844,10 @@ var require_useProps_native = __commonJS({
10832
10844
  var _opts_forComponent, _opts_forComponent_staticConfig, staticConfig = (_opts_forComponent_staticConfig = opts == null || (_opts_forComponent = opts.forComponent) === null || _opts_forComponent === void 0 ? void 0 : _opts_forComponent.staticConfig) !== null && _opts_forComponent_staticConfig !== void 0 ? _opts_forComponent_staticConfig : import_Stack.Stack.staticConfig, [theme, themeState] = (0, import_useTheme.useThemeWithState)({
10833
10845
  componentName: staticConfig.componentName,
10834
10846
  name: "theme" in props ? props.theme : void 0,
10835
- inverse: "themeInverse" in props ? props.themeInverse : void 0
10847
+ inverse: "themeInverse" in props ? props.themeInverse : void 0,
10848
+ needsUpdate() {
10849
+ return !0;
10850
+ }
10836
10851
  }), componentContext = import_react3.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, (0, import_config.getConfig)()), mediaStateNow = opts != null && opts.noMedia ? (
10837
10852
  // not safe to use mediaState but really marginal to hit this
10838
10853
  import_useMedia.mediaState
@@ -25379,7 +25394,9 @@ var require_Popover_native = __commonJS({
25379
25394
  __scopePopover,
25380
25395
  zIndex: props.zIndex,
25381
25396
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.Stack, {
25382
- pointerEvents: context.open ? "auto" : "none",
25397
+ ...!context.open && {
25398
+ pointerEvents: "none"
25399
+ },
25383
25400
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverContentImpl, {
25384
25401
  ...contentImplProps,
25385
25402
  disableRemoveScroll,