@tamagui/core 1.100.0 → 1.100.1

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
@@ -3219,8 +3219,19 @@ var require_useMedia_native = __commonJS({
3219
3219
  return listeners.delete(subscriber);
3220
3220
  };
3221
3221
  }
3222
+ function useLayoutExternalStore(subscriber, getSnapshot, getServerSnapshot) {
3223
+ var _useState = _sliced_to_array((0, import_react3.useState)(getServerSnapshot), 2), state = _useState[0], setState = _useState[1];
3224
+ return (0, import_constants.useIsomorphicLayoutEffect)(function() {
3225
+ return subscriber(function() {
3226
+ setState(function(prev) {
3227
+ var next = getSnapshot();
3228
+ return next !== prev ? next : prev;
3229
+ });
3230
+ });
3231
+ }, []), state;
3232
+ }
3222
3233
  function useMedia2(uid, componentContext) {
3223
- var internal = (0, import_react3.useRef)(), disableSSR = (0, import_useDisableSSR.getDisableSSR)(componentContext), initialState = (disableSSR || !import_constants.isWeb ? mediaState2 : initState) || {}, state = (0, import_react3.useSyncExternalStore)(subscribe, function() {
3234
+ var internal = (0, import_react3.useRef)(), disableSSR = (0, import_useDisableSSR.getDisableSSR)(componentContext), initialState = (disableSSR || !import_constants.isWeb ? mediaState2 : initState) || {}, state = useLayoutExternalStore(subscribe, function() {
3224
3235
  if (!internal.current) return initialState;
3225
3236
  var _internal_current = internal.current, touched = _internal_current.touched, prev = _internal_current.prev, componentState = uid ? shouldUpdate.get(uid) : void 0;
3226
3237
  if (componentState && componentState.enabled === !1) return prev;