@tamagui/core 1.81.4 → 1.82.0

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.81.4",
3
+ "version": "1.82.0",
4
4
  "source": "src/index.tsx",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -35,16 +35,16 @@
35
35
  "native-test.d.ts"
36
36
  ],
37
37
  "dependencies": {
38
- "@tamagui/react-native-use-pressable": "1.81.4",
39
- "@tamagui/react-native-use-responder-events": "1.81.4",
40
- "@tamagui/use-event": "1.81.4",
41
- "@tamagui/web": "1.81.4"
38
+ "@tamagui/react-native-use-pressable": "1.82.0",
39
+ "@tamagui/react-native-use-responder-events": "1.82.0",
40
+ "@tamagui/use-event": "1.82.0",
41
+ "@tamagui/web": "1.82.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": "*"
45
45
  },
46
46
  "devDependencies": {
47
- "@tamagui/build": "1.81.4",
47
+ "@tamagui/build": "1.82.0",
48
48
  "@testing-library/react": "^14.0.0",
49
49
  "csstype": "^3.0.10",
50
50
  "react": "^18.2.0",
@@ -57,7 +57,8 @@
57
57
  ".": {
58
58
  "types": "./types/index.d.ts",
59
59
  "import": "./dist/esm/index.js",
60
- "require": "./dist/cjs/index.js"
60
+ "require": "./dist/cjs/index.js",
61
+ "react-native": "./dist/cjs/index.native.js"
61
62
  },
62
63
  "./native": {
63
64
  "types": "./types/index.d.ts",
@@ -72,12 +73,14 @@
72
73
  "./inject-styles": {
73
74
  "types": "./types/inject-styles.d.ts",
74
75
  "import": "./dist/esm/inject-styles.js",
75
- "require": "./dist/cjs/inject-styles.js"
76
+ "require": "./dist/cjs/inject-styles.js",
77
+ "react-native": "./dist/cjs/inject-styles.native.js"
76
78
  },
77
79
  "./reactNativeTypes": {
78
80
  "types": "./types/reactNativeTypes.d.ts",
79
81
  "import": "./dist/esm/reactNativeTypes.js",
80
- "require": "./dist/cjs/reactNativeTypes.js"
82
+ "require": "./dist/cjs/reactNativeTypes.js",
83
+ "react-native": "./dist/cjs/reactNativeTypes.native.js"
81
84
  }
82
85
  },
83
86
  "repository": {
package/src/index.tsx CHANGED
@@ -140,15 +140,14 @@ setupHooks({
140
140
 
141
141
  useEvents(viewProps, events, { pseudos }, setStateShallow, staticConfig) {
142
142
  if (process.env.TAMAGUI_TARGET === 'native') {
143
- if (events?.onFocus) {
144
- viewProps['onFocus'] = events.onFocus
145
- }
146
- if (events?.onBlur) {
147
- viewProps['onBlur'] = events.onBlur
148
- }
149
-
150
- if (staticConfig.isInput) {
151
- if (events) {
143
+ if (events) {
144
+ if (events.onFocus) {
145
+ viewProps['onFocus'] = events.onFocus
146
+ }
147
+ if (events.onBlur) {
148
+ viewProps['onBlur'] = events.onBlur
149
+ }
150
+ if (staticConfig.isInput) {
152
151
  const { onPressIn, onPressOut, onPress } = events
153
152
  const inputEvents = {
154
153
  onPressIn,
@@ -159,17 +158,24 @@ setupHooks({
159
158
  inputEvents.onPressOut = composeEventHandlers(onPress, onPressOut)
160
159
  }
161
160
  Object.assign(viewProps, inputEvents)
162
- }
163
- } else {
164
- // use Pressability to get smooth unPress when you press + hold + move out
165
- // only ever create once, use .configure() to update later
166
- if (events && viewProps.hitSlop) {
167
- events.hitSlop = viewProps.hitSlop
168
- }
169
-
170
- const pressability = usePressability(events || null)
161
+ } else {
162
+ // use Pressability to get smooth unPress when you press + hold + move out
163
+ // only ever create once, use .configure() to update later
164
+ if (viewProps.hitSlop) {
165
+ events.hitSlop = viewProps.hitSlop
166
+ }
167
+ const pressability = usePressability(events)
168
+
169
+ if (process.env.NODE_ENV === 'development') {
170
+ if (viewProps['debug']) {
171
+ console.info(
172
+ `Checking for press ${!!events.onPress} then applying pressability props: ${Object.keys(
173
+ pressability || {}
174
+ )}`
175
+ )
176
+ }
177
+ }
171
178
 
172
- if (events) {
173
179
  if (events.onPress) {
174
180
  for (const key in pressability) {
175
181
  const og = viewProps[key]