tamagui 1.124.9 → 1.124.10

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,14 +2010,12 @@ 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(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;
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
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
- });
2020
- });
2016
+ prop !== void 0 && (previous.current = prop, transitionFn(function() {
2017
+ setState(prop);
2018
+ }));
2021
2019
  }, [
2022
2020
  prop
2023
2021
  ]), React4.useEffect(function() {
@@ -7151,24 +7149,29 @@ var require_createShallowSetState_native = __commonJS({
7151
7149
  var import_react3 = require("react"), callImmediate = function(cb) {
7152
7150
  return cb();
7153
7151
  };
7154
- function createShallowSetState(setter, isDisabled, transition, debug, callback) {
7152
+ function createShallowSetState(setter, onlyAllow, transition, debug, callback) {
7155
7153
  return (0, import_react3.useCallback)(function(next) {
7156
7154
  var wrap = transition ? import_react3.startTransition : callImmediate;
7157
7155
  wrap(function() {
7158
7156
  setter(function(prev) {
7159
- var out = mergeIfNotShallowEqual(prev, next, isDisabled, debug);
7157
+ var out = mergeIfNotShallowEqual(prev, next, onlyAllow, debug);
7160
7158
  return callback == null || callback(out), out;
7161
7159
  });
7162
7160
  });
7163
7161
  }, [
7164
7162
  setter,
7165
- isDisabled,
7163
+ onlyAllow ? onlyAllow.join("") : "",
7166
7164
  transition,
7167
7165
  debug
7168
7166
  ]);
7169
7167
  }
7170
- function mergeIfNotShallowEqual(prev, next, isDisabled, debug) {
7171
- if (isDisabled || !prev || !next || isEqualShallow(prev, next)) return prev || next;
7168
+ function mergeIfNotShallowEqual(prev, next, onlyAllow, debug) {
7169
+ if (onlyAllow) {
7170
+ var allowed = {};
7171
+ for (var key in next) onlyAllow.includes(key) && (allowed[key] = next[key]);
7172
+ next = allowed;
7173
+ }
7174
+ if (!prev || !next || isEqualShallow(prev, next)) return prev || next;
7172
7175
  if (process.env.NODE_ENV === "development" && debug && (console.info("setStateShallow CHANGE", {
7173
7176
  prev,
7174
7177
  next
@@ -8132,7 +8135,9 @@ var require_useComponentState_native = __commonJS({
8132
8135
  groupContextState[groupName] = next;
8133
8136
  };
8134
8137
  }
8135
- var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled, !1, props.debug, setStateWrapper);
8138
+ var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
8139
+ "disabled"
8140
+ ] : void 0, !1, props.debug, setStateWrapper);
8136
8141
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
8137
8142
  process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`has presenceState ${JSON.stringify(presenceState)}`);
8138
8143
  var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
@@ -10860,7 +10865,7 @@ var require_useProps_native = __commonJS({
10860
10865
  resolveValues: "auto",
10861
10866
  ...opts
10862
10867
  }, null, componentContext), { mediaGroups, pseudoGroups } = splitStyles;
10863
- return import_react3.default.useEffect(function() {
10868
+ return import_react3.default.useLayoutEffect(function() {
10864
10869
  if (!disabled) {
10865
10870
  if (state.unmounted) {
10866
10871
  setStateShallow({
@@ -15938,7 +15943,7 @@ var require_constants_native3 = __commonJS({
15938
15943
  }
15939
15944
  });
15940
15945
  module2.exports = __toCommonJS2(constants_exports);
15941
- var import_constants4 = require_index_native6(), _global__IS_FABRIC, IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager), USE_NATIVE_PORTAL = !import_constants4.isAndroid && process.env.TAMAGUI_USE_NATIVE_PORTAL !== "false" && !IS_FABRIC, allPortalHosts = /* @__PURE__ */ new Map(), portalListeners = {};
15946
+ var import_constants4 = require_index_native6(), _global__IS_FABRIC, IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager), USE_NATIVE_PORTAL = process.env.TAMAGUI_USE_NATIVE_PORTAL && process.env.TAMAGUI_USE_NATIVE_PORTAL !== "false" ? !0 : !import_constants4.isAndroid && !IS_FABRIC, allPortalHosts = /* @__PURE__ */ new Map(), portalListeners = {};
15942
15947
  }
15943
15948
  });
15944
15949