@oxyhq/bloom 0.6.8 → 0.6.9
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/lib/commonjs/accordion/Accordion.js +12 -3
- package/lib/commonjs/accordion/Accordion.js.map +1 -1
- package/lib/commonjs/button/Button.js +31 -7
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/card/Card.js +12 -3
- package/lib/commonjs/card/Card.js.map +1 -1
- package/lib/commonjs/segmented-control/index.js +12 -3
- package/lib/commonjs/segmented-control/index.js.map +1 -1
- package/lib/commonjs/settings-list/SettingsList.js +11 -3
- package/lib/commonjs/settings-list/SettingsList.js.map +1 -1
- package/lib/commonjs/toast/Toast.js +13 -6
- package/lib/commonjs/toast/Toast.js.map +1 -1
- package/lib/module/accordion/Accordion.js +12 -3
- package/lib/module/accordion/Accordion.js.map +1 -1
- package/lib/module/button/Button.js +31 -7
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/card/Card.js +12 -3
- package/lib/module/card/Card.js.map +1 -1
- package/lib/module/segmented-control/index.js +12 -3
- package/lib/module/segmented-control/index.js.map +1 -1
- package/lib/module/settings-list/SettingsList.js +11 -3
- package/lib/module/settings-list/SettingsList.js.map +1 -1
- package/lib/module/toast/Toast.js +13 -6
- package/lib/module/toast/Toast.js.map +1 -1
- package/lib/typescript/commonjs/accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/Button.d.ts.map +1 -1
- package/lib/typescript/commonjs/card/Card.d.ts.map +1 -1
- package/lib/typescript/commonjs/segmented-control/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/settings-list/SettingsList.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/Toast.d.ts.map +1 -1
- package/lib/typescript/module/accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.d.ts.map +1 -1
- package/lib/typescript/module/card/Card.d.ts.map +1 -1
- package/lib/typescript/module/segmented-control/index.d.ts.map +1 -1
- package/lib/typescript/module/settings-list/SettingsList.d.ts.map +1 -1
- package/lib/typescript/module/toast/Toast.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.tsx +9 -1
- package/src/button/Button.tsx +32 -6
- package/src/card/Card.tsx +10 -2
- package/src/segmented-control/index.tsx +9 -1
- package/src/settings-list/SettingsList.tsx +8 -1
- package/src/toast/Toast.tsx +20 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../src/accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmF,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../../src/accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmF,MAAM,OAAO,CAAC;AAOxG,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAsPjB,eAAO,MAAM,SAAS,4CAA2B,CAAC;AAGlD,eAAO,MAAM,aAAa,gDAA+B,CAAC;AAG1D,eAAO,MAAM,gBAAgB,mDAAkC,CAAC;AAGhE,eAAO,MAAM,gBAAgB,mDAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAgB7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAmOtE,eAAO,MAAM,MAAM,yCAAwB,CAAC;AAG5C,eAAO,MAAM,aAAa,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEpE,CAAC;AAGH,eAAO,MAAM,eAAe,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEtE,CAAC;AAGH,eAAO,MAAM,UAAU,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEjE,CAAC;AAGH,eAAO,MAAM,WAAW,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAElE,CAAC;AAGH,eAAO,MAAM,aAAa,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEpE,CAAC;AAGH,eAAO,MAAM,UAAU,oCAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,6CAEjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAM7C,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AA+KjB,eAAO,MAAM,IAAI,uCAA0B,CAAC;AAG5C,eAAO,MAAM,UAAU,6CAA4B,CAAC;AAGpD,eAAO,MAAM,QAAQ,2CAA0B,CAAC;AAGhD,eAAO,MAAM,UAAU,6CAA4B,CAAC;AAGpD,eAAO,MAAM,SAAS,4CAA2B,CAAC;AAGlD,eAAO,MAAM,eAAe,kDAAiC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/segmented-control/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,IAAI,EACJ,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/segmented-control/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,IAAI,EACJ,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAmBtB;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,EACrC,KAAK,EACL,IAAc,EACd,IAAc,EACd,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,iBAAiB,GAClB,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,2CAoEA;AAMD,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EAAE,WAAW,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,EACN,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CACvC,2CAkGA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,GAAG,IAAI,CACnE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EACjC,OAAO,GAAG,UAAU,CACrB,2CAyBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsList.d.ts","sourceRoot":"","sources":["../../../../src/settings-list/SettingsList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SettingsList.d.ts","sourceRoot":"","sources":["../../../../src/settings-list/SettingsList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAKpC,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAoBjB,eAAO,MAAM,gBAAgB,mDA0G3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,oDA6C5B,CAAC;AAIH,eAAO,MAAM,mBAAmB,sDAY/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../src/toast/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../src/toast/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAWzC,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,EAAE,EACF,IAAI,GACL,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;CACjB,2CAOA;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAiBhE;AAED,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,kDAgBxD;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAiB/D;AAED,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAO,EACP,GAAG,IAAI,EACR,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CA0CA"}
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import React, { createContext, memo, useCallback, useContext, useEffect, useMemo
|
|
|
2
2
|
import { View, Text, Pressable, Animated, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import { useInteractionState } from '../hooks/useInteractionState';
|
|
5
6
|
import { animation, borderRadius, space } from '../styles/tokens';
|
|
6
7
|
import { SUPPORTS_NATIVE_DRIVER } from '../styles/native-driver';
|
|
7
8
|
import type {
|
|
@@ -132,6 +133,11 @@ const AccordionTriggerComponent: React.FC<AccordionTriggerProps> = ({
|
|
|
132
133
|
const { toggle } = useContext(AccordionContext);
|
|
133
134
|
const { value, isExpanded, disabled } = useContext(AccordionItemContext);
|
|
134
135
|
const rotateAnim = useRef(new Animated.Value(isExpanded ? 1 : 0)).current;
|
|
136
|
+
// Drive press-opacity via state, not Pressable's function-form `style`,
|
|
137
|
+
// which NativeWind v4's css-interop swallows (dropping the trigger's base
|
|
138
|
+
// layout: flexDirection, padding, gap).
|
|
139
|
+
const { state: pressed, onIn: onPressIn, onOut: onPressOut } =
|
|
140
|
+
useInteractionState();
|
|
135
141
|
|
|
136
142
|
useEffect(() => {
|
|
137
143
|
Animated.spring(rotateAnim, {
|
|
@@ -154,7 +160,7 @@ const AccordionTriggerComponent: React.FC<AccordionTriggerProps> = ({
|
|
|
154
160
|
|
|
155
161
|
return (
|
|
156
162
|
<Pressable
|
|
157
|
-
style={
|
|
163
|
+
style={[
|
|
158
164
|
{
|
|
159
165
|
flexDirection: 'row',
|
|
160
166
|
alignItems: 'center',
|
|
@@ -166,6 +172,8 @@ const AccordionTriggerComponent: React.FC<AccordionTriggerProps> = ({
|
|
|
166
172
|
style,
|
|
167
173
|
]}
|
|
168
174
|
onPress={handlePress}
|
|
175
|
+
onPressIn={disabled ? undefined : onPressIn}
|
|
176
|
+
onPressOut={disabled ? undefined : onPressOut}
|
|
169
177
|
disabled={disabled}
|
|
170
178
|
accessibilityRole="button"
|
|
171
179
|
accessibilityState={{ expanded: isExpanded, disabled }}
|
package/src/button/Button.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import { useTheme } from '../theme/use-theme';
|
|
15
15
|
import { usePressAnimation } from '../hooks/usePressAnimation';
|
|
16
|
+
import { useInteractionState } from '../hooks/useInteractionState';
|
|
16
17
|
import type { ButtonProps } from './types';
|
|
17
18
|
|
|
18
19
|
export type { ButtonProps, ButtonVariant, ButtonSize } from './types';
|
|
@@ -65,9 +66,34 @@ const ButtonComponent: React.FC<ButtonProps> = ({
|
|
|
65
66
|
const theme = useTheme();
|
|
66
67
|
const hasScaleFeedback = SCALE_VARIANTS.has(variant);
|
|
67
68
|
const isInteractionBlocked = disabled || loading;
|
|
68
|
-
const { scaleAnim, onPressIn, onPressOut } =
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
const { scaleAnim, onPressIn: onScalePressIn, onPressOut: onScalePressOut } =
|
|
70
|
+
usePressAnimation(
|
|
71
|
+
hasScaleFeedback && !isInteractionBlocked ? PRESS_SCALE : undefined,
|
|
72
|
+
);
|
|
73
|
+
// Non-scale variants (icon/ghost/text) convey press feedback via an opacity
|
|
74
|
+
// dip. We drive it through component state + onPressIn/onPressOut rather than
|
|
75
|
+
// Pressable's function-form `style` because NativeWind v4's css-interop
|
|
76
|
+
// rewrites the `style` prop of every JSX element and swallows the function
|
|
77
|
+
// form, which would drop ALL base styles (background, radius, padding,
|
|
78
|
+
// minHeight). A static style array is merged correctly by css-interop.
|
|
79
|
+
const { state: pressed, onIn: onPressedIn, onOut: onPressedOut } =
|
|
80
|
+
useInteractionState();
|
|
81
|
+
|
|
82
|
+
const handlePressIn = useMemo(() => {
|
|
83
|
+
if (isInteractionBlocked) return undefined;
|
|
84
|
+
return () => {
|
|
85
|
+
onScalePressIn();
|
|
86
|
+
onPressedIn();
|
|
87
|
+
};
|
|
88
|
+
}, [isInteractionBlocked, onScalePressIn, onPressedIn]);
|
|
89
|
+
|
|
90
|
+
const handlePressOut = useMemo(() => {
|
|
91
|
+
if (isInteractionBlocked) return undefined;
|
|
92
|
+
return () => {
|
|
93
|
+
onScalePressOut();
|
|
94
|
+
onPressedOut();
|
|
95
|
+
};
|
|
96
|
+
}, [isInteractionBlocked, onScalePressOut, onPressedOut]);
|
|
71
97
|
|
|
72
98
|
const baseStyles = useMemo((): ViewStyle => {
|
|
73
99
|
const sizeConfig = SIZE_CONFIG[size];
|
|
@@ -163,15 +189,15 @@ const ButtonComponent: React.FC<ButtonProps> = ({
|
|
|
163
189
|
<Animated.View style={hasScaleFeedback ? { transform: [{ scale: scaleAnim }] } : undefined}>
|
|
164
190
|
<Pressable
|
|
165
191
|
{...(resolvedClassName ? { className: resolvedClassName } as Record<string, string> : {})}
|
|
166
|
-
style={
|
|
192
|
+
style={[
|
|
167
193
|
baseStyles,
|
|
168
194
|
disabled && !loading && { opacity: 0.5 },
|
|
169
195
|
pressed && !hasScaleFeedback && !isInteractionBlocked && { opacity: resolvedActiveOpacity },
|
|
170
196
|
style,
|
|
171
197
|
]}
|
|
172
198
|
onPress={isInteractionBlocked ? undefined : onPress}
|
|
173
|
-
onPressIn={
|
|
174
|
-
onPressOut={
|
|
199
|
+
onPressIn={handlePressIn}
|
|
200
|
+
onPressOut={handlePressOut}
|
|
175
201
|
disabled={isInteractionBlocked}
|
|
176
202
|
hitSlop={hitSlop ?? defaultHitSlop}
|
|
177
203
|
accessibilityLabel={accessibilityLabel}
|
package/src/card/Card.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React, { memo, useMemo } from 'react';
|
|
|
2
2
|
import { View, Text, Pressable, Platform, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import { useInteractionState } from '../hooks/useInteractionState';
|
|
5
6
|
import { borderRadius, space } from '../styles/tokens';
|
|
6
7
|
import type {
|
|
7
8
|
CardProps,
|
|
@@ -22,6 +23,11 @@ const CardRootComponent: React.FC<CardProps> = ({
|
|
|
22
23
|
testID,
|
|
23
24
|
}) => {
|
|
24
25
|
const theme = useTheme();
|
|
26
|
+
// Drive the press-opacity via state instead of Pressable's function-form
|
|
27
|
+
// `style`, which NativeWind v4's css-interop swallows (dropping the base
|
|
28
|
+
// container style: background, radius, border, shadow).
|
|
29
|
+
const { state: pressed, onIn: onPressIn, onOut: onPressOut } =
|
|
30
|
+
useInteractionState();
|
|
25
31
|
|
|
26
32
|
const containerStyle = useMemo((): ViewStyle => {
|
|
27
33
|
const base: ViewStyle = {
|
|
@@ -58,13 +64,15 @@ const CardRootComponent: React.FC<CardProps> = ({
|
|
|
58
64
|
if (onPress) {
|
|
59
65
|
return (
|
|
60
66
|
<Pressable
|
|
61
|
-
style={
|
|
67
|
+
style={[
|
|
62
68
|
containerStyle,
|
|
63
|
-
pressed && { opacity: 0.85 },
|
|
69
|
+
pressed && !disabled && { opacity: 0.85 },
|
|
64
70
|
disabled && { opacity: 0.5 },
|
|
65
71
|
style,
|
|
66
72
|
]}
|
|
67
73
|
onPress={onPress}
|
|
74
|
+
onPressIn={disabled ? undefined : onPressIn}
|
|
75
|
+
onPressOut={disabled ? undefined : onPressOut}
|
|
68
76
|
disabled={disabled}
|
|
69
77
|
accessibilityLabel={accessibilityLabel}
|
|
70
78
|
accessibilityRole="button"
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
import Animated, { Easing, LinearTransition } from 'react-native-reanimated';
|
|
21
21
|
|
|
22
22
|
import { useTheme } from '../theme/use-theme';
|
|
23
|
+
import { useInteractionState } from '../hooks/useInteractionState';
|
|
23
24
|
import { atoms as a, platform } from '../styles';
|
|
24
25
|
|
|
25
26
|
const InternalContext = createContext<{
|
|
@@ -167,6 +168,11 @@ export function Item({
|
|
|
167
168
|
const [position, setPosition] = useState<{ x: number; width: number } | null>(
|
|
168
169
|
null,
|
|
169
170
|
);
|
|
171
|
+
// Drive press-opacity via state, not Pressable's function-form `style`:
|
|
172
|
+
// NativeWind v4's css-interop swallows the function form, which would drop
|
|
173
|
+
// the segment's base layout styles (flex_1, padding, minHeight, radius).
|
|
174
|
+
const { state: pressed, onIn: onPressIn, onOut: onPressOut } =
|
|
175
|
+
useInteractionState();
|
|
170
176
|
|
|
171
177
|
const ctx = useContext(InternalContext);
|
|
172
178
|
if (!ctx) {
|
|
@@ -230,13 +236,15 @@ export function Item({
|
|
|
230
236
|
}}>
|
|
231
237
|
<Pressable
|
|
232
238
|
onPress={onPress}
|
|
239
|
+
onPressIn={disabled ? undefined : onPressIn}
|
|
240
|
+
onPressOut={disabled ? undefined : onPressOut}
|
|
233
241
|
accessibilityLabel={accessibilityLabel}
|
|
234
242
|
accessibilityHint={accessibilityHint}
|
|
235
243
|
accessibilityState={{ selected: active, disabled: !!disabled }}
|
|
236
244
|
role={itemRole}
|
|
237
245
|
disabled={disabled}
|
|
238
246
|
testID={testID}
|
|
239
|
-
style={
|
|
247
|
+
style={[
|
|
240
248
|
a.flex_1,
|
|
241
249
|
a.flex_row,
|
|
242
250
|
a.align_center,
|
|
@@ -2,6 +2,7 @@ import React, { memo } from 'react';
|
|
|
2
2
|
import { View, Text, Pressable, StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
|
+
import { useInteractionState } from '../hooks/useInteractionState';
|
|
5
6
|
import type {
|
|
6
7
|
SettingsListItemProps,
|
|
7
8
|
SettingsListGroupProps,
|
|
@@ -45,6 +46,10 @@ export const SettingsListItem = memo<SettingsListItemProps>(function SettingsLis
|
|
|
45
46
|
const hasChevron = showChevron ?? Boolean(onPress);
|
|
46
47
|
const titleColor = destructive ? theme.colors.error : theme.colors.text;
|
|
47
48
|
const pressedOpacity = disabled ? 1 : 0.6;
|
|
49
|
+
// Drive press-opacity via state, not Pressable's function-form `style`,
|
|
50
|
+
// which NativeWind v4's css-interop swallows.
|
|
51
|
+
const { state: pressed, onIn: onPressIn, onOut: onPressOut } =
|
|
52
|
+
useInteractionState();
|
|
48
53
|
|
|
49
54
|
const role = accessibilityRole ?? (onPress ? 'button' : 'none');
|
|
50
55
|
const label = accessibilityLabel ?? title;
|
|
@@ -100,13 +105,15 @@ export const SettingsListItem = memo<SettingsListItemProps>(function SettingsLis
|
|
|
100
105
|
return (
|
|
101
106
|
<Pressable
|
|
102
107
|
onPress={onPress}
|
|
108
|
+
onPressIn={disabled ? undefined : onPressIn}
|
|
109
|
+
onPressOut={disabled ? undefined : onPressOut}
|
|
103
110
|
disabled={disabled}
|
|
104
111
|
android_ripple={{ color: theme.colors.border }}
|
|
105
112
|
accessibilityRole={role}
|
|
106
113
|
accessibilityLabel={label}
|
|
107
114
|
accessibilityHint={accessibilityHint}
|
|
108
115
|
accessibilityState={disabled ? { disabled: true } : undefined}
|
|
109
|
-
style={
|
|
116
|
+
style={[
|
|
110
117
|
disabled && styles.disabled,
|
|
111
118
|
pressed && { opacity: pressedOpacity },
|
|
112
119
|
]}
|
package/src/toast/Toast.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
|
|
10
10
|
import { useTheme } from '../theme/use-theme';
|
|
11
|
+
import { useInteractionState } from '../hooks/useInteractionState';
|
|
11
12
|
import type { ThemeColors } from '../theme/types';
|
|
12
13
|
import { dismiss } from './sonner';
|
|
13
14
|
import type { ToastType } from './types';
|
|
@@ -106,6 +107,11 @@ export function Action({
|
|
|
106
107
|
const { colors } = useTheme();
|
|
107
108
|
const { type, id } = useContext(ToastConfigContext);
|
|
108
109
|
const actionColors = useActionColors({ type, colors });
|
|
110
|
+
// Drive the pressed visual via state, not Pressable's function-form `style`
|
|
111
|
+
// / function-children, which NativeWind v4's css-interop swallows (dropping
|
|
112
|
+
// the base button style: padding, radius, alignSelf).
|
|
113
|
+
const { state: pressed, onIn: onPressIn, onOut: onPressOut } =
|
|
114
|
+
useInteractionState();
|
|
109
115
|
|
|
110
116
|
const handlePress = (e: GestureResponderEvent) => {
|
|
111
117
|
dismiss(id);
|
|
@@ -116,7 +122,9 @@ export function Action({
|
|
|
116
122
|
<Pressable
|
|
117
123
|
{...rest}
|
|
118
124
|
onPress={handlePress}
|
|
119
|
-
|
|
125
|
+
onPressIn={onPressIn}
|
|
126
|
+
onPressOut={onPressOut}
|
|
127
|
+
style={[
|
|
120
128
|
styles.actionButton,
|
|
121
129
|
{
|
|
122
130
|
backgroundColor: pressed
|
|
@@ -124,19 +132,17 @@ export function Action({
|
|
|
124
132
|
: actionColors.base.backgroundColor,
|
|
125
133
|
},
|
|
126
134
|
]}>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
</RNText>
|
|
139
|
-
)}
|
|
135
|
+
<RNText
|
|
136
|
+
style={[
|
|
137
|
+
styles.actionText,
|
|
138
|
+
{
|
|
139
|
+
color: pressed
|
|
140
|
+
? actionColors.interacted.textColor
|
|
141
|
+
: actionColors.base.textColor,
|
|
142
|
+
},
|
|
143
|
+
]}>
|
|
144
|
+
{children}
|
|
145
|
+
</RNText>
|
|
140
146
|
</Pressable>
|
|
141
147
|
);
|
|
142
148
|
}
|