@tamagui/core 1.74.21 → 1.75.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.
Files changed (37) hide show
  1. package/dist/cjs/createOptimizedView.js +26 -0
  2. package/dist/cjs/createOptimizedView.js.map +6 -0
  3. package/dist/cjs/createOptimizedView.native.js +228 -0
  4. package/dist/cjs/createOptimizedView.native.js.map +6 -0
  5. package/dist/cjs/getBaseViews.native.js +5 -2
  6. package/dist/cjs/getBaseViews.native.js.map +1 -1
  7. package/dist/cjs/index.js +2 -17
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/index.native.js +10 -17
  10. package/dist/cjs/index.native.js.map +1 -1
  11. package/dist/esm/createOptimizedView.js +6 -0
  12. package/dist/esm/createOptimizedView.js.map +6 -0
  13. package/dist/esm/createOptimizedView.native.js +206 -0
  14. package/dist/esm/createOptimizedView.native.js.map +6 -0
  15. package/dist/esm/getBaseViews.native.js +5 -2
  16. package/dist/esm/getBaseViews.native.js.map +1 -1
  17. package/dist/esm/index.js +3 -16
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/index.native.js +11 -16
  20. package/dist/esm/index.native.js.map +1 -1
  21. package/dist/native.js +317 -119
  22. package/dist/native.js.map +3 -3
  23. package/dist/test.native.js +297 -101
  24. package/dist/test.native.js.map +3 -3
  25. package/package.json +6 -6
  26. package/src/createOptimizedView.native.tsx +268 -0
  27. package/src/createOptimizedView.tsx +5 -0
  28. package/src/getBaseViews.native.ts +15 -1
  29. package/src/index.tsx +25 -16
  30. package/types/createOptimizedView.d.ts +2 -0
  31. package/types/createOptimizedView.d.ts.map +1 -0
  32. package/types/createOptimizedView.native.d.ts +17 -0
  33. package/types/createOptimizedView.native.d.ts.map +1 -0
  34. package/types/getBaseViews.native.d.ts +2 -0
  35. package/types/getBaseViews.native.d.ts.map +1 -1
  36. package/types/index.d.ts +4 -4
  37. package/types/index.d.ts.map +1 -1
package/dist/native.js CHANGED
@@ -844,7 +844,7 @@ var require_constants_native = __commonJS({
844
844
  useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect3
845
845
  });
846
846
  module2.exports = __toCommonJS2(constants_native_exports);
847
- var import_react = require("react"), isWeb = !1, isWindowDefined = !1, isServer = !1, isClient = !1, useIsomorphicLayoutEffect3 = import_react.useLayoutEffect, isChrome = !1, isWebTouchable = !1, isTouchable = !0, isAndroid = !1, isIos = !1, currentPlatform = "native";
847
+ var import_react3 = require("react"), isWeb = !1, isWindowDefined = !1, isServer = !1, isClient = !1, useIsomorphicLayoutEffect3 = import_react3.useLayoutEffect, isChrome = !1, isWebTouchable = !1, isTouchable = !0, isAndroid = !1, isIos = !1, currentPlatform = "native";
848
848
  }
849
849
  });
850
850
 
@@ -1699,26 +1699,26 @@ var require_createStyledContext_native = __commonJS({
1699
1699
  createStyledContext: () => createStyledContext
1700
1700
  });
1701
1701
  module2.exports = __toCommonJS2(createStyledContext_exports);
