@tamagui/core 1.101.2 → 1.101.3

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
@@ -3237,30 +3237,32 @@ var require_useMedia_native = __commonJS({
3237
3237
  }, States.set(uid, componentState));
3238
3238
  var getSnapshot = function() {
3239
3239
  if (!componentState) return initialState;
3240
- var keys = componentState.keys, _componentState_prev = componentState.prev, prev = _componentState_prev === void 0 ? initialState : _componentState_prev;
3241
- if (componentState && componentState.enabled === !1) return prev;
3242
- var _componentState_keys, _ref, testKeys = (_ref = (_componentState_keys = componentState == null ? void 0 : componentState.keys) !== null && _componentState_keys !== void 0 ? _componentState_keys : (!componentState || componentState.enabled) && keys) !== null && _ref !== void 0 ? _ref : null, hasntUpdated = !testKeys || (testKeys == null ? void 0 : testKeys.every(function(key) {
3240
+ var enabled = componentState.enabled, keys = componentState.keys, _componentState_prev = componentState.prev, prev = _componentState_prev === void 0 ? initialState : _componentState_prev;
3241
+ if (enabled === !1) return prev;
3242
+ var _ref, testKeys = (_ref = (keys != null || enabled) && keys) !== null && _ref !== void 0 ? _ref : null, hasntUpdated = !testKeys || Object.keys(testKeys).every(function(key) {
3243
3243
  return mediaState2[key] === prev[key];
3244
- }));
3244
+ });
3245
3245
  return hasntUpdated ? prev : (componentState.prev = mediaState2, mediaState2);
3246
3246
  }, state;
3247
3247
  if (process.env.TAMAGUI_SYNC_MEDIA_QUERY) state = (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, function() {
3248
3248
  return initialState;
3249
3249
  });
3250
3250
  else {
3251
- var _useState = _sliced_to_array((0, import_react3.useState)(initialState), 2), internalState = _useState[0], setState = _useState[1];
3252
- state = internalState, (0, import_constants.useIsomorphicLayoutEffect)(function() {
3251
+ var _useState = _sliced_to_array((0, import_react3.useState)(initialState), 2), _state = _useState[0], setState = _useState[1];
3252
+ state = _state, (0, import_constants.useIsomorphicLayoutEffect)(function() {
3253
3253
  var update = function() {
3254
3254
  setState(getSnapshot);
3255
3255
  };
3256
- return update(), subscribe(update);
3256
+ return update(), disableSSR || Promise.resolve().then(function() {
3257
+ update();
3258
+ }), subscribe(update);
3257
3259
  }, []);
3258
3260
  }
3259
3261
  return new Proxy(state, {
3260
3262
  get: function(_, key) {
3261
3263
  if (typeof key == "string") {
3262
3264
  var _componentState;
3263
- (_componentState = componentState).keys || (_componentState.keys = []), componentState.keys.includes(key) || componentState.keys.push(key), process.env.NODE_ENV === "development" && debug && console.info("useMedia() TOUCH", key);
3265
+ (_componentState = componentState).keys || (_componentState.keys = {}), componentState.keys[key] = !0, process.env.NODE_ENV === "development" && debug && console.info("useMedia() TOUCH", key);
3264
3266
  }
3265
3267
  return Reflect.get(state, key);
3266
3268
  }
@@ -7761,7 +7763,7 @@ current`, _object_spread2({}, styleState.style)));
7761
7763
  if (isMedia) {
7762
7764
  if (!val) continue;
7763
7765
  var hasSpace = val.space, mediaKeyShort = key.slice(1);
7764
- if (hasMedia || (hasMedia = !0), (hasSpace || !shouldDoClasses || styleProps.willBeAnimated) && (Array.isArray(hasMedia) || (hasMedia = []), hasMedia.push(mediaKeyShort)), isMedia === "platform") {
7766
+ if (hasMedia || (hasMedia = !0), (hasSpace || !shouldDoClasses || styleProps.willBeAnimated) && (typeof hasMedia != "object" && (hasMedia = {}), hasMedia[mediaKeyShort] = !0), isMedia === "platform") {
7765
7767
  var platform = key.slice(10);
7766
7768
  if (
7767
7769
  // supports web, ios, android
@@ -9422,7 +9424,7 @@ var require_createComponent_native = __commonJS({
9422
9424
  (_splitStyles = splitStyles).style || (_splitStyles.style = {}), splitStyles.style.opacity = 0;
9423
9425
  }
9424
9426
  process.env.NODE_ENV === "development" && time && time(_templateObject10()), curStateRef.isListeningToTheme = splitStyles.dynamicThemeAccess;
9425
- var isMediaArray = splitStyles.hasMedia && Array.isArray(splitStyles.hasMedia), shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || isMediaArray || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = isMediaArray ? splitStyles.hasMedia : null;
9427
+ var hasRuntimeMediaKeys = splitStyles.hasMedia && splitStyles.hasMedia !== !0, shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || hasRuntimeMediaKeys || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = hasRuntimeMediaKeys ? splitStyles.hasMedia : null;
9426
9428
  process.env.NODE_ENV === "development" && debugProp && console.info("useMedia() createComponent", shouldListenForMedia, mediaListeningKeys), (0, import_useMedia.setMediaShouldUpdate)(stateRef, {
9427
9429
  enabled: shouldListenForMedia,
9428
9430
  keys: mediaListeningKeys
@@ -9680,7 +9682,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9680
9682
  elementType,
9681
9683
  events,
9682
9684
  isAnimated,
9683
- isMediaArray,
9685
+ hasRuntimeMediaKeys,
9684
9686
  isStringElement,
9685
9687
  mediaListeningKeys,
9686
9688
  pseudos,