@tamagui/core 1.121.12 → 1.122.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "1.121.12",
3
+ "version": "1.122.1",
4
4
  "source": "src/index.tsx",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -35,14 +35,14 @@
35
35
  "native-test.d.ts"
36
36
  ],
37
37
  "dependencies": {
38
- "@tamagui/react-native-media-driver": "1.121.12",
39
- "@tamagui/react-native-use-pressable": "1.121.12",
40
- "@tamagui/react-native-use-responder-events": "1.121.12",
41
- "@tamagui/use-event": "1.121.12",
42
- "@tamagui/web": "1.121.12"
38
+ "@tamagui/react-native-media-driver": "1.122.1",
39
+ "@tamagui/react-native-use-pressable": "1.122.1",
40
+ "@tamagui/react-native-use-responder-events": "1.122.1",
41
+ "@tamagui/use-event": "1.122.1",
42
+ "@tamagui/web": "1.122.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@tamagui/build": "1.121.12",
45
+ "@tamagui/build": "1.122.1",
46
46
  "@testing-library/react": "^16.1.0",
47
47
  "csstype": "^3.0.10",
48
48
  "typescript": "^5.7.2",
@@ -18,14 +18,11 @@ export function createOptimizedView(
18
18
  const TextAncestor = baseViews.TextAncestor
19
19
  const ViewNativeComponent = baseViews.View
20
20
 
21
- // return createElement(ViewNativeComponent, viewProps, children)
22
-
23
21
  const {
24
22
  accessibilityElementsHidden,
25
23
  accessibilityLabel,
26
24
  accessibilityLabelledBy,
27
25
  accessibilityLiveRegion,
28
- accessibilityRole,
29
26
  accessibilityState,
30
27
  accessibilityValue,
31
28
  'aria-busy': ariaBusy,
@@ -43,9 +40,6 @@ export function createOptimizedView(
43
40
  'aria-valuetext': ariaValueText,
44
41
  focusable,
45
42
  id,
46
- importantForAccessibility,
47
- nativeID,
48
- pointerEvents,
49
43
  role,
50
44
  tabIndex,
51
45
  // ...otherProps
@@ -87,39 +81,61 @@ export function createOptimizedView(
87
81
  }
88
82
  }
89
83
 
90
- let style = Array.isArray(viewProps.style)
91
- ? baseViews.StyleSheet.flatten(viewProps.style)
92
- : viewProps.style
93
- const newPointerEvents = style?.pointerEvents || pointerEvents
84
+ if (viewProps.style?.pointerEvents) {
85
+ viewProps.pointerEvents = viewProps.style?.pointerEvents
86
+ }
94
87
 
95
- const finalProps = viewProps
88
+ if (id) {
89
+ viewProps.nativeID = id
90
+ }
91
+
92
+ if (ariaHidden === true) {
93
+ viewProps.importantForAccessibility = 'no-hide-descendants'
94
+ }
96
95
 
97
- const extras = {
98
- accessibilityLiveRegion:
99
- ariaLive === 'off' ? 'none' : (ariaLive ?? accessibilityLiveRegion),
100
- accessibilityLabel: ariaLabel ?? accessibilityLabel,
101
- focusable: tabIndex !== undefined ? !tabIndex : focusable,
102
- accessibilityState: _accessibilityState,
103
- accessibilityRole: role ? getAccessibilityRoleFromRole(role) : accessibilityRole,
104
- accessibilityElementsHidden: ariaHidden ?? accessibilityElementsHidden,
105
- accessibilityLabelledBy: _accessibilityLabelledBy,
106
- accessibilityValue: _accessibilityValue,
107
- importantForAccessibility:
108
- ariaHidden === true ? 'no-hide-descendants' : importantForAccessibility,
109
- nativeID: id ?? nativeID,
110
- style,
111
- pointerEvents: newPointerEvents,
96
+ if (_accessibilityValue) {
97
+ viewProps.accessibilityValue = _accessibilityValue
112
98
  }
113
- // avoid adding undefined props
114
- for (const key in extras) {
115
- if (extras[key] != null) {
116
- finalProps[key] = extras[key]
99
+
100
+ if (role) {
101
+ viewProps.accessibilityRole = getAccessibilityRoleFromRole(role)
102
+ }
103
+
104
+ if (ariaLive === 'off') {
105
+ viewProps.accessibilityLiveRegion = 'none'
106
+ } else {
107
+ const alr = ariaLive ?? accessibilityLiveRegion
108
+ if (alr) {
109
+ viewProps.accessibilityLiveRegion = alr
117
110
  }
118
111
  }
119
112
 
113
+ const al = ariaLabel ?? accessibilityLabel
114
+ if (al) {
115
+ viewProps.accessibilityLabel = al
116
+ }
117
+
118
+ const f = tabIndex !== undefined ? !tabIndex : focusable
119
+ if (f != null) {
120
+ viewProps.focusable = f
121
+ }
122
+
123
+ if (_accessibilityState != null) {
124
+ viewProps.accessibilityState = _accessibilityState
125
+ }
126
+
127
+ const ah = ariaHidden ?? accessibilityElementsHidden
128
+ if (ah != null) {
129
+ viewProps.accessibilityElementsHidden = ah
130
+ }
131
+
132
+ if (_accessibilityLabelledBy) {
133
+ viewProps.accessibilityLabelledBy = _accessibilityLabelledBy
134
+ }
135
+
120
136
  // isInText is significantly faster than just providing it each time
121
137
  const isInText = React.useContext(TextAncestor)
122
- const finalElement = React.createElement(ViewNativeComponent, finalProps, children)
138
+ const finalElement = React.createElement(ViewNativeComponent, viewProps, children)
123
139
 
124
140
  if (!isInText) {
125
141
  return finalElement
package/src/index.tsx CHANGED
@@ -221,7 +221,7 @@ setupHooks({
221
221
 
222
222
  // attempt at properly fixing RN input, but <Pressable><TextInput /> just doesnt work on RN
223
223
  ...(process.env.TAMAGUI_TARGET === 'native' && {
224
- useChildren(elementType, children, viewProps, events, staticConfig) {
224
+ useChildren(elementType, children, viewProps) {
225
225
  if (process.env.NODE_ENV === 'test') {
226
226
  // test mode - just use regular views since optimizations cause weirdness
227
227
  return
@@ -13,5 +13,5 @@ export declare function createOptimizedView(children: any, viewProps: Record<str
13
13
  }, React.Component<{
14
14
  value: boolean;
15
15
  }, any, any>>;
16
- export declare function getAccessibilityRoleFromRole(role: any): "none" | "alert" | "button" | "checkbox" | "combobox" | "grid" | "header" | "image" | "link" | "list" | "menu" | "menubar" | "menuitem" | "progressbar" | "radio" | "radiogroup" | "scrollbar" | "search" | "adjustable" | "spinbutton" | "summary" | "switch" | "tab" | "tablist" | "timer" | "toolbar" | undefined;
16
+ export declare function getAccessibilityRoleFromRole(role: any): "alert" | "button" | "checkbox" | "combobox" | "grid" | "header" | "image" | "link" | "list" | "menu" | "menubar" | "menuitem" | "none" | "progressbar" | "radio" | "radiogroup" | "scrollbar" | "search" | "adjustable" | "spinbutton" | "summary" | "switch" | "tab" | "tablist" | "timer" | "toolbar" | undefined;
17
17
  //# sourceMappingURL=createOptimizedView.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createOptimizedView.native.d.ts","sourceRoot":"","sources":["../src/createOptimizedView.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;GAQG;AAEH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,GAAG,EACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,SAAS,EAAE,GAAG;;;;cAgHf;AAED,wBAAgB,4BAA4B,CAAC,IAAI,KAAA,wTAuIhD"}
1
+ {"version":3,"file":"createOptimizedView.native.d.ts","sourceRoot":"","sources":["../src/createOptimizedView.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;;;;;GAQG;AAEH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,GAAG,EACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,SAAS,EAAE,GAAG;;;;cAiIf;AAED,wBAAgB,4BAA4B,CAAC,IAAI,KAAA,wTAuIhD"}
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { StackNonStyleProps, StackStyleBase, TamaDefer, TamaguiComponent, TamaguiElement, TamaguiTextElement, TextNonStyleProps, TextProps, TextStylePropsBase } from '@tamagui/web';
2
+ import { createTamagui as createTamaguiWeb } from '@tamagui/web';
2
3
  import type { RNTextProps, RNViewProps } from './reactNativeTypes';
3
4
  type RNExclusiveViewProps = Omit<RNViewProps, keyof StackNonStyleProps>;
4
5
  export interface RNTamaguiViewNonStyleProps extends StackNonStyleProps, RNExclusiveViewProps {
@@ -10,6 +11,7 @@ export interface RNTamaguiTextNonStyleProps extends TextNonStyleProps, RNExclusi
10
11
  type RNTamaguiText = TamaguiComponent<TamaDefer, TamaguiTextElement, RNTamaguiTextNonStyleProps, TextStylePropsBase, {}>;
11
12
  export * from '@tamagui/web';
12
13
  export * from './reactNativeTypes';
14
+ export declare const createTamagui: typeof createTamaguiWeb;
13
15
  export declare const View: RNTamaguiView;
14
16
  export declare const Stack: RNTamaguiView;
15
17
  export declare const Text: RNTamaguiText;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EACnB,MAAM,cAAc,CAAA;AAcrB,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAKlE,KAAK,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAA;AACvE,MAAM,WAAW,0BACf,SAAQ,kBAAkB,EACxB,oBAAoB;CAAG;AAE3B,KAAK,aAAa,GAAG,gBAAgB,CACnC,SAAS,EACT,cAAc,EACd,0BAA0B,EAC1B,cAAc,EACd,EAAE,CACH,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,SAAS,CAAC,CAAA;AAC9D,MAAM,WAAW,0BACf,SAAQ,iBAAiB,EACvB,oBAAoB;CAAG;AAE3B,KAAK,aAAa,GAAG,gBAAgB,CACnC,SAAS,EACT,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,EAAE,CACH,CAAA;AAGD,cAAc,cAAc,CAAA;AAG5B,cAAc,oBAAoB,CAAA;AAqKlC,eAAO,MAAM,IAAI,EAAqB,aAAa,CAAA;AACnD,eAAO,MAAM,KAAK,EAAsB,aAAa,CAAA;AACrD,eAAO,MAAM,IAAI,EAAqB,aAAa,CAAA"}
1
+ {"version":3,"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