@tamagui/core 1.74.8 → 1.74.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "1.74.8",
3
+ "version": "1.74.10",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -36,16 +36,16 @@
36
36
  "native-test.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@tamagui/react-native-use-pressable": "1.74.8",
40
- "@tamagui/react-native-use-responder-events": "1.74.8",
41
- "@tamagui/use-event": "1.74.8",
42
- "@tamagui/web": "1.74.8"
39
+ "@tamagui/react-native-use-pressable": "1.74.10",
40
+ "@tamagui/react-native-use-responder-events": "1.74.10",
41
+ "@tamagui/use-event": "1.74.10",
42
+ "@tamagui/web": "1.74.10"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "*"
46
46
  },
47
47
  "devDependencies": {
48
- "@tamagui/build": "1.74.8",
48
+ "@tamagui/build": "1.74.10",
49
49
  "@testing-library/react": "^14.0.0",
50
50
  "csstype": "^3.0.10",
51
51
  "react": "^18.2.0",
@@ -4,5 +4,6 @@ export function getBaseViews() {
4
4
  return {
5
5
  View: native.View || native.default.View,
6
6
  Text: native.Text || native.default.Text,
7
+ Pressable: native.Pressable || native.default.Pressable,
7
8
  }
8
9
  }
@@ -20,7 +20,7 @@ import { getBaseViews } from './getBaseViews'
20
20
  import { useElementLayout } from './hooks/useElementLayout'
21
21
  import { usePlatformMethods } from './hooks/usePlatformMethods'
22
22
  import { RNViewProps } from './reactNativeTypes'
23
- import { usePressability } from './vendor/Pressability'
23
+ import { Pressability, usePressability } from './vendor/Pressability'
24
24
 
25
25
  // re-exports all of @tamagui/web just adds hooks
26
26
  export * from '@tamagui/web'
@@ -121,7 +121,7 @@ setupHooks({
121
121
  return viewProps
122
122
  },
123
123
 
124
- useEvents(viewProps, events, { pseudos }, setStateShallow) {
124
+ useEvents(viewProps, events, { pseudos }, setStateShallow, staticConfig) {
125
125
  if (process.env.TAMAGUI_TARGET === 'native') {
126
126
  const attachFocus = !!pseudos?.focusStyle
127
127
  if (attachFocus) {
@@ -133,28 +133,59 @@ setupHooks({
133
133
  })
134
134
  }
135
135
 
136
- // use Pressability to get smooth unPress when you press + hold + move out
137
- // only ever create once, use .configure() to update later
138
- if (events && viewProps.hitSlop) {
139
- events.hitSlop = viewProps.hitSlop
140
- }
136
+ if (staticConfig.isInput) {
137
+ if (events) {
138
+ const { onPressIn, onPressOut, onPress } = events
139
+ const inputEvents = {
140
+ onPressIn,
141
+ onPressOut: onPressOut || onPress,
142
+ }
143
+ if (onPressOut && onPress) {
144
+ // only supports onPressIn and onPressOut so combine them
145
+ inputEvents.onPressOut = composeEventHandlers(onPress, onPressOut)
146
+ }
147
+ Object.assign(viewProps, inputEvents)
148
+ }
149
+ } else {
150
+ // use Pressability to get smooth unPress when you press + hold + move out
151
+ // only ever create once, use .configure() to update later
152
+ if (events && viewProps.hitSlop) {
153
+ events.hitSlop = viewProps.hitSlop
154
+ }
141
155
 
142
- const pressability = usePressability(events || null)
143
-
144
- if (events) {
145
- if (events.onPress) {
146
- for (const key in pressability) {
147
- const og = viewProps[key]
148
- const val = pressability[key]
149
- viewProps[key] =
150
- og && !dontComposePressabilityKeys[key]
151
- ? composeEventHandlers(og, val)
152
- : val
156
+ const pressability = usePressability(events || null)
157
+
158
+ if (events) {
159
+ if (events.onPress) {
160
+ for (const key in pressability) {
161
+ const og = viewProps[key]
162
+ const val = pressability[key]
163
+ viewProps[key] =
164
+ og && !dontComposePressabilityKeys[key]
165
+ ? composeEventHandlers(og, val)
166
+ : val
167
+ }
153
168
  }
154
169
  }
155
170
  }
156
171
  }
157
172
  },
173
+
174
+ // attempt at properly fixing RN input, but <Pressable><TextInput /> just doesnt work on RN
175
+ // useChildren(children, viewProps, events, staticConfig) {
176
+ // if (process.env.TAMAGUI_TARGET === 'native') {
177
+ // if (staticConfig.isInput && !staticConfig.isHOC) {
178
+ // const Pressable = getBaseViews().Pressable
179
+ // console.log(
180
+ // 'wrapping in pressable',
181
+ // events?.['onPressIn']?.toString(),
182
+ // viewProps['onPressIn']
183
+ // )
184
+ // // we need to wrap it in a view?
185
+ // return <Pressable {...events}>{children}</Pressable>
186
+ // }
187
+ // }
188
+ // },
158
189
  })
159
190
 
160
191
  const dontComposePressabilityKeys = {
@@ -1,5 +1,6 @@
1
1
  export declare function getBaseViews(): {
2
2
  View: any;
3
3
  Text: any;
4
+ Pressable: any;
4
5
  };
5
6
  //# sourceMappingURL=getBaseViews.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getBaseViews.native.d.ts","sourceRoot":"","sources":["../src/getBaseViews.native.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY;;;EAO3B"}
1
+ {"version":3,"file":"getBaseViews.native.d.ts","sourceRoot":"","sources":["../src/getBaseViews.native.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY;;;;EAQ3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAGV,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAGnB,MAAM,cAAc,CAAA;AAYrB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIhD,cAAc,cAAc,CAAA;AAG5B,cAAc,oBAAoB,CAAA;AAIlC,eAAO,MAAM,KAAK;;;;iOAIjB,CAAA;AAED,eAAO,MAAM,IAAI;;;;y6BAIhB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAGV,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAGnB,MAAM,cAAc,CAAA;AAYrB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIhD,cAAc,cAAc,CAAA;AAG5B,cAAc,oBAAoB,CAAA;AAIlC,eAAO,MAAM,KAAK;;;;iOAIjB,CAAA;AAED,eAAO,MAAM,IAAI;;;;y6BAIhB,CAAA"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from == "object" || typeof from == "function")
8
- for (let key of __getOwnPropNames(from))
9
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- return to;
11
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
12
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
13
- var native_exports = {};
14
- module.exports = __toCommonJS(native_exports);
15
- __reExport(native_exports, require("./index"), module.exports);
16
- // Annotate the CommonJS export names for ESM import in node:
17
- 0 && (module.exports = {
18
- ...require("./index")
19
- });
20
- //# sourceMappingURL=native.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/native.ts"],
4
- "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,oBAAd;",
5
- "names": []
6
- }