1702
- var import_react = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime = require("react/jsx-runtime");
1702
+ var import_react3 = require("react"), import_objectIdentityKey = require_objectIdentityKey_native(), import_jsx_runtime = require("react/jsx-runtime");
1703
1703
  function createStyledContext(defaultValues) {
1704
- let OGContext = (0, import_react.createContext)(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
1704
+ let OGContext = (0, import_react3.createContext)(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map(), Provider = ({
1705
1705
  children,
1706
1706
  scope,
1707
1707
  ...values
1708
1708
  }) => {
1709
- let value = (0, import_react.useMemo)(() => ({
1709
+ let value = (0, import_react3.useMemo)(() => ({
1710
1710
  // this ! is a workaround for ts error
1711
1711
  ...defaultValues,
1712
1712
  ...values
1713
1713
  }), [(0, import_objectIdentityKey.objectIdentityKey)(values)]), Provider2 = OGProvider;
1714
1714
  if (scope) {
1715
1715
  let ScopedContext = scopedContexts.get(scope);
1716
- ScopedContext || (ScopedContext = (0, import_react.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
1716
+ ScopedContext || (ScopedContext = (0, import_react3.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
1717
1717
  }
1718
1718
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value, children });
1719
1719
  }, useStyledContext = (scope) => {
1720
1720
  let context = scope ? scopedContexts.get(scope) : OGContext;
1721
- return (0, import_react.useContext)(context);
1721
+ return (0, import_react3.useContext)(context);
1722
1722
  };
1723
1723
  return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
1724
1724
  }
@@ -1780,9 +1780,9 @@ var require_useDisableSSR_native = __commonJS({
1780
1780
  useDisableSSR: () => useDisableSSR
1781
1781
  });
1782
1782
  module2.exports = __toCommonJS2(useDisableSSR_exports);
1783
- var import_react = require("react"), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native();
1783
+ var import_react3 = require("react"), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native();
1784
1784
  function useDisableSSR() {
1785
- let componentContext = (0, import_react.useContext)(import_ComponentContext.ComponentContext);
1785
+ let componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext);
1786
1786
  return getDisableSSR(componentContext);
1787
1787
  }
1788
1788
  function getDisableSSR(componentContext) {
@@ -1823,7 +1823,7 @@ var require_useMedia_native = __commonJS({
1823
1823
  useMediaListeners: () => useMediaListeners
1824
1824
  });
1825
1825
  module2.exports = __toCommonJS2(useMedia_exports);
1826
- var import_constants2 = require_index_native2(), import_react = require("react"), import_config = require_config_native(), import_createProxy = require_createProxy_native(), import_matchMedia = require_matchMedia_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), import_useDisableSSR = require_useDisableSSR_native(), mediaState2 = (
1826
+ var import_constants2 = require_index_native2(), import_react3 = require("react"), import_config = require_config_native(), import_createProxy = require_createProxy_native(), import_matchMedia = require_matchMedia_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), import_useDisableSSR = require_useDisableSSR_native(), mediaState2 = (
1827
1827
  // development only safeguard
1828
1828
  process.env.NODE_ENV === "development" ? (0, import_createProxy.createProxy)(
1829
1829
  {},
@@ -1902,7 +1902,7 @@ var require_useMedia_native = __commonJS({
1902
1902
  return listeners.add(subscriber), () => listeners.delete(subscriber);
1903
1903
  }
1904
1904
  function useMedia2(uid, componentContext) {
1905
- let internal = (0, import_react.useRef)(), initialState = ((componentContext ? (0, import_useDisableSSR.getDisableSSR)(componentContext) : (0, import_useDisableSSR.useDisableSSR)()) ? mediaState2 : initState) || {}, state = (0, import_react.useSyncExternalStore)(
1905
+ let internal = (0, import_react3.useRef)(), initialState = ((componentContext ? (0, import_useDisableSSR.getDisableSSR)(componentContext) : (0, import_useDisableSSR.useDisableSSR)()) ? mediaState2 : initState) || {}, state = (0, import_react3.useSyncExternalStore)(
1906
1906
  subscribe,
1907
1907
  () => {
1908
1908
  if (!internal.current)
@@ -2084,7 +2084,7 @@ var require_index_native6 = __commonJS({
2084
2084
  useDidFinishSSR: () => useDidFinishSSR
2085
2085
  });
2086
2086
  module2.exports = __toCommonJS2(src_exports2);
2087
- var import_react = require("react");
2087
+ var import_react3 = require("react");
2088
2088
  function useDidFinishSSR(value) {
2089
2089
  return value ?? !0;
2090
2090
  }
@@ -3465,7 +3465,7 @@ var require_getSplitStyles_native = __commonJS({
3465
3465
  useSplitStyles: () => useSplitStyles
3466
3466
  });
3467
3467
  module2.exports = __toCommonJS2(getSplitStyles_exports);
3468
- var import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_react = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), fontFamilyKey = "fontFamily", IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-", getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3468
+ var import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), fontFamilyKey = "fontFamily", IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-", getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3469
3469
  var _a, _b, _c, _e, _f, _g;
3470
3470
  conf = conf || (0, import_config.getConfig)();
3471
3471
  let { shorthands } = conf, {
@@ -3875,7 +3875,7 @@ current`, {
3875
3875
  for (let key in cur)
3876
3876
  key in styleState.usedKeys || mergeStyle(styleState, key, cur[key]);
3877
3877
  }
3878
- var useInsertEffectCompat = import_constants2.isWeb ? import_react.useInsertionEffect || import_constants2.useIsomorphicLayoutEffect : () => {
3878
+ var useInsertEffectCompat = import_constants2.isWeb ? import_react3.useInsertionEffect || import_constants2.useIsomorphicLayoutEffect : () => {
3879
3879
  }, useSplitStyles = (...args) => {
3880
3880
  let res = getSplitStyles(...args);
3881
3881
  return useInsertEffectCompat(() => {
@@ -4030,7 +4030,7 @@ var require_ThemeManagerContext_native = __commonJS({
4030
4030
  ThemeManagerContext: () => ThemeManagerContext
4031
4031
  });
4032
4032
  module2.exports = __toCommonJS2(ThemeManagerContext_exports);
4033
- var import_react = require("react"), ThemeManagerContext = (0, import_react.createContext)(null);
4033
+ var import_react3 = require("react"), ThemeManagerContext = (0, import_react3.createContext)(null);
4034
4034
  }
4035
4035
  });
4036
4036
 
@@ -4072,7 +4072,7 @@ var require_ThemeManager_native = __commonJS({
4072
4072
  }
4073
4073
  updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
4074
4074
  if (this.props = props, props.forceTheme)
4075
- return this.state.theme = props.forceTheme, this.state.name = props.name || "", !0;
4075
+ return this.state.theme = props.forceTheme, this.state.name = props.name || "", this.updateState(this.state, !0), this.state;
4076
4076
  let nextState = this.getStateIfChanged(props);
4077
4077
  if (nextState)
4078
4078
  return this.updateState(nextState, shouldNotify), nextState;
@@ -4123,7 +4123,7 @@ var require_ThemeManager_native = __commonJS({
4123
4123
  if (!baseManager && props.reset)
4124
4124
  return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
4125
4125
  let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
4126
- baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][a-z]+/, ""));
4126
+ baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][A-Za-z]+/, ""));
4127
4127
  let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
4128
4128
  isDirectParentAComponentTheme && allComponentThemes.shift();
4129
4129
  let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
@@ -4222,7 +4222,7 @@ var require_useTheme_native = __commonJS({
4222
4222
  useThemeWithState: () => useThemeWithState
4223
4223
  });
4224
4224
  module2.exports = __toCommonJS2(useTheme_exports);
4225
- var import_constants2 = require_index_native2(), import_react = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createProxy = require_createProxy_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_getThemeUnwrapped = require_getThemeUnwrapped_native(), emptyProps = { name: null }, cached;
4225
+ var import_constants2 = require_index_native2(), import_react3 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createProxy = require_createProxy_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_getThemeUnwrapped = require_getThemeUnwrapped_native(), emptyProps = { name: null }, cached;
4226
4226
  function getDefaultThemeProxied() {
4227
4227
  if (cached)
4228
4228
  return cached;
@@ -4233,7 +4233,7 @@ var require_useTheme_native = __commonJS({
4233
4233
  let [_, theme] = useThemeWithState(props);
4234
4234
  return theme || getDefaultThemeProxied();
4235
4235
  }, useThemeWithState = (props) => {
4236
- let keys = (0, import_react.useRef)([]), changedThemeState = useChangeThemeEffect(
4236
+ let keys = (0, import_react3.useRef)([]), changedThemeState = useChangeThemeEffect(
4237
4237
  props,
4238
4238
  !1,
4239
4239
  keys.current,
@@ -4253,7 +4253,7 @@ var require_useTheme_native = __commonJS({
4253
4253
 
4254
4254
  If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`
4255
4255
  );
4256
- let themeProxied = (0, import_react.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state, themeManager, props.deopt, props.debug]);
4256
+ let themeProxied = (0, import_react3.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state == null ? void 0 : state.theme, themeManager, props.deopt, props.debug]);
4257
4257
  return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
4258
4258
  };
4259
4259
  function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
@@ -4326,14 +4326,14 @@ If this is intended and you are using Tamagui without any themes, you can disabl
4326
4326
  return !1;
4327
4327
  }
4328
4328
  var activeThemeManagers = /* @__PURE__ */ new Set(), useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
4329
- let { disable } = props, parentManager = (0, import_react.useContext)(import_ThemeManagerContext.ThemeManagerContext);
4329
+ let { disable } = props, parentManager = (0, import_react3.useContext)(import_ThemeManagerContext.ThemeManagerContext);
4330
4330
  if (!isRoot && !parentManager || disable)
4331
4331
  return {
4332
4332
  isNewTheme: !1,
4333
4333
  state: parentManager == null ? void 0 : parentManager.state,
4334
4334
  themeManager: parentManager
4335
4335
  };
4336
- let [themeState, setThemeState] = (0, import_react.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
4336
+ let [themeState, setThemeState] = (0, import_react3.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
4337
4337
  function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
4338
4338
  let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
4339
4339
  if (!manager || !forceShouldChange && forceUpdate === !1)
@@ -4342,7 +4342,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
4342
4342
  if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState)))
4343
4343
  return next;
4344
4344
  }
4345
- if (import_constants2.isServer || ((0, import_react.useLayoutEffect)(() => {
4345
+ if (import_constants2.isServer || ((0, import_react3.useLayoutEffect)(() => {
4346
4346
  if (!themeManager)
4347
4347
  return;
4348
4348
  if (props.inverse && !mounted) {
@@ -4355,17 +4355,20 @@ If this is intended and you are using Tamagui without any themes, you can disabl
4355
4355
  isNewTheme && themeManager && activeThemeManagers.add(themeManager), (isNewTheme || getShouldUpdateTheme(themeManager)) && setThemeState(createState);
4356
4356
  let selfListenerDispose = themeManager.onChangeTheme((_a, _b, forced) => {
4357
4357
  forced && setThemeState((prev) => createState(prev, !0));
4358
- }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme((name, manager) => {
4359
- let force = (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
4360
- process.env.NODE_ENV === "development" && props.debug && console.info(" \u{1F538} onChange", themeManager.id, {
4361
- force,
4362
- shouldTryUpdate,
4363
- props,
4364
- name,
4365
- manager,
4366
- keys
4367
- }), shouldTryUpdate && setThemeState(createState);
4368
- }, themeManager.id);
4358
+ }), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(
4359
+ (name, manager, forced) => {
4360
+ let force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
4361
+ process.env.NODE_ENV === "development" && props.debug && console.info(" \u{1F538} onChange", themeManager.id, {
4362
+ force,
4363
+ shouldTryUpdate,
4364
+ props,
4365
+ name,
4366
+ manager,
4367
+ keys
4368
+ }), shouldTryUpdate && setThemeState(createState);
4369
+ },
4370
+ themeManager.id
4371
+ );
4369
4372
  return () => {
4370
4373
  selfListenerDispose(), disposeChangeListener == null || disposeChangeListener(), activeThemeManagers.delete(themeManager);
4371
4374
  };
@@ -4378,7 +4381,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
4378
4381
  props.name,
4379
4382
  props.reset,
4380
4383
  mounted
4381
- ]), process.env.NODE_ENV === "development" && props.debug !== "profile" && (0, import_react.useEffect)(() => (globalThis.TamaguiThemeManagers ??= /* @__PURE__ */ new Set(), globalThis.TamaguiThemeManagers.add(themeManager), () => {
4384
+ ]), process.env.NODE_ENV === "development" && props.debug !== "profile" && (0, import_react3.useEffect)(() => (globalThis.TamaguiThemeManagers ??= /* @__PURE__ */ new Set(), globalThis.TamaguiThemeManagers.add(themeManager), () => {
4382
4385
  globalThis.TamaguiThemeManagers.delete(themeManager);
4383
4386
  }), [themeManager])), isInversingOnMount)
4384
4387
  return {
@@ -4398,14 +4401,14 @@ If this is intended and you are using Tamagui without any themes, you can disabl
4398
4401
  themeManager
4399
4402
  };
4400
4403
  function createState(prev, force = !1) {
4401
- if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1)
4404
+ if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1 && !force)
4402
4405
  return prev;
4403
4406
  let themeManager2 = parentManager, state2;
4404
4407
  if ((0, import_ThemeManager.getHasThemeUpdatingProps)(props)) {
4405
4408
  let getNewThemeManager = () => new import_ThemeManager.ThemeManager(props, isRoot ? "root" : parentManager);
4406
4409
  if (prev != null && prev.themeManager) {
4407
4410
  themeManager2 = prev.themeManager;
4408
- let forceChange = !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
4411
+ let forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(
4409
4412
  themeManager2,
4410
4413
  next,
4411
4414
  prev.state,
@@ -4498,17 +4501,17 @@ var require_Theme_native = __commonJS({
4498
4501
  useThemedChildren: () => useThemedChildren
4499
4502
  });
4500
4503
  module2.exports = __toCommonJS2(Theme_exports);
4501
- var import_constants2 = require_index_native2(), import_react = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime = require("react/jsx-runtime"), Theme = (0, import_react.forwardRef)(function(props, ref) {
4504
+ var import_constants2 = require_index_native2(), import_react3 = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime = require("react/jsx-runtime"), Theme = (0, import_react3.forwardRef)(function(props, ref) {
4502
4505
  if (props.disable)
4503
4506
  return props.children;
4504
- let isRoot = !!props._isRoot, disableDirectChildTheme = props["disable-child-theme"], themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot), children = (0, import_react.useMemo)(() => {
4505
- let children2 = disableDirectChildTheme ? import_react.Children.map(
4507
+ let isRoot = !!props._isRoot, disableDirectChildTheme = props["disable-child-theme"], themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot), children = (0, import_react3.useMemo)(() => {
4508
+ let children2 = disableDirectChildTheme ? import_react3.Children.map(
4506
4509
  props.children,
4507
- (child) => (0, import_react.cloneElement)(child, { "data-disable-theme": !0 })
4510
+ (child) => (0, import_react3.cloneElement)(child, { "data-disable-theme": !0 })
4508
4511
  ) : props.children;
4509
4512
  if (ref)
4510
4513
  try {
4511
- import_react.default.Children.only(children2), children2 = (0, import_react.cloneElement)(children2, { ref });
4514
+ import_react3.default.Children.only(children2), children2 = (0, import_react3.cloneElement)(children2, { ref });
4512
4515
  } catch {
4513
4516
  }
4514
4517
  return process.env.NODE_ENV === "development" && props.debug === "visualize" && (children2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: children2 })), children2;
@@ -4517,11 +4520,11 @@ var require_Theme_native = __commonJS({
4517
4520
  });
4518
4521
  Theme.avoidForwardRef = !0;
4519
4522
  function useThemedChildren(themeState, children, props, isRoot = !1, avoidWrap = !1) {
4520
- let { themeManager, isNewTheme } = themeState, { shallow, forceClassName } = props, hasEverThemed = (0, import_react.useRef)(!1);
4523
+ let { themeManager, isNewTheme } = themeState, { shallow, forceClassName } = props, hasEverThemed = (0, import_react3.useRef)(!1);
4521
4524
  if (isNewTheme && (hasEverThemed.current = !0), !(isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot))
4522
4525
  return children;
4523
4526
  let next = children;
4524
- shallow && themeManager && (next = import_react.Children.toArray(children).map((child) => (0, import_react.isValidElement)(child) ? (0, import_react.cloneElement)(
4527
+ shallow && themeManager && (next = import_react3.Children.toArray(children).map((child) => (0, import_react3.isValidElement)(child) ? (0, import_react3.cloneElement)(
4525
4528
  child,
4526
4529
  void 0,
4527
4530
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, { name: themeManager.state.parentName, children: child.props.children })
@@ -4580,9 +4583,9 @@ var require_themeable_native = __commonJS({
4580
4583
  themeable: () => themeable
4581
4584
  });
4582
4585
  module2.exports = __toCommonJS2(themeable_exports);
4583
- var import_react = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime = require("react/jsx-runtime");
4586
+ var import_react3 = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime = require("react/jsx-runtime");
4584
4587
  function themeable(Component, staticConfig) {
4585
- let withTheme = (0, import_react.forwardRef)(function(props, ref) {
4588
+ let withTheme = (0, import_react3.forwardRef)(function(props, ref) {
4586
4589
  let { themeInverse, theme, componentName, themeReset, ...rest } = props, element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref, ...rest, "data-disable-theme": !0 });
4587
4590
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4588
4591
  import_Theme.Theme,
@@ -4645,11 +4648,11 @@ var require_Slot_native = __commonJS({
4645
4648
  Slottable: () => Slottable
4646
4649
  });
4647
4650
  module2.exports = __toCommonJS2(Slot_exports);
4648
- var import_compose_refs = require_index_native5(), import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_react = require("react"), import_jsx_runtime = require("react/jsx-runtime"), Slot = (0, import_react.forwardRef)(function(props, forwardedRef) {
4651
+ var import_compose_refs = require_index_native5(), import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_react3 = require("react"), import_jsx_runtime = require("react/jsx-runtime"), Slot = (0, import_react3.forwardRef)(function(props, forwardedRef) {
4649
4652
  let { children, ...slotProps } = props;
4650
- if ((0, import_react.isValidElement)(children)) {
4653
+ if ((0, import_react3.isValidElement)(children)) {
4651
4654
  let mergedProps = mergeSlotProps(children, slotProps);
4652
- return (0, import_react.cloneElement)(
4655
+ return (0, import_react3.cloneElement)(
4653
4656
  children,
4654
4657
  children.type.avoidForwardRef ? mergedProps : {
4655
4658
  ...mergedProps,
@@ -4657,7 +4660,7 @@ var require_Slot_native = __commonJS({
4657
4660
  }
4658
4661
  );
4659
4662
  }
4660
- return import_react.Children.count(children) > 1 ? import_react.Children.only(null) : null;
4663
+ return import_react3.Children.count(children) > 1 ? import_react3.Children.only(null) : null;
4661
4664
  }), Slottable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }), pressMap = import_constants2.isWeb ? {
4662
4665
  onPress: "onClick",
4663
4666
  onPressOut: "onMouseUp",
@@ -4706,7 +4709,7 @@ var require_createComponent_native = __commonJS({
4706
4709
  spacedChildren: () => spacedChildren
4707
4710
  });
4708
4711
  module2.exports = __toCommonJS2(createComponent_exports);
4709
- var import_compose_refs = require_index_native5(), import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_use_did_finish_ssr = require_index_native6(), import_react = __toESM2(require("react")), import_config = require_config_native(), import_constants22 = require_constants_native2(), import_ComponentContext = require_ComponentContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_createShallowSetState = require_createShallowSetState_native(), import_getSplitStyles = require_getSplitStyles_native(), import_mergeProps = require_mergeProps_native(), import_proxyThemeVariables = require_proxyThemeVariables_native(), import_themeable = require_themeable_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime = require("react/jsx-runtime"), tamaguiConfig, AnimatedText, AnimatedView, initialTheme, time, debugKeyListeners, startVisualizer, mouseUps = /* @__PURE__ */ new Set();
4712
+ var import_compose_refs = require_index_native5(), import_constants2 = require_index_native2(), import_helpers = require_index_native4(), import_use_did_finish_ssr = require_index_native6(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_constants22 = require_constants_native2(), import_ComponentContext = require_ComponentContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_createShallowSetState = require_createShallowSetState_native(), import_getSplitStyles = require_getSplitStyles_native(), import_mergeProps = require_mergeProps_native(), import_proxyThemeVariables = require_proxyThemeVariables_native(), import_themeable = require_themeable_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime = require("react/jsx-runtime"), tamaguiConfig, AnimatedText, AnimatedView, initialTheme, time, debugKeyListeners, startVisualizer, mouseUps = /* @__PURE__ */ new Set();
4710
4713
  if (typeof document < "u") {
4711
4714
  let cancelTouches = () => {
4712
4715
  mouseUps.forEach((x) => x()), mouseUps.clear();
@@ -4756,17 +4759,17 @@ var require_createComponent_native = __commonJS({
4756
4759
  defaultProps,
4757
4760
  defaultPropsKeyOrder: defaultProps ? Object.keys(defaultProps) : []
4758
4761
  });
4759
- let component = (0, import_react.forwardRef)((propsIn, forwardedRef) => {
4760
- var _a2, _b, _c, _d, _e, _f, _i, _j, _k, _l, _m, _n, _o;
4762
+ let component = (0, import_react3.forwardRef)((propsIn, forwardedRef) => {
4763
+ var _a2, _b, _c, _d, _e, _f, _i, _j, _k, _l, _m;
4761
4764
  if (process.env.NODE_ENV === "development" && startVisualizer && (startVisualizer(), startVisualizer = void 0), !hasSetupBaseViews) {
4762
4765
  hasSetupBaseViews = !0;
4763
- let baseViews = (_b = (_a2 = import_setupHooks.hooks).getBaseViews) == null ? void 0 : _b.call(_a2);
4764
- baseViews && (BaseText = baseViews.Text, BaseView = baseViews.View);
4766
+ let baseViews2 = (_b = (_a2 = import_setupHooks.hooks).getBaseViews) == null ? void 0 : _b.call(_a2);
4767
+ baseViews2 && (BaseText = baseViews2.Text, BaseView = baseViews2.View);
4765
4768
  }
4766
4769
  process.env.NODE_ENV === "test" && propsIn["data-test-renders"] && (propsIn["data-test-renders"].current ??= 0, propsIn["data-test-renders"].current += 1);
4767
- let componentContext = (0, import_react.useContext)(import_ComponentContext.ComponentContext), styledContextProps, overriddenContextProps, contextValue, { context } = staticConfig;
4770
+ let componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), styledContextProps, overriddenContextProps, contextValue, { context } = staticConfig;
4768
4771
  if (context) {
4769
- contextValue = (0, import_react.useContext)(context);
4772
+ contextValue = (0, import_react3.useContext)(context);
4770
4773
  let { inverseShorthands } = (0, import_config.getConfig)();
4771
4774
  for (let key in context.props) {
4772
4775
  let propVal = (
@@ -4779,7 +4782,7 @@ var require_createComponent_native = __commonJS({
4779
4782
  let curDefaultProps = styledContextProps ? { ...defaultProps, ...styledContextProps } : defaultProps, props = propsIn;
4780
4783
  curDefaultProps && (props = (0, import_mergeProps.mergeProps)(curDefaultProps, propsIn));
4781
4784
  let debugProp = props.debug, componentName = props.componentName || staticConfig.componentName;
4782
- process.env.NODE_ENV === "development" && import_constants2.isClient && (0, import_react.useEffect)(() => {
4785
+ process.env.NODE_ENV === "development" && import_constants2.isClient && (0, import_react3.useEffect)(() => {
4783
4786
  let overlay = null, debugVisualizerHandler = (show = !1) => {
4784
4787
  let node = hostRef.current;
4785
4788
  if (node)
@@ -4796,18 +4799,18 @@ var require_createComponent_native = __commonJS({
4796
4799
  }, [componentName]), process.env.NODE_ENV === "development" && time && time`start (ignore)`;
4797
4800
  let isHydrated = config != null && config.disableSSR ? !0 : (0, import_use_did_finish_ssr.useDidFinishSSR)();
4798
4801
  process.env.NODE_ENV === "development" && time && time`did-finish-ssr`;
4799
- let stateRef = (0, import_react.useRef)(
4802
+ let stateRef = (0, import_react3.useRef)(
4800
4803
  void 0
4801
4804
  );
4802
4805
  stateRef.current ||= {}, process.env.NODE_ENV === "development" && time && time`stateref`;
4803
- let hostRef = (0, import_react.useRef)(null), animationsConfig = componentContext.animationDriver, useAnimations = animationsConfig == null ? void 0 : animationsConfig.useAnimations, hasAnimationProp = !!(props.animation || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationsConfig == null ? void 0 : animationsConfig.supportsCSSVars, willBeAnimated = (() => {
4806
+ let hostRef = (0, import_react3.useRef)(null), animationsConfig = componentContext.animationDriver, useAnimations = animationsConfig == null ? void 0 : animationsConfig.useAnimations, hasAnimationProp = !!(props.animation || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationsConfig == null ? void 0 : animationsConfig.supportsCSSVars, willBeAnimated = (() => {
4804
4807
  if (import_constants2.isServer && !supportsCSSVars)
4805
4808
  return !1;
4806
4809
  let curState = stateRef.current;
4807
4810
  return !!(hasAnimationProp && !isHOC && useAnimations || curState.hasAnimated);
4808
4811
  })(), usePresence = animationsConfig == null ? void 0 : animationsConfig.usePresence, presence = willBeAnimated && (usePresence == null ? void 0 : usePresence()) || null, hasEnterStyle = !!props.enterStyle, needsMount = !!((!import_constants2.isWeb || import_constants2.isClient) && willBeAnimated);
4809
4812
  process.env.NODE_ENV === "development" && time && time`pre-use-state`;
4810
- let initialState = willBeAnimated ? supportsCSSVars ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateMounted, states = (0, import_react.useState)(initialState), state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: !0 } : states[0], setState = states[1], setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState), groupName = props.group, groupClassName = groupName ? `t_group_${props.group}` : "";
4813
+ let initialState = willBeAnimated ? supportsCSSVars ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateMounted, states = (0, import_react3.useState)(initialState), state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: !0 } : states[0], setState = states[1], setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState), groupName = props.group, groupClassName = groupName ? `t_group_${props.group}` : "";
4811
4814
  if (groupName) {
4812
4815
  let groupContextState = componentContext.groups.state, og = setStateShallow;
4813
4816
  setStateShallow = (state2) => {
@@ -4843,17 +4846,12 @@ var require_createComponent_native = __commonJS({
4843
4846
  componentName,
4844
4847
  disable: disableTheme,
4845
4848
  shallow: stateRef.current.themeShallow,
4846
- // if this returns undefined it defers to the keys tracking, so its only used to force either updates or no updates
4847
- shouldUpdate: () => (
4848
- // when we use $theme- styles we need to force it to re-render on theme changes (this can be optimized likely)
4849
- stateRef.current.isListeningToTheme
4850
- ),
4851
4849
  debug: debugProp
4852
4850
  };
4853
- themeStateProps.deopt = willBeAnimated;
4851
+ typeof stateRef.current.isListeningToTheme == "boolean" && (themeStateProps.shouldUpdate = () => stateRef.current.isListeningToTheme), themeStateProps.deopt = willBeAnimated;
4854
4852
  let isExiting = !state.unmounted && (presence == null ? void 0 : presence[0]) === !1;
4855
4853
  if (process.env.NODE_ENV === "development") {
4856
- let id = (0, import_react.useId)();
4854
+ let id = (0, import_react3.useId)();
4857
4855
  if (debugProp && debugProp !== "profile") {
4858
4856
  let name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`, type = isAnimatedReactNative ? "(animated)" : isReactNative ? "(rnw)" : "", dataIs = propsIn["data-is"] || "", banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type} id ${id}`;
4859
4857
  console.group(
@@ -4991,7 +4989,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
4991
4989
  }
4992
4990
  )), viewProps = nonTamaguiProps;
4993
4991
  let composedRef = (0, import_compose_refs.useComposedRefs)(hostRef, forwardedRef);
4994
- viewProps.ref = composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && import_constants2.isWeb && !isHOC && import_react.Children.toArray(props.children).forEach((item) => {
4992
+ viewProps.ref = composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && import_constants2.isWeb && !isHOC && import_react3.Children.toArray(props.children).forEach((item) => {
4995
4993
  typeof item == "string" && item !== `
4996
4994
  ` && console.error(
4997
4995
  `Unexpected text node: ${item}. A text node cannot be a child of a <View>.`
@@ -5001,7 +4999,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5001
4999
  press: !1,
5002
5000
  pressIn: !1
5003
5001
  }), shouldSetMounted = needsMount && state.unmounted, { pseudoGroups, mediaGroups } = splitStyles;
5004
- (0, import_react.useEffect)(() => {
5002
+ (0, import_react3.useEffect)(() => {
5005
5003
  if (shouldSetMounted) {
5006
5004
  let unmounted = state.unmounted === !0 && hasEnterStyle ? "should-enter" : !1;
5007
5005
  setStateShallow({
@@ -5111,12 +5109,16 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5111
5109
  isZStack,
5112
5110
  debug: debugProp
5113
5111
  });
5114
- asChild && (elementType = import_Slot.Slot, Object.assign(viewProps, { onPress, onLongPress })), process.env.NODE_ENV === "development" && time && time`spaced-as-child`, // in test mode disable perf unwrapping so react-testing-library finds Text properly
5115
- process.env.NODE_ENV !== "test" && (elementType === BaseText || elementType === BaseView) ? process.env.TAMAGUI_OPTIMIZE_NATIVE_VIEWS ? (viewProps.children = content, content = (0, import_react.createElement)(
5116
- elementType === BaseText ? "RCTText" : "RCTView",
5117
- viewProps
5118
- )) : (viewProps.children = content, content = elementType.render(viewProps, viewProps.ref)) : content = (0, import_react.createElement)(elementType, viewProps, content), import_setupHooks.hooks.useChildren && (content = (_m = (_l = import_setupHooks.hooks).useChildren) == null ? void 0 : _m.call(_l, content, viewProps, events, staticConfig)), process.env.NODE_ENV === "development" && time && time`create-element`;
5119
- let subGroupContext = (0, import_react.useMemo)(() => {
5112
+ asChild && (elementType = import_Slot.Slot, Object.assign(viewProps, { onPress, onLongPress })), process.env.NODE_ENV === "development" && time && time`spaced-as-child`;
5113
+ let useChildrenResult;
5114
+ import_setupHooks.hooks.useChildren && (useChildrenResult = import_setupHooks.hooks.useChildren(
5115
+ elementType,
5116
+ content,
5117
+ viewProps,
5118
+ events,
5119
+ staticConfig
5120
+ )), useChildrenResult ? content = useChildrenResult : content = (0, import_react3.createElement)(elementType, viewProps, content), process.env.NODE_ENV === "development" && time && time`create-element`;
5121
+ let subGroupContext = (0, import_react3.useMemo)(() => {
5120
5122
  if (groupName)
5121
5123
  return {
5122
5124
  ...componentContext.groups,
@@ -5163,8 +5165,8 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5163
5165
  handlesPressEvents,
5164
5166
  willBeAnimated,
5165
5167
  isStringElement,
5166
- classNamesIn: (_n = props.className) == null ? void 0 : _n.split(" "),
5167
- classNamesOut: (_o = viewProps.className) == null ? void 0 : _o.split(" "),
5168
+ classNamesIn: (_l = props.className) == null ? void 0 : _l.split(" "),
5169
+ classNamesOut: (_m = viewProps.className) == null ? void 0 : _m.split(" "),
5168
5170
  events,
5169
5171
  shouldAttach,
5170
5172
  pseudos,
@@ -5189,7 +5191,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5189
5191
  });
5190
5192
  staticConfig.componentName && (component.displayName = staticConfig.componentName);
5191
5193
  let res = component;
5192
- (process.env.TAMAGUI_FORCE_MEMO || staticConfig.memo) && (res = (0, import_react.memo)(res)), res.staticConfig = staticConfig;
5194
+ (process.env.TAMAGUI_FORCE_MEMO || staticConfig.memo) && (res = (0, import_react3.memo)(res)), res.staticConfig = staticConfig;
5193
5195
  function extendStyledConfig(extended) {
5194
5196
  return {
5195
5197
  ...staticConfig,
@@ -5206,7 +5208,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5206
5208
  var _a2;
5207
5209
  let ComponentForwardedRef = ((_a2 = Component2.render) == null ? void 0 : _a2.length) === 2 ? Component2 : (
5208
5210
  // memo because theme changes otherwise would always re-render
5209
- (0, import_react.memo)((0, import_react.forwardRef)(Component2))
5211
+ (0, import_react3.memo)((0, import_react3.forwardRef)(Component2))
5210
5212
  ), extendedConfig = extendStyledConfig(options == null ? void 0 : options.staticConfig), out = options != null && options.disableTheme ? ComponentForwardedRef : (0, import_themeable.themeable)(ComponentForwardedRef, extendedConfig);
5211
5213
  return out.staticConfig = extendedConfig, out.styleable = styleable, out;
5212
5214
  }
@@ -5264,19 +5266,19 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5264
5266
  let { isZStack, children, space, direction, spaceFlex, separator } = props, hasSpace = !!(space || spaceFlex), hasSeparator = separator != null;
5265
5267
  if (!(hasSpace || hasSeparator || isZStack))
5266
5268
  return children;
5267
- let childrenList = import_react.Children.toArray(children);
5269
+ let childrenList = import_react3.Children.toArray(children);
5268
5270
  if (childrenList.length <= 1 && !isZStack && !((_b = (_a = childrenList[0]) == null ? void 0 : _a.type) != null && _b.shouldForwardSpace))
5269
5271
  return childrenList;
5270
5272
  let final = [];
5271
5273
  for (let [index, child] of childrenList.entries()) {
5272
5274
  let isEmpty = child == null || Array.isArray(child) && child.length === 0;
5273
- if (!isEmpty && import_react.default.isValidElement(child) && (_c = child.type) != null && _c.shouldForwardSpace && (child = import_react.default.cloneElement(child, {
5275
+ if (!isEmpty && import_react3.default.isValidElement(child) && (_c = child.type) != null && _c.shouldForwardSpace && (child = import_react3.default.cloneElement(child, {
5274
5276
  space,
5275
5277
  spaceFlex,
5276
5278
  separator,
5277
5279
  key: child.key
5278
5280
  })), isEmpty || !child || child.key && !isZStack ? final.push(child) : final.push(
5279
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: isZStack ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AbsoluteFill, { children: child }) : child }, index)
5281
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react3.Fragment, { children: isZStack ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AbsoluteFill, { children: child }) : child }, index)
5280
5282
  ), isUnspaced(child) && index === 0 || isZStack)
5281
5283
  continue;
5282
5284
  let next = childrenList[index + 1];
@@ -5288,7 +5290,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5288
5290
  spaceFlex
5289
5291
  })
5290
5292
  ), final.push(
5291
- import_react.default.isValidElement(separator) ? import_react.default.cloneElement(separator, { key: `sep_${index}` }) : separator
5293
+ import_react3.default.isValidElement(separator) ? import_react3.default.cloneElement(separator, { key: `sep_${index}` }) : separator
5292
5294
  ), hasSpace && final.push(
5293
5295
  createSpacer({
5294
5296
  key: `_${index}01tmgui`,
@@ -6159,7 +6161,7 @@ var require_isTamaguiElement_native = __commonJS({
6159
6161
  isTamaguiElement: () => isTamaguiElement
6160
6162
  });
6161
6163
  module2.exports = __toCommonJS2(isTamaguiElement_exports);
6162
- var import_react = require("react"), import_isTamaguiComponent = require_isTamaguiComponent_native(), isTamaguiElement = (child, name) => (0, import_react.isValidElement)(child) && (0, import_isTamaguiComponent.isTamaguiComponent)(child.type, name);
6164
+ var import_react3 = require("react"), import_isTamaguiComponent = require_isTamaguiComponent_native(), isTamaguiElement = (child, name) => (0, import_react3.isValidElement)(child) && (0, import_isTamaguiComponent.isTamaguiComponent)(child.type, name);
6163
6165
  }
6164
6166
  });
6165
6167
 
@@ -6180,11 +6182,11 @@ var require_withStaticProperties_native = __commonJS({
6180
6182
  withStaticProperties: () => withStaticProperties
6181
6183
  });
6182
6184
  module2.exports = __toCommonJS2(withStaticProperties_exports);
6183
- var import_react = require("react"), Decorated = Symbol(), withStaticProperties = function(component, staticProps) {
6185
+ var import_react3 = require("react"), Decorated = Symbol(), withStaticProperties = function(component, staticProps) {
6184
6186
  let next = (() => {
6185
6187
  if (component[Decorated]) {
6186
- let _ = (0, import_react.forwardRef)(
6187
- (props, ref) => (0, import_react.createElement)(component, { ...props, ref })
6188
+ let _ = (0, import_react3.forwardRef)(
6189
+ (props, ref) => (0, import_react3.createElement)(component, { ...props, ref })
6188
6190
  );
6189
6191
  for (let key in component) {
6190
6192
  let v = component[key];
@@ -6215,9 +6217,9 @@ var require_useThemeName_native = __commonJS({
6215
6217
  useThemeName: () => useThemeName
6216
6218
  });
6217
6219
  module2.exports = __toCommonJS2(useThemeName_exports);
6218
- var import_constants2 = require_index_native2(), import_react = require("react"), import_ThemeManagerContext = require_ThemeManagerContext_native();
6220
+ var import_constants2 = require_index_native2(), import_react3 = require("react"), import_ThemeManagerContext = require_ThemeManagerContext_native();
6219
6221
  function useThemeName(opts) {
6220
- let manager = (0, import_react.useContext)(import_ThemeManagerContext.ThemeManagerContext), [name, setName] = (0, import_react.useState)((manager == null ? void 0 : manager.state.name) || "");
6222
+ let manager = (0, import_react3.useContext)(import_ThemeManagerContext.ThemeManagerContext), [name, setName] = (0, import_react3.useState)((manager == null ? void 0 : manager.state.name) || "");
6221
6223
  return (0, import_constants2.useIsomorphicLayoutEffect)(() => {
6222
6224
  if (manager)
6223
6225
  return setName(manager.state.name), manager.onChangeTheme((next, manager2) => {
@@ -6246,8 +6248,8 @@ var require_useConfiguration_native = __commonJS({
6246
6248
  useConfiguration: () => useConfiguration
6247
6249
  });
6248
6250
  module2.exports = __toCommonJS2(useConfiguration_exports);
6249
- var import_react = require("react"), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native(), useConfiguration = () => {
6250
- let { groups, animationDriver, ...restComponentConfig } = (0, import_react.useContext)(import_ComponentContext.ComponentContext), { animations, ...restConfig } = (0, import_config.getConfig)();
6251
+ var import_react3 = require("react"), import_config = require_config_native(), import_ComponentContext = require_ComponentContext_native(), useConfiguration = () => {
6252
+ let { groups, animationDriver, ...restComponentConfig } = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), { animations, ...restConfig } = (0, import_config.getConfig)();
6251
6253
  return {
6252
6254
  ...restConfig,
6253
6255
  ...restComponentConfig,
@@ -6322,7 +6324,7 @@ var require_useProps_native = __commonJS({
6322
6324
  useStyle: () => useStyle
6323
6325
  });
6324
6326
  module2.exports = __toCommonJS2(useProps_exports);
6325
- var import_react = require("react"), import_ComponentContext = require_ComponentContext_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getSplitStyles = require_getSplitStyles_native(), import_Stack = require_Stack_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native();
6327
+ var import_react3 = require("react"), import_ComponentContext = require_ComponentContext_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getSplitStyles = require_getSplitStyles_native(), import_Stack = require_Stack_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native();
6326
6328
  function useProps(props, opts) {
6327
6329
  let [propsOut, styleOut] = usePropsAndStyle(props, {
6328
6330
  ...opts,
@@ -6342,7 +6344,7 @@ var require_useProps_native = __commonJS({
6342
6344
  var _a, _b;
6343
6345
  let staticConfig = ((_a = opts == null ? void 0 : opts.forComponent) == null ? void 0 : _a.staticConfig) ?? import_Stack.Stack.staticConfig, [themeState, theme] = (0, import_useTheme.useThemeWithState)({
6344
6346
  componentName: staticConfig.componentName
6345
- }), componentContext = (0, import_react.useContext)(import_ComponentContext.ComponentContext), media = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(
6347
+ }), componentContext = (0, import_react3.useContext)(import_ComponentContext.ComponentContext), media = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(
6346
6348
  props,
6347
6349
  staticConfig,
6348
6350
  theme,
@@ -6453,7 +6455,7 @@ var require_ThemeProvider_native = __commonJS({
6453
6455
  ThemeProvider: () => ThemeProvider
6454
6456
  });
6455
6457
  module2.exports = __toCommonJS2(ThemeProvider_exports);
6456
- var import_constants2 = require_index_native2(), import_react = require("react"), import_constants22 = require_constants_native2(), import_Theme = require_Theme_native(), import_jsx_runtime = require("react/jsx-runtime"), ThemeProvider = (props) => (import_constants2.isClient && (0, import_react.useLayoutEffect)(() => {
6458
+ var import_constants2 = require_index_native2(), import_react3 = require("react"), import_constants22 = require_constants_native2(), import_Theme = require_Theme_native(), import_jsx_runtime = require("react/jsx-runtime"), ThemeProvider = (props) => (import_constants2.isClient && (0, import_react3.useLayoutEffect)(() => {
6457
6459
  if (props.disableRootThemeClass)
6458
6460
  return;
6459
6461
  let cn = `${import_constants22.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`, target = props.themeClassNameOnRoot ? document.documentElement : document.body;
@@ -6490,8 +6492,8 @@ var require_FontLanguage_native = __commonJS({
6490
6492
  FontLanguage: () => FontLanguage
6491
6493
  });
6492
6494
  module2.exports = __toCommonJS2(FontLanguage_native_exports);
6493
- var import_react = require("react"), import_ComponentContext = require_ComponentContext_native(), import_jsx_runtime = require("react/jsx-runtime"), FontLanguage = ({ children, ...props }) => {
6494
- let language = (0, import_react.useMemo)(() => props, [JSON.stringify(props)]);
6495
+ var import_react3 = require("react"), import_ComponentContext = require_ComponentContext_native(), import_jsx_runtime = require("react/jsx-runtime"), FontLanguage = ({ children, ...props }) => {
6496
+ let language = (0, import_react3.useMemo)(() => props, [JSON.stringify(props)]);
6495
6497
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { language, children });
6496
6498
  };
6497
6499
  }
@@ -6587,12 +6589,12 @@ var require_useGet_native = __commonJS({
6587
6589
  useGet: () => useGet
6588
6590
  });
6589
6591
  module2.exports = __toCommonJS2(useGet_exports);
6590
- var import_react = require("react"), isWeb = !1, isClient = typeof window < "u", useIsomorphicLayoutEffect3 = !isWeb || isClient ? import_react.useLayoutEffect : import_react.useEffect;
6592
+ var import_react3 = require("react"), isWeb = !1, isClient = typeof window < "u", useIsomorphicLayoutEffect3 = !isWeb || isClient ? import_react3.useLayoutEffect : import_react3.useEffect;
6591
6593
  function useGet(currentValue, initialValue, forwardToFunction) {
6592
- let curRef = (0, import_react.useRef)(initialValue ?? currentValue);
6594
+ let curRef = (0, import_react3.useRef)(initialValue ?? currentValue);
6593
6595
  return useIsomorphicLayoutEffect3(() => {
6594
6596
  curRef.current = currentValue;
6595
- }), (0, import_react.useCallback)(
6597
+ }), (0, import_react3.useCallback)(
6596
6598
  forwardToFunction ? (...args) => {
6597
6599
  var _a;
6598
6600
  return (_a = curRef.current) == null ? void 0 : _a.apply(null, args);
@@ -6794,14 +6796,217 @@ __export(src_exports, {
6794
6796
  Text: () => Text
6795
6797
  });
6796
6798
  module.exports = __toCommonJS(src_exports);
6797
- var import_react_native_use_responder_events = __toESM(require_index_native()), import_web2 = __toESM(require_index_native9());
6799
+ var import_react_native_use_responder_events = __toESM(require_index_native()), import_web2 = __toESM(require_index_native9()), import_react2 = require("react");
6800
+
6801
+ // src/createOptimizedView.native.tsx
6802
+ var import_react = require("react");
6803
+ function createOptimizedView(children, viewProps, baseViews2) {
6804
+ let TextAncestor = baseViews2.TextAncestor, ViewNativeComponent = baseViews2.View, {
6805
+ accessibilityElementsHidden,
6806
+ accessibilityLabel,
6807
+ accessibilityLabelledBy,
6808
+ accessibilityLiveRegion,
6809
+ accessibilityRole,
6810
+ accessibilityState,
6811
+ accessibilityValue,
6812
+ "aria-busy": ariaBusy,
6813
+ "aria-checked": ariaChecked,
6814
+ "aria-disabled": ariaDisabled,
6815
+ "aria-expanded": ariaExpanded,
6816
+ "aria-hidden": ariaHidden,
6817
+ "aria-label": ariaLabel,
6818
+ "aria-labelledby": ariaLabelledBy,
6819
+ "aria-live": ariaLive,
6820
+ "aria-selected": ariaSelected,
6821
+ "aria-valuemax": ariaValueMax,
6822
+ "aria-valuemin": ariaValueMin,
6823
+ "aria-valuenow": ariaValueNow,
6824
+ "aria-valuetext": ariaValueText,
6825
+ focusable,
6826
+ id,
6827
+ importantForAccessibility,
6828
+ nativeID,
6829
+ pointerEvents,
6830
+ role,
6831
+ tabIndex
6832
+ // ...otherProps
6833
+ } = viewProps, _accessibilityLabelledBy = (ariaLabelledBy == null ? void 0 : ariaLabelledBy.split(/\s*,\s*/g)) ?? accessibilityLabelledBy, _accessibilityState;
6834
+ (accessibilityState != null || ariaBusy != null || ariaChecked != null || ariaDisabled != null || ariaExpanded != null || ariaSelected != null) && (_accessibilityState = {
6835
+ busy: ariaBusy ?? (accessibilityState == null ? void 0 : accessibilityState.busy),
6836
+ checked: ariaChecked ?? (accessibilityState == null ? void 0 : accessibilityState.checked),
6837
+ disabled: ariaDisabled ?? (accessibilityState == null ? void 0 : accessibilityState.disabled),
6838
+ expanded: ariaExpanded ?? (accessibilityState == null ? void 0 : accessibilityState.expanded),
6839
+ selected: ariaSelected ?? (accessibilityState == null ? void 0 : accessibilityState.selected)
6840
+ });
6841
+ let _accessibilityValue;
6842
+ (accessibilityValue != null || ariaValueMax != null || ariaValueMin != null || ariaValueNow != null || ariaValueText != null) && (_accessibilityValue = {
6843
+ max: ariaValueMax ?? (accessibilityValue == null ? void 0 : accessibilityValue.max),
6844
+ min: ariaValueMin ?? (accessibilityValue == null ? void 0 : accessibilityValue.min),
6845
+ now: ariaValueNow ?? (accessibilityValue == null ? void 0 : accessibilityValue.now),
6846
+ text: ariaValueText ?? (accessibilityValue == null ? void 0 : accessibilityValue.text)
6847
+ });
6848
+ let style = Array.isArray(viewProps.style) ? baseViews2.StyleSheet.flatten(viewProps.style) : viewProps.style, newPointerEvents = (style == null ? void 0 : style.pointerEvents) || pointerEvents, finalProps = viewProps, extras = {
6849
+ accessibilityLiveRegion: ariaLive === "off" ? "none" : ariaLive ?? accessibilityLiveRegion,
6850
+ accessibilityLabel: ariaLabel ?? accessibilityLabel,
6851
+ focusable: tabIndex !== void 0 ? !tabIndex : focusable,
6852
+ accessibilityState: _accessibilityState,
6853
+ accessibilityRole: role ? getAccessibilityRoleFromRole(role) : accessibilityRole,
6854
+ accessibilityElementsHidden: ariaHidden ?? accessibilityElementsHidden,
6855
+ accessibilityLabelledBy: _accessibilityLabelledBy,
6856
+ accessibilityValue: _accessibilityValue,
6857
+ importantForAccessibility: ariaHidden === !0 ? "no-hide-descendants" : importantForAccessibility,
6858
+ nativeID: id ?? nativeID,
6859
+ style,
6860
+ pointerEvents: newPointerEvents
6861
+ };
6862
+ for (let key in extras)
6863
+ extras[key] != null && (finalProps[key] = extras[key]);
6864
+ let isInText = (0, import_react.useContext)(TextAncestor), finalElement = (0, import_react.createElement)(ViewNativeComponent, finalProps, children);
6865
+ return isInText ? (0, import_react.createElement)(TextAncestor.Provider, { value: !1 }, finalElement) : finalElement;
6866
+ }
6867
+ function getAccessibilityRoleFromRole(role) {
6868
+ switch (role) {
6869
+ case "alert":
6870
+ return "alert";
6871
+ case "alertdialog":
6872
+ return;
6873
+ case "application":
6874
+ return;
6875
+ case "article":
6876
+ return;
6877
+ case "banner":
6878
+ return;
6879
+ case "button":
6880
+ return "button";
6881
+ case "cell":
6882
+ return;
6883
+ case "checkbox":
6884
+ return "checkbox";
6885
+ case "columnheader":
6886
+ return;
6887
+ case "combobox":
6888
+ return "combobox";
6889
+ case "complementary":
6890
+ return;
6891
+ case "contentinfo":
6892
+ return;
6893
+ case "definition":
6894
+ return;
6895
+ case "dialog":
6896
+ return;
6897
+ case "directory":
6898
+ return;
6899
+ case "document":
6900
+ return;
6901
+ case "feed":
6902
+ return;
6903
+ case "figure":
6904
+ return;
6905
+ case "form":
6906
+ return;
6907
+ case "grid":
6908
+ return "grid";
6909
+ case "group":
6910
+ return;
6911
+ case "heading":
6912
+ return "header";
6913
+ case "img":
6914
+ return "image";
6915
+ case "link":
6916
+ return "link";
6917
+ case "list":
6918
+ return "list";
6919
+ case "listitem":
6920
+ return;
6921
+ case "log":
6922
+ return;
6923
+ case "main":
6924
+ return;
6925
+ case "marquee":
6926
+ return;
6927
+ case "math":
6928
+ return;
6929
+ case "menu":
6930
+ return "menu";
6931
+ case "menubar":
6932
+ return "menubar";
6933
+ case "menuitem":
6934
+ return "menuitem";
6935
+ case "meter":
6936
+ return;
6937
+ case "navigation":
6938
+ return;
6939
+ case "none":
6940
+ return "none";
6941
+ case "note":
6942
+ return;
6943
+ case "option":
6944
+ return;
6945
+ case "presentation":
6946
+ return "none";
6947
+ case "progressbar":
6948
+ return "progressbar";
6949
+ case "radio":
6950
+ return "radio";
6951
+ case "radiogroup":
6952
+ return "radiogroup";
6953
+ case "region":
6954
+ return;
6955
+ case "row":
6956
+ return;
6957
+ case "rowgroup":
6958
+ return;
6959
+ case "rowheader":
6960
+ return;
6961
+ case "scrollbar":
6962
+ return "scrollbar";
6963
+ case "searchbox":
6964
+ return "search";
6965
+ case "separator":
6966
+ return;
6967
+ case "slider":
6968
+ return "adjustable";
6969
+ case "spinbutton":
6970
+ return "spinbutton";
6971
+ case "status":
6972
+ return;
6973
+ case "summary":
6974
+ return "summary";
6975
+ case "switch":
6976
+ return "switch";
6977
+ case "tab":
6978
+ return "tab";
6979
+ case "table":
6980
+ return;
6981
+ case "tablist":
6982
+ return "tablist";
6983
+ case "tabpanel":
6984
+ return;
6985
+ case "term":
6986
+ return;
6987
+ case "timer":
6988
+ return "timer";
6989
+ case "toolbar":
6990
+ return "toolbar";
6991
+ case "tooltip":
6992
+ return;
6993
+ case "tree":
6994
+ return;
6995
+ case "treegrid":
6996
+ return;
6997
+ case "treeitem":
6998
+ return;
6999
+ }
7000
+ }
6798
7001
 
6799
7002
  // src/getBaseViews.native.ts
6800
7003
  function getBaseViews() {
6801
- let native = require("react-native");
6802
- return {
6803
- View: native.View || native.default.View,
7004
+ let native = require("react-native"), View, TextAncestor;
7005
+ return process.env.NODE_ENV !== "test" && (View = require("react-native/Libraries/Components/View/ViewNativeComponent").default, TextAncestor = require("react-native/Libraries/Text/TextAncestor")), View || (View = native.View || native.default.View), {
7006
+ View,
6804
7007
  Text: native.Text || native.default.Text,
7008
+ StyleSheet: native.StyleSheet || native.default.StyleSheet,
7009
+ TextAncestor,
6805
7010
  Pressable: native.Pressable || native.default.Pressable
6806
7011
  };
6807
7012
  }
@@ -6881,7 +7086,7 @@ var Pressability = require_fake_react_native().default, usePressability = (init_
6881
7086
 
6882
7087
  // src/index.tsx
6883
7088
  __reExport(src_exports, __toESM(require_index_native9()), module.exports);
6884
- var Stack = import_web2.Stack, Text = import_web2.Text;
7089
+ var Stack = import_web2.Stack, Text = import_web2.Text, baseViews = getBaseViews();
6885
7090
  (0, import_web2.setupHooks)({
6886
7091
  getBaseViews,
6887
7092
  usePropsTransform(elementType, propsIn, hostRef) {
@@ -6954,22 +7159,15 @@ var Stack = import_web2.Stack, Text = import_web2.Text;
6954
7159
  viewProps[key] = og && !dontComposePressabilityKeys[key] ? (0, import_web2.composeEventHandlers)(og, val) : val;
6955
7160
  }
6956
7161
  }
7162
+ },
7163
+ useChildren(elementType, children, viewProps, events, staticConfig) {
7164
+ if (process.env.NODE_ENV !== "test") {
7165
+ if (elementType === baseViews.View)
7166
+ return createOptimizedView(children, viewProps, baseViews);
7167
+ if (process.env.TAMAGUI_OPTIMIZE_NATIVE_VIEWS && elementType === baseViews.Text)
7168
+ return viewProps.children = children, (0, import_react2.createElement)("RCTText", viewProps);
7169
+ }
6957
7170
  }
6958
- // attempt at properly fixing RN input, but <Pressable><TextInput /> just doesnt work on RN
6959
- // useChildren(children, viewProps, events, staticConfig) {
6960
- // if (process.env.TAMAGUI_TARGET === 'native') {
6961
- // if (staticConfig.isInput && !staticConfig.isHOC) {
6962
- // const Pressable = getBaseViews().Pressable
6963
- // console.log(
6964
- // 'wrapping in pressable',
6965
- // events?.['onPressIn']?.toString(),
6966
- // viewProps['onPressIn']
6967
- // )
6968
- // // we need to wrap it in a view?
6969
- // return <Pressable {...events}>{children}</Pressable>
6970
- // }
6971
- // }
6972
- // },
6973
7171
  });
6974
7172
  var dontComposePressabilityKeys = {
6975
7173
  onClick: !0