@hzblj/kara-components 0.15.2 → 0.15.3
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/CHANGELOG.md +11 -0
- package/lib/module/atoms/h-stack/h-stack.ios.js +2 -2
- package/lib/module/atoms/h-stack/h-stack.ios.js.map +1 -1
- package/lib/module/atoms/v-stack/v-stack.ios.js +2 -2
- package/lib/module/atoms/v-stack/v-stack.ios.js.map +1 -1
- package/lib/module/atoms/z-stack/z-stack.ios.js +2 -2
- package/lib/module/atoms/z-stack/z-stack.ios.js.map +1 -1
- package/lib/module/tap-modifiers.js +11 -0
- package/lib/module/tap-modifiers.js.map +1 -0
- package/lib/typescript/tap-modifiers.d.ts +7 -0
- package/package.json +4 -4
- package/src/atoms/h-stack/h-stack.ios.tsx +2 -2
- package/src/atoms/v-stack/v-stack.ios.tsx +2 -2
- package/src/atoms/z-stack/z-stack.ios.tsx +2 -2
- package/src/tap-modifiers.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @hzblj/kara-components
|
|
2
2
|
|
|
3
|
+
## 0.15.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`91f4285`](https://github.com/hzblj/kara-ui/commit/91f42856d2acc0d03fb9836a718c5deba758a29f) Thanks [@hzblj](https://github.com/hzblj)! - A pressable `HStack`, `VStack` or `ZStack` on iOS now takes a tap anywhere in its frame, padding and a `Spacer`'s gap included, as it already did on Android. Before, a `LabeledContent` row pressed in its empty middle did nothing.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @hzblj/kara-theme@0.15.3
|
|
11
|
+
- @hzblj/kara-sx@0.15.3
|
|
12
|
+
- @hzblj/kara-native@0.15.3
|
|
13
|
+
|
|
3
14
|
## 0.15.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { HStack as SwiftUIHStack } from '@expo/ui/swift-ui';
|
|
4
|
-
import { onTapGesture } from '@expo/ui/swift-ui/modifiers';
|
|
5
4
|
import { splitAccessibility, useAccessibilityModifiers, useSxModifiers } from '@hzblj/kara-sx';
|
|
6
5
|
import { spacing } from '@hzblj/kara-theme';
|
|
7
6
|
import { useMemo } from 'react';
|
|
8
7
|
import { useHostGuard } from "../../host-context.js";
|
|
8
|
+
import { tapModifiers } from "../../tap-modifiers.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const ALIGNMENT = {
|
|
11
11
|
center: 'center',
|
|
@@ -29,7 +29,7 @@ export const HStack = ({
|
|
|
29
29
|
const [accessibility, sx] = splitAccessibility(props);
|
|
30
30
|
const sxModifiers = useSxModifiers(sx, FRAME_ALIGNMENT[align]);
|
|
31
31
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined);
|
|
32
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(onPress
|
|
32
|
+
const modifiers = useMemo(() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers], [accessibilityModifiers, onPress, sxModifiers]);
|
|
33
33
|
return /*#__PURE__*/_jsx(SwiftUIHStack, {
|
|
34
34
|
alignment: ALIGNMENT[align],
|
|
35
35
|
modifiers: modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HStack","SwiftUIHStack","
|
|
1
|
+
{"version":3,"names":["HStack","SwiftUIHStack","splitAccessibility","useAccessibilityModifiers","useSxModifiers","spacing","useMemo","useHostGuard","tapModifiers","jsx","_jsx","ALIGNMENT","center","end","start","FRAME_ALIGNMENT","align","children","onPress","gap","testID","props","accessibility","sx","sxModifiers","accessibilityModifiers","undefined","modifiers","alignment"],"sourceRoot":"../../../../src","sources":["atoms/h-stack/h-stack.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,QAAO,mBAAmB;AACzD,SAA6BC,kBAAkB,EAAEC,yBAAyB,EAAEC,cAAc,QAAO,gBAAgB;AACjH,SAAQC,OAAO,QAAO,mBAAmB;AACzC,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,YAAY,QAAO,wBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGhD,MAAMC,SAAS,GAAG;EAChBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE,QAAQ;EACbC,KAAK,EAAE;AACT,CAAgD;AAEhD,MAAMC,eAAe,GAAG;EACtBH,MAAM,EAAE,SAAS;EACjBC,GAAG,EAAE,eAAe;EACpBC,KAAK,EAAE;AACT,CAAwD;AAExD,OAAO,MAAMd,MAAuB,GAAGA,CAAC;EACtCgB,KAAK,GAAG,OAAO;EACfC,QAAQ;EACRC,OAAO;EACPb,OAAO,EAAEc,GAAG;EACZC,MAAM;EACN,GAAGC;AACQ,CAAC,KAAK;EACjBd,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAM,CAACe,aAAa,EAAEC,EAAE,CAAC,GAAGrB,kBAAkB,CAACmB,KAAK,CAAC;EACrD,MAAMG,WAAW,GAAGpB,cAAc,CAACmB,EAAE,EAAER,eAAe,CAACC,KAAK,CAAC,CAAC;EAC9D,MAAMS,sBAAsB,GAAGtB,yBAAyB,CAACmB,aAAa,EAAEJ,OAAO,KAAKQ,SAAS,CAAC;EAC9F,MAAMC,SAAS,GAAGrB,OAAO,CACvB,MAAM,CAAC,GAAGkB,WAAW,EAAE,GAAGhB,YAAY,CAACU,OAAO,CAAC,EAAE,GAAGO,sBAAsB,CAAC,EAC3E,CAACA,sBAAsB,EAAEP,OAAO,EAAEM,WAAW,CAC/C,CAAC;EAED,oBACEd,IAAA,CAACT,aAAa;IACZ2B,SAAS,EAAEjB,SAAS,CAACK,KAAK,CAAE;IAC5BW,SAAS,EAAEA,SAAU;IACrBtB,OAAO,EAAEc,GAAG,KAAKO,SAAS,GAAGA,SAAS,GAAGrB,OAAO,CAACc,GAAG,CAAE;IACtDC,MAAM,EAAEA,MAAO;IAAAH,QAAA,EAEdA;EAAQ,CACI,CAAC;AAEpB,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { VStack as SwiftUIVStack } from '@expo/ui/swift-ui';
|
|
4
|
-
import { onTapGesture } from '@expo/ui/swift-ui/modifiers';
|
|
5
4
|
import { splitAccessibility, useAccessibilityModifiers, useSxModifiers } from '@hzblj/kara-sx';
|
|
6
5
|
import { spacing } from '@hzblj/kara-theme';
|
|
7
6
|
import { useMemo } from 'react';
|
|
8
7
|
import { useHostGuard } from "../../host-context.js";
|
|
8
|
+
import { tapModifiers } from "../../tap-modifiers.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const ALIGNMENT = {
|
|
11
11
|
center: 'center',
|
|
@@ -24,7 +24,7 @@ export const VStack = ({
|
|
|
24
24
|
const [accessibility, sx] = splitAccessibility(props);
|
|
25
25
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align]);
|
|
26
26
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined);
|
|
27
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(onPress
|
|
27
|
+
const modifiers = useMemo(() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers], [accessibilityModifiers, onPress, sxModifiers]);
|
|
28
28
|
return /*#__PURE__*/_jsx(SwiftUIVStack, {
|
|
29
29
|
alignment: ALIGNMENT[align],
|
|
30
30
|
modifiers: modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VStack","SwiftUIVStack","
|
|
1
|
+
{"version":3,"names":["VStack","SwiftUIVStack","splitAccessibility","useAccessibilityModifiers","useSxModifiers","spacing","useMemo","useHostGuard","tapModifiers","jsx","_jsx","ALIGNMENT","center","end","start","align","children","onPress","gap","testID","props","accessibility","sx","sxModifiers","accessibilityModifiers","undefined","modifiers","alignment"],"sourceRoot":"../../../../src","sources":["atoms/v-stack/v-stack.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,QAAO,mBAAmB;AACzD,SAA6BC,kBAAkB,EAAEC,yBAAyB,EAAEC,cAAc,QAAO,gBAAgB;AACjH,SAAQC,OAAO,QAAO,mBAAmB;AACzC,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,YAAY,QAAO,wBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGhD,MAAMC,SAAS,GAAG;EAChBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE,UAAU;EACfC,KAAK,EAAE;AACT,CAAwD;AAExD,OAAO,MAAMd,MAAuB,GAAGA,CAAC;EACtCe,KAAK,GAAG,OAAO;EACfC,QAAQ;EACRC,OAAO;EACPZ,OAAO,EAAEa,GAAG;EACZC,MAAM;EACN,GAAGC;AACQ,CAAC,KAAK;EACjBb,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAM,CAACc,aAAa,EAAEC,EAAE,CAAC,GAAGpB,kBAAkB,CAACkB,KAAK,CAAC;EACrD,MAAMG,WAAW,GAAGnB,cAAc,CAACkB,EAAE,EAAEX,SAAS,CAACI,KAAK,CAAC,CAAC;EACxD,MAAMS,sBAAsB,GAAGrB,yBAAyB,CAACkB,aAAa,EAAEJ,OAAO,KAAKQ,SAAS,CAAC;EAC9F,MAAMC,SAAS,GAAGpB,OAAO,CACvB,MAAM,CAAC,GAAGiB,WAAW,EAAE,GAAGf,YAAY,CAACS,OAAO,CAAC,EAAE,GAAGO,sBAAsB,CAAC,EAC3E,CAACA,sBAAsB,EAAEP,OAAO,EAAEM,WAAW,CAC/C,CAAC;EAED,oBACEb,IAAA,CAACT,aAAa;IACZ0B,SAAS,EAAEhB,SAAS,CAACI,KAAK,CAAE;IAC5BW,SAAS,EAAEA,SAAU;IACrBrB,OAAO,EAAEa,GAAG,KAAKO,SAAS,GAAGA,SAAS,GAAGpB,OAAO,CAACa,GAAG,CAAE;IACtDC,MAAM,EAAEA,MAAO;IAAAH,QAAA,EAEdA;EAAQ,CACI,CAAC;AAEpB,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { ZStack as SwiftUIZStack } from '@expo/ui/swift-ui';
|
|
4
|
-
import { onTapGesture } from '@expo/ui/swift-ui/modifiers';
|
|
5
4
|
import { splitAccessibility, useAccessibilityModifiers, useSxModifiers } from '@hzblj/kara-sx';
|
|
6
5
|
import { useMemo } from 'react';
|
|
7
6
|
import { useHostGuard } from "../../host-context.js";
|
|
7
|
+
import { tapModifiers } from "../../tap-modifiers.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
const ALIGNMENT = {
|
|
10
10
|
bottom: 'bottom',
|
|
@@ -22,7 +22,7 @@ export const ZStack = ({
|
|
|
22
22
|
const [accessibility, sx] = splitAccessibility(props);
|
|
23
23
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align]);
|
|
24
24
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined);
|
|
25
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(onPress
|
|
25
|
+
const modifiers = useMemo(() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers], [accessibilityModifiers, onPress, sxModifiers]);
|
|
26
26
|
return /*#__PURE__*/_jsx(SwiftUIZStack, {
|
|
27
27
|
alignment: ALIGNMENT[align],
|
|
28
28
|
modifiers: modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ZStack","SwiftUIZStack","
|
|
1
|
+
{"version":3,"names":["ZStack","SwiftUIZStack","splitAccessibility","useAccessibilityModifiers","useSxModifiers","useMemo","useHostGuard","tapModifiers","jsx","_jsx","ALIGNMENT","bottom","center","top","align","children","onPress","testID","props","accessibility","sx","sxModifiers","accessibilityModifiers","undefined","modifiers","alignment"],"sourceRoot":"../../../../src","sources":["atoms/z-stack/z-stack.ios.tsx"],"mappings":";;AAAA,SAAQA,MAAM,IAAIC,aAAa,QAAO,mBAAmB;AACzD,SAA6BC,kBAAkB,EAAEC,yBAAyB,EAAEC,cAAc,QAAO,gBAAgB;AACjH,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,YAAY,QAAO,wBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGhD,MAAMC,SAAS,GAAG;EAChBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE;AACP,CAAwD;AAExD,OAAO,MAAMb,MAAuB,GAAGA,CAAC;EAACc,KAAK,GAAG,QAAQ;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,MAAM;EAAE,GAAGC;AAAkB,CAAC,KAAK;EAC/GZ,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAM,CAACa,aAAa,EAAEC,EAAE,CAAC,GAAGlB,kBAAkB,CAACgB,KAAK,CAAC;EACrD,MAAMG,WAAW,GAAGjB,cAAc,CAACgB,EAAE,EAAEV,SAAS,CAACI,KAAK,CAAC,CAAC;EACxD,MAAMQ,sBAAsB,GAAGnB,yBAAyB,CAACgB,aAAa,EAAEH,OAAO,KAAKO,SAAS,CAAC;EAC9F,MAAMC,SAAS,GAAGnB,OAAO,CACvB,MAAM,CAAC,GAAGgB,WAAW,EAAE,GAAGd,YAAY,CAACS,OAAO,CAAC,EAAE,GAAGM,sBAAsB,CAAC,EAC3E,CAACA,sBAAsB,EAAEN,OAAO,EAAEK,WAAW,CAC/C,CAAC;EAED,oBACEZ,IAAA,CAACR,aAAa;IAACwB,SAAS,EAAEf,SAAS,CAACI,KAAK,CAAE;IAACU,SAAS,EAAEA,SAAU;IAACP,MAAM,EAAEA,MAAO;IAAAF,QAAA,EAC9EA;EAAQ,CACI,CAAC;AAEpB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { contentShape, onTapGesture, shapes } from '@expo/ui/swift-ui/modifiers';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A SwiftUI stack's `onPress`: the whole frame takes the tap, padding and a `Spacer`'s gap included. `onTapGesture`
|
|
7
|
+
* alone hit-tests only what draws, so a `LabeledContent` row pressed in its empty middle did nothing; the rectangle
|
|
8
|
+
* content shape makes it answer anywhere, as the Compose stacks' `clickable` already does.
|
|
9
|
+
*/
|
|
10
|
+
export const tapModifiers = onPress => onPress ? [contentShape(shapes.rectangle()), onTapGesture(onPress)] : [];
|
|
11
|
+
//# sourceMappingURL=tap-modifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["contentShape","onTapGesture","shapes","tapModifiers","onPress","rectangle"],"sourceRoot":"../../src","sources":["tap-modifiers.ts"],"mappings":";;AAAA,SAAQA,YAAY,EAAuBC,YAAY,EAAEC,MAAM,QAAO,6BAA6B;;AAEnG;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAIC,OAAiC,IAC5DA,OAAO,GAAG,CAACJ,YAAY,CAACE,MAAM,CAACG,SAAS,CAAC,CAAC,CAAC,EAAEJ,YAAY,CAACG,OAAO,CAAC,CAAC,GAAG,EAAE","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ModifierConfig } from '@expo/ui/swift-ui/modifiers';
|
|
2
|
+
/**
|
|
3
|
+
* A SwiftUI stack's `onPress`: the whole frame takes the tap, padding and a `Spacer`'s gap included. `onTapGesture`
|
|
4
|
+
* alone hit-tests only what draws, so a `LabeledContent` row pressed in its empty middle did nothing; the rectangle
|
|
5
|
+
* content shape makes it answer anywhere, as the Compose stacks' `clickable` already does.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tapModifiers: (onPress: (() => void) | undefined) => ModifierConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzblj/kara-components",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "The atoms, molecules, organisms and templates of @hzblj/kara-ui — real SwiftUI and Jetpack Compose views through @expo/ui.",
|
|
5
5
|
"author": "Jan Blazej",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@hzblj/expo-native-icons": "^0.1.0",
|
|
63
63
|
"@hzblj/expo-rich-haptics": "^0.1.0",
|
|
64
|
-
"@hzblj/kara-native": "^0.15.
|
|
65
|
-
"@hzblj/kara-sx": "^0.15.
|
|
66
|
-
"@hzblj/kara-theme": "^0.15.
|
|
64
|
+
"@hzblj/kara-native": "^0.15.3",
|
|
65
|
+
"@hzblj/kara-sx": "^0.15.3",
|
|
66
|
+
"@hzblj/kara-theme": "^0.15.3",
|
|
67
67
|
"sf-symbols-typescript": "^2.2.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {HStack as SwiftUIHStack} from '@expo/ui/swift-ui'
|
|
2
|
-
import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
|
|
3
2
|
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
3
|
import {spacing} from '@hzblj/kara-theme'
|
|
5
4
|
import {useMemo} from 'react'
|
|
6
5
|
import {useHostGuard} from '../../host-context'
|
|
6
|
+
import {tapModifiers} from '../../tap-modifiers'
|
|
7
7
|
import type {HStackAlign, HStackComponent, HStackProps} from './h-stack.types'
|
|
8
8
|
|
|
9
9
|
const ALIGNMENT = {
|
|
@@ -31,7 +31,7 @@ export const HStack: HStackComponent = ({
|
|
|
31
31
|
const sxModifiers = useSxModifiers(sx, FRAME_ALIGNMENT[align])
|
|
32
32
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
|
|
33
33
|
const modifiers = useMemo(
|
|
34
|
-
() => [...sxModifiers, ...(onPress
|
|
34
|
+
() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers],
|
|
35
35
|
[accessibilityModifiers, onPress, sxModifiers]
|
|
36
36
|
)
|
|
37
37
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {VStack as SwiftUIVStack} from '@expo/ui/swift-ui'
|
|
2
|
-
import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
|
|
3
2
|
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
3
|
import {spacing} from '@hzblj/kara-theme'
|
|
5
4
|
import {useMemo} from 'react'
|
|
6
5
|
import {useHostGuard} from '../../host-context'
|
|
6
|
+
import {tapModifiers} from '../../tap-modifiers'
|
|
7
7
|
import type {VStackAlign, VStackComponent, VStackProps} from './v-stack.types'
|
|
8
8
|
|
|
9
9
|
const ALIGNMENT = {
|
|
@@ -25,7 +25,7 @@ export const VStack: VStackComponent = ({
|
|
|
25
25
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align])
|
|
26
26
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
|
|
27
27
|
const modifiers = useMemo(
|
|
28
|
-
() => [...sxModifiers, ...(onPress
|
|
28
|
+
() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers],
|
|
29
29
|
[accessibilityModifiers, onPress, sxModifiers]
|
|
30
30
|
)
|
|
31
31
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {ZStack as SwiftUIZStack} from '@expo/ui/swift-ui'
|
|
2
|
-
import {onTapGesture} from '@expo/ui/swift-ui/modifiers'
|
|
3
2
|
import {type FrameAlignment, splitAccessibility, useAccessibilityModifiers, useSxModifiers} from '@hzblj/kara-sx'
|
|
4
3
|
import {useMemo} from 'react'
|
|
5
4
|
import {useHostGuard} from '../../host-context'
|
|
5
|
+
import {tapModifiers} from '../../tap-modifiers'
|
|
6
6
|
import type {ZStackAlign, ZStackComponent, ZStackProps} from './z-stack.types'
|
|
7
7
|
|
|
8
8
|
const ALIGNMENT = {
|
|
@@ -17,7 +17,7 @@ export const ZStack: ZStackComponent = ({align = 'center', children, onPress, te
|
|
|
17
17
|
const sxModifiers = useSxModifiers(sx, ALIGNMENT[align])
|
|
18
18
|
const accessibilityModifiers = useAccessibilityModifiers(accessibility, onPress !== undefined)
|
|
19
19
|
const modifiers = useMemo(
|
|
20
|
-
() => [...sxModifiers, ...(onPress
|
|
20
|
+
() => [...sxModifiers, ...tapModifiers(onPress), ...accessibilityModifiers],
|
|
21
21
|
[accessibilityModifiers, onPress, sxModifiers]
|
|
22
22
|
)
|
|
23
23
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {contentShape, type ModifierConfig, onTapGesture, shapes} from '@expo/ui/swift-ui/modifiers'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A SwiftUI stack's `onPress`: the whole frame takes the tap, padding and a `Spacer`'s gap included. `onTapGesture`
|
|
5
|
+
* alone hit-tests only what draws, so a `LabeledContent` row pressed in its empty middle did nothing; the rectangle
|
|
6
|
+
* content shape makes it answer anywhere, as the Compose stacks' `clickable` already does.
|
|
7
|
+
*/
|
|
8
|
+
export const tapModifiers = (onPress: (() => void) | undefined): ModifierConfig[] =>
|
|
9
|
+
onPress ? [contentShape(shapes.rectangle()), onTapGesture(onPress)] : []
|