@marktiderman/genesis-ui-native 3.5.1 → 3.7.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/README.md +115 -7
- package/dist/{chunk-ONH2PCGH.js → chunk-3KFUS7O6.js} +9 -15
- package/dist/chunk-3KFUS7O6.js.map +1 -0
- package/dist/{chunk-LBVD7XXL.js → chunk-7NDKIIOT.js} +627 -20
- package/dist/chunk-7NDKIIOT.js.map +1 -0
- package/dist/chunk-CAI7LGN6.js +39 -0
- package/dist/chunk-CAI7LGN6.js.map +1 -0
- package/dist/{chunk-ABVSSJNT.js → chunk-GBNIBHSU.js} +198 -168
- package/dist/chunk-GBNIBHSU.js.map +1 -0
- package/dist/chunk-IXC3LO2K.js +410 -0
- package/dist/chunk-IXC3LO2K.js.map +1 -0
- package/dist/{chunk-GHYUNNNU.js → chunk-KH2RVAI5.js} +174 -93
- package/dist/chunk-KH2RVAI5.js.map +1 -0
- package/dist/{chunk-6KWEAGRD.js → chunk-O4BMDV7I.js} +110 -17
- package/dist/chunk-O4BMDV7I.js.map +1 -0
- package/dist/chunk-RTYO24SC.js +105 -0
- package/dist/chunk-RTYO24SC.js.map +1 -0
- package/dist/{chunk-D5RKSPMH.js → chunk-YWDDDYDI.js} +4 -3
- package/dist/chunk-YWDDDYDI.js.map +1 -0
- package/dist/components/index.d.ts +382 -10
- package/dist/components/index.js +6 -5
- package/dist/data/index.d.ts +68 -4
- package/dist/data/index.js +231 -30
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.d.ts +90 -2
- package/dist/hooks/index.js +3 -3
- package/dist/icons/lucide.d.ts +1 -1
- package/dist/icons/lucide.js +7 -1
- package/dist/icons/lucide.js.map +1 -1
- package/dist/{inbox-page-BEarNEIP.d.ts → inbox-page-B7_Oi2fS.d.ts} +2 -44
- package/dist/index.d.ts +8 -5
- package/dist/index.js +9 -8
- package/dist/layouts/index.d.ts +40 -51
- package/dist/layouts/index.js +6 -4
- package/dist/{native-modules-PwnGltOU.d.ts → native-modules-DEJJQhDx.d.ts} +55 -1
- package/package.json +101 -4
- package/src/__tests__/doctor-rules.test.ts +87 -0
- package/src/__tests__/native-modules-lists.test.tsx +1 -0
- package/src/components/__tests__/button-haptic.test.tsx +52 -0
- package/src/components/__tests__/composer-bar.test.tsx +79 -0
- package/src/components/__tests__/gallery-card.test.tsx +59 -0
- package/src/components/__tests__/gallery-grid.test.tsx +160 -0
- package/src/components/__tests__/lightbox-resnap.test.tsx +50 -0
- package/src/components/__tests__/lightbox-zoom.test.ts +33 -0
- package/src/components/__tests__/lightbox.test.tsx +141 -0
- package/src/components/__tests__/live-indicator.test.tsx +72 -0
- package/src/components/__tests__/rating.test.tsx +82 -0
- package/src/components/__tests__/thread-list.test.tsx +219 -0
- package/src/components/button.tsx +18 -1
- package/src/components/composer-bar.tsx +276 -0
- package/src/components/drawer.tsx +15 -9
- package/src/components/gallery-card.tsx +109 -0
- package/src/components/gallery-grid.tsx +285 -0
- package/src/components/gallery-layout.ts +2 -0
- package/src/components/gallery-types.ts +2 -0
- package/src/components/index.ts +44 -0
- package/src/components/lightbox-zoom.tsx +282 -0
- package/src/components/lightbox.tsx +342 -0
- package/src/components/live-indicator.tsx +139 -0
- package/src/components/rating.tsx +128 -0
- package/src/components/skeleton.tsx +9 -4
- package/src/components/thread-list.tsx +457 -0
- package/src/components/toast.tsx +7 -4
- package/src/data/NativeConflictSheet.tsx +181 -0
- package/src/data/NativeResourceForm.tsx +15 -1
- package/src/data/index.ts +2 -0
- package/src/data/resource-view/NativeRecordView.tsx +85 -8
- package/src/data/resource-view/NativeResourceView.tsx +79 -32
- package/src/data/resource-view/__tests__/native-record-view.test.tsx +95 -1
- package/src/data/resource-view/__tests__/native-resource-gallery.test.tsx +125 -0
- package/src/hooks/__tests__/use-haptics.test.tsx +146 -0
- package/src/hooks/__tests__/use-motion.test.tsx +106 -0
- package/src/hooks/__tests__/use-thread-jump.test.tsx +88 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-haptics.ts +64 -0
- package/src/hooks/use-motion.ts +128 -0
- package/src/hooks/use-press-feedback.ts +87 -0
- package/src/hooks/use-thread-jump.ts +110 -0
- package/src/icon-names.ts +6 -0
- package/src/icons/lucide.ts +12 -0
- package/src/layouts/__tests__/inbox-page.test.tsx +6 -0
- package/src/layouts/__tests__/thread-page.test.tsx +114 -14
- package/src/layouts/inbox-page.tsx +6 -55
- package/src/layouts/index.ts +2 -0
- package/src/layouts/thread-page.tsx +326 -262
- package/src/native-modules.tsx +20 -2
- package/dist/chunk-6KWEAGRD.js.map +0 -1
- package/dist/chunk-7PCWEY6R.js +0 -27
- package/dist/chunk-7PCWEY6R.js.map +0 -1
- package/dist/chunk-ABVSSJNT.js.map +0 -1
- package/dist/chunk-D5RKSPMH.js.map +0 -1
- package/dist/chunk-GHYUNNNU.js.map +0 -1
- package/dist/chunk-LBVD7XXL.js.map +0 -1
- package/dist/chunk-ONH2PCGH.js.map +0 -1
- package/dist/chunk-Z3AQYVUA.js +0 -36
- package/dist/chunk-Z3AQYVUA.js.map +0 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { act, renderHook, waitFor } from "@testing-library/react";
|
|
4
|
+
import { AccessibilityInfo, Animated } from "react-native";
|
|
5
|
+
import { GenesisModulesProvider } from "../../native-modules";
|
|
6
|
+
import { playHaptic, useHaptics, type GenesisHapticsModule } from "../use-haptics";
|
|
7
|
+
import { usePressFeedback } from "../use-press-feedback";
|
|
8
|
+
import { __resetReducedMotion } from "../use-reduced-motion";
|
|
9
|
+
|
|
10
|
+
function fakeHaptics(overrides: Partial<GenesisHapticsModule> = {}) {
|
|
11
|
+
return {
|
|
12
|
+
impactAsync: vi.fn(() => Promise.resolve()),
|
|
13
|
+
selectionAsync: vi.fn(() => Promise.resolve()),
|
|
14
|
+
notificationAsync: vi.fn(() => Promise.resolve()),
|
|
15
|
+
ImpactFeedbackStyle: { Light: "light", Medium: "medium", Heavy: "heavy" },
|
|
16
|
+
NotificationFeedbackType: { Success: "success", Warning: "warning", Error: "error" },
|
|
17
|
+
...overrides,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const withHaptics = (haptics: GenesisHapticsModule) =>
|
|
22
|
+
function Wrapper({ children }: { children: ReactNode }) {
|
|
23
|
+
return <GenesisModulesProvider modules={{ haptics }}>{children}</GenesisModulesProvider>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
vi.restoreAllMocks();
|
|
28
|
+
__resetReducedMotion();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe("playHaptic", () => {
|
|
32
|
+
it.each([
|
|
33
|
+
["light", "impactAsync", "light"],
|
|
34
|
+
["medium", "impactAsync", "medium"],
|
|
35
|
+
["heavy", "impactAsync", "heavy"],
|
|
36
|
+
["success", "notificationAsync", "success"],
|
|
37
|
+
["warning", "notificationAsync", "warning"],
|
|
38
|
+
["error", "notificationAsync", "error"],
|
|
39
|
+
] as const)("plays %s through %s", (kind, method, style) => {
|
|
40
|
+
const h = fakeHaptics();
|
|
41
|
+
playHaptic(h, kind);
|
|
42
|
+
expect(h[method]).toHaveBeenCalledWith(style);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("plays select as a selection tick", () => {
|
|
46
|
+
const h = fakeHaptics();
|
|
47
|
+
playHaptic(h, "select");
|
|
48
|
+
expect(h.selectionAsync).toHaveBeenCalled();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("falls back to medium when the module has no heavy style", () => {
|
|
52
|
+
const h = fakeHaptics({ ImpactFeedbackStyle: { Light: "light", Medium: "medium" } });
|
|
53
|
+
playHaptic(h, "heavy");
|
|
54
|
+
expect(h.impactAsync).toHaveBeenCalledWith("medium");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("does nothing without a module", () => {
|
|
58
|
+
expect(() => playHaptic(undefined, "light")).not.toThrow();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("never throws or rejects", async () => {
|
|
62
|
+
const throws = fakeHaptics({ impactAsync: vi.fn(() => { throw new Error("no engine"); }) });
|
|
63
|
+
expect(() => playHaptic(throws, "light")).not.toThrow();
|
|
64
|
+
const rejects = fakeHaptics({ selectionAsync: vi.fn(() => Promise.reject(new Error("no engine"))) });
|
|
65
|
+
playHaptic(rejects, "select");
|
|
66
|
+
await act(async () => {});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe("useHaptics", () => {
|
|
71
|
+
it("plays through the app's GenesisModules.haptics", () => {
|
|
72
|
+
const h = fakeHaptics();
|
|
73
|
+
const { result } = renderHook(() => useHaptics(), { wrapper: withHaptics(h) });
|
|
74
|
+
result.current("success");
|
|
75
|
+
expect(h.notificationAsync).toHaveBeenCalledWith("success");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("is a no-op without the module", () => {
|
|
79
|
+
const { result } = renderHook(() => useHaptics());
|
|
80
|
+
expect(() => result.current("light")).not.toThrow();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe("usePressFeedback", () => {
|
|
85
|
+
it("shrinks while held and plays its haptic only when the press counts", async () => {
|
|
86
|
+
vi.spyOn(AccessibilityInfo, "isReduceMotionEnabled").mockResolvedValue(false);
|
|
87
|
+
const timing = vi.spyOn(Animated, "timing");
|
|
88
|
+
const spring = vi.spyOn(Animated, "spring");
|
|
89
|
+
const h = fakeHaptics();
|
|
90
|
+
const { result } = renderHook(() => usePressFeedback({ haptic: "light" }), { wrapper: withHaptics(h) });
|
|
91
|
+
await act(async () => {});
|
|
92
|
+
expect(result.current.style.transform).toHaveLength(1);
|
|
93
|
+
result.current.onPressIn();
|
|
94
|
+
expect(timing).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ toValue: 0.97, useNativeDriver: true }));
|
|
95
|
+
result.current.onPressOut();
|
|
96
|
+
expect(spring).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ toValue: 1, damping: 30, stiffness: 400 }));
|
|
97
|
+
expect(h.impactAsync).not.toHaveBeenCalled();
|
|
98
|
+
result.current.confirm();
|
|
99
|
+
expect(h.impactAsync).toHaveBeenCalledWith("light");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("ticks on press-in for select", () => {
|
|
103
|
+
const h = fakeHaptics();
|
|
104
|
+
const { result } = renderHook(() => usePressFeedback({ haptic: "select" }), { wrapper: withHaptics(h) });
|
|
105
|
+
result.current.onPressIn();
|
|
106
|
+
expect(h.selectionAsync).toHaveBeenCalledTimes(1);
|
|
107
|
+
result.current.confirm();
|
|
108
|
+
expect(h.selectionAsync).toHaveBeenCalledTimes(1);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("dims instead of moving under Reduce Motion, and never springs", async () => {
|
|
112
|
+
vi.spyOn(AccessibilityInfo, "isReduceMotionEnabled").mockResolvedValue(true);
|
|
113
|
+
const timing = vi.spyOn(Animated, "timing");
|
|
114
|
+
const spring = vi.spyOn(Animated, "spring");
|
|
115
|
+
const { result } = renderHook(() => usePressFeedback());
|
|
116
|
+
await waitFor(() => expect(result.current.style.opacity).toBeDefined());
|
|
117
|
+
expect(result.current.style.transform).toBeUndefined();
|
|
118
|
+
result.current.onPressIn();
|
|
119
|
+
expect(timing).toHaveBeenLastCalledWith(expect.anything(), expect.objectContaining({ toValue: 0.6 }));
|
|
120
|
+
result.current.onPressOut();
|
|
121
|
+
expect(timing).toHaveBeenLastCalledWith(expect.anything(), expect.objectContaining({ toValue: 1 }));
|
|
122
|
+
expect(spring).not.toHaveBeenCalled();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("gives no feedback when disabled", () => {
|
|
126
|
+
const timing = vi.spyOn(Animated, "timing");
|
|
127
|
+
const h = fakeHaptics();
|
|
128
|
+
const { result } = renderHook(() => usePressFeedback({ haptic: "light", disabled: true }), { wrapper: withHaptics(h) });
|
|
129
|
+
expect(result.current.style).toEqual({});
|
|
130
|
+
result.current.onPressIn();
|
|
131
|
+
result.current.confirm();
|
|
132
|
+
expect(timing).not.toHaveBeenCalled();
|
|
133
|
+
expect(h.impactAsync).not.toHaveBeenCalled();
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
describe("usePressFeedback, disabled mid-press", () => {
|
|
138
|
+
it("comes back to rest when disabled while held", () => {
|
|
139
|
+
const { result, rerender } = renderHook(({ disabled }) => usePressFeedback({ disabled }), { initialProps: { disabled: false } });
|
|
140
|
+
const value = result.current.style.transform?.[0]?.scale as unknown as { setValue: (v: number) => void };
|
|
141
|
+
const reset = vi.spyOn(value, "setValue");
|
|
142
|
+
result.current.onPressIn();
|
|
143
|
+
rerender({ disabled: true });
|
|
144
|
+
expect(reset).toHaveBeenCalledWith(1);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { act, renderHook, waitFor } from "@testing-library/react";
|
|
3
|
+
import { AccessibilityInfo } from "react-native";
|
|
4
|
+
import { MOTION_DURATIONS, MOTION_SPRINGS, resolveMotion } from "@marktiderman/genesis-design-system/tokens/motion";
|
|
5
|
+
import { animateMotion, motionSpring, motionTiming, useMotion } from "../use-motion";
|
|
6
|
+
import { __resetReducedMotion } from "../use-reduced-motion";
|
|
7
|
+
import { fakeReanimated } from "../../__tests__/fake-modules";
|
|
8
|
+
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
vi.restoreAllMocks();
|
|
11
|
+
__resetReducedMotion();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe("useMotion", () => {
|
|
15
|
+
it("gives the shared tokens at calm by default, once the OS has answered", async () => {
|
|
16
|
+
const asked = vi.spyOn(AccessibilityInfo, "isReduceMotionEnabled").mockResolvedValue(false);
|
|
17
|
+
const { result } = renderHook(() => useMotion());
|
|
18
|
+
await waitFor(() => expect(asked).toHaveBeenCalled());
|
|
19
|
+
await act(async () => {});
|
|
20
|
+
expect(result.current.level).toBe("calm");
|
|
21
|
+
expect(result.current.reduced).toBe(false);
|
|
22
|
+
expect(result.current.duration).toEqual(MOTION_DURATIONS);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("holds still when the OS asks for reduced motion", async () => {
|
|
26
|
+
vi.spyOn(AccessibilityInfo, "isReduceMotionEnabled").mockResolvedValue(true);
|
|
27
|
+
const { result } = renderHook(() => useMotion({ level: "bold" }));
|
|
28
|
+
await waitFor(() => expect(result.current.reduced).toBe(true));
|
|
29
|
+
expect(result.current.duration.ui).toBe(0);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("holds still at level none", () => {
|
|
33
|
+
vi.spyOn(AccessibilityInfo, "isReduceMotionEnabled").mockResolvedValue(false);
|
|
34
|
+
const { result } = renderHook(() => useMotion({ level: "none" }));
|
|
35
|
+
expect(result.current.reduced).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe("animateMotion", () => {
|
|
40
|
+
it("springs with the named spring and the gesture's velocity", () => {
|
|
41
|
+
const R = { ...fakeReanimated(), withSpring: vi.fn((to: number) => to) };
|
|
42
|
+
animateMotion(R, resolveMotion("calm"), 0, { spring: "snappy", velocity: 800 });
|
|
43
|
+
expect(R.withSpring).toHaveBeenCalledWith(0, { ...MOTION_SPRINGS.snappy, velocity: 800 });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("times with the named duration and the token's curve", () => {
|
|
47
|
+
const bezier = vi.fn(() => "curve");
|
|
48
|
+
const fake = fakeReanimated();
|
|
49
|
+
const R = { ...fake, Easing: { ...fake.Easing, bezier } };
|
|
50
|
+
animateMotion(R, resolveMotion("calm"), 1, { duration: "fast", easing: "decelerate" });
|
|
51
|
+
expect(bezier).toHaveBeenCalledWith(0.33, 1, 0.68, 1);
|
|
52
|
+
expect(R.withTiming).toHaveBeenCalledWith(1, { duration: MOTION_DURATIONS.fast, easing: "curve" });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("falls back to timing at base when the module has no withSpring", () => {
|
|
56
|
+
const R = fakeReanimated();
|
|
57
|
+
animateMotion(R, resolveMotion("calm"), 0, { spring: "smooth" });
|
|
58
|
+
expect(R.withTiming).toHaveBeenCalledWith(0, expect.objectContaining({ duration: MOTION_DURATIONS.base }));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("returns the final value, without animating, under reduced motion", () => {
|
|
62
|
+
const R = { ...fakeReanimated(), withSpring: vi.fn((to: number) => to) };
|
|
63
|
+
expect(animateMotion(R, resolveMotion("calm", { reducedMotion: true }), 42, { spring: "bouncy" })).toBe(42);
|
|
64
|
+
expect(R.withSpring).not.toHaveBeenCalled();
|
|
65
|
+
expect(R.withTiming).not.toHaveBeenCalled();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("leaves velocity out when the gesture gave none", () => {
|
|
69
|
+
const R = { ...fakeReanimated(), withSpring: vi.fn((to: number) => to) };
|
|
70
|
+
animateMotion(R, resolveMotion("calm"), 0, { spring: "smooth" });
|
|
71
|
+
expect((R.withSpring.mock.calls[0] as unknown[] | undefined)?.[1]).not.toHaveProperty("velocity");
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe("worklet-safe configs", () => {
|
|
76
|
+
it("are marked as worklets, so Reanimated's Babel plugin moves them to the UI thread", () => {
|
|
77
|
+
// The directive must survive in the shipped source (ui-native's react-native entry is ./src).
|
|
78
|
+
for (const fn of [motionSpring, motionTiming]) expect(fn.toString()).toMatch(/["']worklet["']/);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("builds a spring config, with velocity only when given", () => {
|
|
82
|
+
const m = resolveMotion("calm");
|
|
83
|
+
expect(motionSpring(m, "snappy")).toEqual(MOTION_SPRINGS.snappy);
|
|
84
|
+
expect(motionSpring(m, "snappy", -300)).toEqual({ ...MOTION_SPRINGS.snappy, velocity: -300 });
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("settles at once, without the gesture's velocity, under reduced motion", () => {
|
|
88
|
+
const still = motionSpring(resolveMotion("calm", { reducedMotion: true }), "bouncy", 900);
|
|
89
|
+
expect(still).not.toHaveProperty("velocity");
|
|
90
|
+
// Critically damped (no overshoot) and far stiffer than any named spring.
|
|
91
|
+
expect(still.damping).toBeGreaterThanOrEqual(2 * Math.sqrt(still.stiffness * still.mass));
|
|
92
|
+
expect(still.stiffness).toBeGreaterThan(MOTION_SPRINGS.snappy.stiffness * 10);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("builds a timing config with the token's curve", () => {
|
|
96
|
+
const m = resolveMotion("calm");
|
|
97
|
+
const bezier = vi.fn(() => "curve");
|
|
98
|
+
expect(motionTiming(m, "ui", { bezier }, "inOut")).toEqual({ duration: MOTION_DURATIONS.ui, easing: "curve" });
|
|
99
|
+
expect(bezier).toHaveBeenCalledWith(0.65, 0, 0.35, 1);
|
|
100
|
+
expect(motionTiming(m, "ui", undefined)).toEqual({ duration: MOTION_DURATIONS.ui });
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("zeroes durations under reduced motion", () => {
|
|
104
|
+
expect(motionTiming(resolveMotion("none"), "ui", undefined)).toEqual({ duration: 0 });
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// @feat:inbox-thread
|
|
2
|
+
import { act, renderHook } from "@testing-library/react";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { JUMP_SETTLE_MS, useThreadJump } from "../use-thread-jump";
|
|
5
|
+
|
|
6
|
+
beforeEach(() => vi.useFakeTimers());
|
|
7
|
+
afterEach(() => vi.useRealTimers());
|
|
8
|
+
|
|
9
|
+
const setup = (initial: { target: string | null; ids: string[]; loading?: boolean; loadUntil?: (id: string) => Promise<boolean> }) => {
|
|
10
|
+
const scrollTo = vi.fn();
|
|
11
|
+
const onGone = vi.fn();
|
|
12
|
+
const onLanded = vi.fn();
|
|
13
|
+
const hook = renderHook(
|
|
14
|
+
(p: typeof initial) => useThreadJump({ target: p.target, has: (id) => p.ids.includes(id), loading: p.loading, loadUntil: p.loadUntil, scrollTo, onGone, onLanded }),
|
|
15
|
+
{ initialProps: initial },
|
|
16
|
+
);
|
|
17
|
+
return { ...hook, scrollTo, onGone, onLanded };
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe("useThreadJump", () => {
|
|
21
|
+
it("goes to a held row and highlights it for two seconds", () => {
|
|
22
|
+
const { result, scrollTo, onLanded } = setup({ target: "b", ids: ["a", "b"] });
|
|
23
|
+
expect(scrollTo).toHaveBeenCalledWith("b");
|
|
24
|
+
expect(onLanded).toHaveBeenCalledWith("b");
|
|
25
|
+
expect(result.current.highlightedId).toBe("b");
|
|
26
|
+
act(() => vi.advanceTimersByTime(2000));
|
|
27
|
+
expect(result.current.highlightedId).toBeNull();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("waits for the first page before deciding", () => {
|
|
31
|
+
const { rerender, scrollTo, onGone } = setup({ target: "b", ids: [], loading: true });
|
|
32
|
+
act(() => vi.advanceTimersByTime(1000));
|
|
33
|
+
expect(onGone).not.toHaveBeenCalled();
|
|
34
|
+
rerender({ target: "b", ids: ["a", "b"], loading: false });
|
|
35
|
+
expect(scrollTo).toHaveBeenCalledWith("b");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("finds a row that arrives a moment after loadUntil resolves", async () => {
|
|
39
|
+
const loadUntil = vi.fn(async () => true);
|
|
40
|
+
const { rerender, scrollTo, onGone } = setup({ target: "old", ids: ["a"], loadUntil });
|
|
41
|
+
await act(async () => {});
|
|
42
|
+
expect(loadUntil).toHaveBeenCalledWith("old");
|
|
43
|
+
act(() => vi.advanceTimersByTime(JUMP_SETTLE_MS / 2));
|
|
44
|
+
rerender({ target: "old", ids: ["old", "a"], loadUntil });
|
|
45
|
+
expect(scrollTo).toHaveBeenCalledWith("old");
|
|
46
|
+
act(() => vi.advanceTimersByTime(JUMP_SETTLE_MS));
|
|
47
|
+
expect(onGone).not.toHaveBeenCalled();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("says a row is gone once the rows have had their moment", async () => {
|
|
51
|
+
const loadUntil = vi.fn(async () => false);
|
|
52
|
+
const { scrollTo, onGone } = setup({ target: "gone", ids: ["a"], loadUntil });
|
|
53
|
+
await act(async () => {});
|
|
54
|
+
act(() => vi.advanceTimersByTime(JUMP_SETTLE_MS));
|
|
55
|
+
expect(onGone).toHaveBeenCalledWith("gone");
|
|
56
|
+
expect(scrollTo).not.toHaveBeenCalled();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("goes again to the same row after the target was cleared", () => {
|
|
60
|
+
const { rerender, scrollTo } = setup({ target: "b", ids: ["a", "b"] });
|
|
61
|
+
rerender({ target: null, ids: ["a", "b"] });
|
|
62
|
+
rerender({ target: "b", ids: ["a", "b"] });
|
|
63
|
+
expect(scrollTo).toHaveBeenCalledTimes(2);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("cancels a jump in progress when the target becomes null", async () => {
|
|
67
|
+
let resolve: (v: boolean) => void = () => {};
|
|
68
|
+
const loadUntil = vi.fn(() => new Promise<boolean>((r) => (resolve = r)));
|
|
69
|
+
const { result, rerender, onGone } = setup({ target: "old", ids: ["a"], loadUntil });
|
|
70
|
+
expect(result.current.jumping).toBe(true);
|
|
71
|
+
rerender({ target: null, ids: ["a"], loadUntil });
|
|
72
|
+
expect(result.current.jumping).toBe(false);
|
|
73
|
+
await act(async () => resolve(false));
|
|
74
|
+
act(() => vi.advanceTimersByTime(JUMP_SETTLE_MS * 2));
|
|
75
|
+
expect(onGone).not.toHaveBeenCalled();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("gives up on time in a busy thread, whatever rows keep arriving", async () => {
|
|
79
|
+
const loadUntil = vi.fn(async () => false);
|
|
80
|
+
const { rerender, onGone } = setup({ target: "old", ids: ["a"], loadUntil });
|
|
81
|
+
await act(async () => {});
|
|
82
|
+
for (let i = 0; i < 5; i++) {
|
|
83
|
+
act(() => vi.advanceTimersByTime(JUMP_SETTLE_MS / 4));
|
|
84
|
+
rerender({ target: "old", ids: ["a", `n${i}`], loadUntil });
|
|
85
|
+
}
|
|
86
|
+
expect(onGone).toHaveBeenCalledWith("old");
|
|
87
|
+
});
|
|
88
|
+
});
|
package/src/hooks/index.ts
CHANGED
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export { useReducedMotion } from "./use-reduced-motion";
|
|
10
|
+
// The jump is the shared conversation contract's (genesis-core), re-exported here.
|
|
11
|
+
export { useThreadJump, JUMP_SETTLE_MS, type UseThreadJumpOptions } from "@marktiderman/genesis-core/conversation";
|
|
12
|
+
export { useHaptics, playHaptic, type HapticKind, type GenesisHapticsModule } from "./use-haptics";
|
|
13
|
+
export { usePressFeedback, type PressFeedbackOptions, type PressFeedback } from "./use-press-feedback";
|
|
14
|
+
export { useMotion, animateMotion, motionSpring, motionTiming, type UseMotionOptions, type MotionHow, type MotionSpringConfig, type MotionTimingConfig } from "./use-motion";
|
|
10
15
|
export { useThemeMode, type ThemeMode } from "./use-theme-mode";
|
|
11
16
|
export { useThemeRoles, type ThemeRoleColors, type UseThemeRolesOptions } from "./use-theme-roles";
|
|
12
17
|
export {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Haptics, one way in: the app passes expo-haptics once, as `GenesisModules.haptics`, and every
|
|
3
|
+
* Genesis primitive (and the app's own pieces) plays the same kinds of feedback through
|
|
4
|
+
* `useHaptics()`. Without the module nothing plays, and nothing throws.
|
|
5
|
+
*
|
|
6
|
+
* import * as Haptics from "expo-haptics";
|
|
7
|
+
* <GenesisModulesProvider modules={{ haptics: Haptics }}>
|
|
8
|
+
*
|
|
9
|
+
* const haptic = useHaptics();
|
|
10
|
+
* haptic("select");
|
|
11
|
+
*
|
|
12
|
+
* Kinds follow the platforms' own vocabulary: a light, medium or heavy impact (a press, a swipe
|
|
13
|
+
* passing its threshold, a long press opening a menu), a selection tick (a picker or a tab
|
|
14
|
+
* changing), and a success, warning or error notification. The OS's own haptics setting applies;
|
|
15
|
+
* Reduce Motion doesn't turn haptics off (they're not motion).
|
|
16
|
+
*
|
|
17
|
+
* @stability Beta
|
|
18
|
+
*/
|
|
19
|
+
import { useCallback } from "react";
|
|
20
|
+
import { useGenesisModules } from "../native-modules";
|
|
21
|
+
|
|
22
|
+
/** What a haptic says. */
|
|
23
|
+
export type HapticKind = "light" | "medium" | "heavy" | "select" | "success" | "warning" | "error";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* `import * as Haptics from "expo-haptics"`: the parts Genesis calls, written structurally (the
|
|
27
|
+
* same shape as genesis-chat's `HapticsLike`, so one module serves both).
|
|
28
|
+
*/
|
|
29
|
+
export interface GenesisHapticsModule {
|
|
30
|
+
impactAsync(style?: never): Promise<void>;
|
|
31
|
+
selectionAsync(): Promise<void>;
|
|
32
|
+
notificationAsync(type?: never): Promise<void>;
|
|
33
|
+
ImpactFeedbackStyle: { Light: unknown; Medium: unknown; Heavy?: unknown };
|
|
34
|
+
NotificationFeedbackType: { Success: unknown; Warning: unknown; Error: unknown };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Plays a haptic on the module given; never throws and never rejects. No module, no haptic. */
|
|
38
|
+
export function playHaptic(haptics: GenesisHapticsModule | undefined, kind: HapticKind): void {
|
|
39
|
+
if (!haptics) return;
|
|
40
|
+
try {
|
|
41
|
+
const as = (s: unknown) => s as never;
|
|
42
|
+
const styles = haptics.ImpactFeedbackStyle;
|
|
43
|
+
const notes = haptics.NotificationFeedbackType;
|
|
44
|
+
const p =
|
|
45
|
+
kind === "light"
|
|
46
|
+
? haptics.impactAsync(as(styles.Light))
|
|
47
|
+
: kind === "medium"
|
|
48
|
+
? haptics.impactAsync(as(styles.Medium))
|
|
49
|
+
: kind === "heavy"
|
|
50
|
+
? haptics.impactAsync(as(styles.Heavy ?? styles.Medium))
|
|
51
|
+
: kind === "select"
|
|
52
|
+
? haptics.selectionAsync()
|
|
53
|
+
: haptics.notificationAsync(as(kind === "success" ? notes.Success : kind === "warning" ? notes.Warning : notes.Error));
|
|
54
|
+
void p?.catch?.(() => undefined);
|
|
55
|
+
} catch {
|
|
56
|
+
// A haptic is never worth an error.
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A function that plays a haptic through the app's `GenesisModules.haptics`. Stable across renders. */
|
|
61
|
+
export function useHaptics(): (kind: HapticKind) => void {
|
|
62
|
+
const { haptics } = useGenesisModules();
|
|
63
|
+
return useCallback((kind: HapticKind) => playHaptic(haptics, kind), [haptics]);
|
|
64
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useMotion — the shared motion tokens (genesis-design-system's
|
|
3
|
+
* `resolveMotion`), with the OS's reduce-motion setting applied.
|
|
4
|
+
*
|
|
5
|
+
* Every Genesis primitive that moves reads its durations, easings and springs
|
|
6
|
+
* from here instead of its own constants, so motion is defined once for web
|
|
7
|
+
* and native. Under Reduce Motion every duration is 0 and `animateMotion`
|
|
8
|
+
* returns the final value, so a component lands without moving.
|
|
9
|
+
*
|
|
10
|
+
* The brand's motion level isn't read from a provider yet: pass `level` (a
|
|
11
|
+
* brand whose design system chose `none` passes `"none"`). Without it,
|
|
12
|
+
* `calm`.
|
|
13
|
+
*
|
|
14
|
+
* On the JS thread (an effect, a PanResponder), `animateMotion`:
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const motion = useMotion();
|
|
18
|
+
* const { reanimated: R } = useGenesisModules();
|
|
19
|
+
* opacity.value = animateMotion(R, motion, 1, { duration: "fast", easing: "decelerate" });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Inside a worklet (a gesture's `onEnd`, an animated scroll handler), build
|
|
23
|
+
* the config with the worklet-safe `motionSpring` / `motionTiming` and call
|
|
24
|
+
* Reanimated yourself:
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* .onEnd((e) => { x.value = withSpring(0, motionSpring(motion, "snappy", e.velocityX)); })
|
|
28
|
+
* opacity.value = withTiming(1, motionTiming(motion, "fast", Easing, "decelerate"));
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* A repeating animation checks `motion.reduced` first: a zero-length repeat
|
|
32
|
+
* would flash every frame.
|
|
33
|
+
*
|
|
34
|
+
* @stability Beta
|
|
35
|
+
*/
|
|
36
|
+
import { useMemo } from "react";
|
|
37
|
+
import {
|
|
38
|
+
resolveMotion,
|
|
39
|
+
type MotionDurations,
|
|
40
|
+
type MotionEasings,
|
|
41
|
+
type MotionLevel,
|
|
42
|
+
type MotionSprings,
|
|
43
|
+
type MotionTokens,
|
|
44
|
+
} from "@marktiderman/genesis-design-system/tokens/motion";
|
|
45
|
+
import type { GenesisReanimatedModule } from "../native-modules";
|
|
46
|
+
import { useReducedMotion } from "./use-reduced-motion";
|
|
47
|
+
|
|
48
|
+
export interface UseMotionOptions {
|
|
49
|
+
/** The brand's motion level. Default `calm`; `none` holds everything still, like Reduce Motion. */
|
|
50
|
+
level?: MotionLevel;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function useMotion(options: UseMotionOptions = {}): MotionTokens {
|
|
54
|
+
const reducedMotion = useReducedMotion();
|
|
55
|
+
const level = options.level ?? "calm";
|
|
56
|
+
return useMemo(() => resolveMotion(level, { reducedMotion }), [level, reducedMotion]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** How to get there: a named spring (keeps a gesture's velocity), or a named duration and easing. */
|
|
60
|
+
export type MotionHow =
|
|
61
|
+
| { spring: keyof MotionSprings; velocity?: number; duration?: never; easing?: never }
|
|
62
|
+
| { duration: keyof MotionDurations; easing?: keyof MotionEasings; spring?: never; velocity?: never };
|
|
63
|
+
|
|
64
|
+
/** What `motionSpring` gives `withSpring`. */
|
|
65
|
+
export interface MotionSpringConfig {
|
|
66
|
+
damping: number;
|
|
67
|
+
stiffness: number;
|
|
68
|
+
mass: number;
|
|
69
|
+
velocity?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** What `motionTiming` gives `withTiming`. */
|
|
73
|
+
export interface MotionTimingConfig {
|
|
74
|
+
duration: number;
|
|
75
|
+
easing?: unknown;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A `withSpring` config from a named spring. Worklet-safe (plain data in,
|
|
80
|
+
* plain data out). Under reduced motion it's the stiff, critically damped
|
|
81
|
+
* spring that settles in a few frames; to not move at all, check
|
|
82
|
+
* `motion.reduced` and assign the value.
|
|
83
|
+
*/
|
|
84
|
+
export function motionSpring(motion: MotionTokens, name: keyof MotionSprings, velocity?: number): MotionSpringConfig {
|
|
85
|
+
"worklet";
|
|
86
|
+
const s = motion.spring[name];
|
|
87
|
+
return typeof velocity === "number" && !motion.reduced
|
|
88
|
+
? { damping: s.damping, stiffness: s.stiffness, mass: s.mass, velocity }
|
|
89
|
+
: { damping: s.damping, stiffness: s.stiffness, mass: s.mass };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* A `withTiming` config from a named duration and easing. Pass Reanimated's
|
|
94
|
+
* `Easing` (`R.Easing`, or `Easing` imported in a worklet) so the token's
|
|
95
|
+
* curve is used; a module without `Easing.bezier` gets Reanimated's default
|
|
96
|
+
* curve. Worklet-safe.
|
|
97
|
+
*/
|
|
98
|
+
export function motionTiming(
|
|
99
|
+
motion: MotionTokens,
|
|
100
|
+
duration: keyof MotionDurations,
|
|
101
|
+
Easing: Pick<GenesisReanimatedModule["Easing"], "bezier"> | undefined,
|
|
102
|
+
easing: keyof MotionEasings = "out",
|
|
103
|
+
): MotionTimingConfig {
|
|
104
|
+
"worklet";
|
|
105
|
+
const [x1, y1, x2, y2] = motion.easing[easing];
|
|
106
|
+
const curve = Easing?.bezier ? Easing.bezier(x1, y1, x2, y2) : undefined;
|
|
107
|
+
return curve === undefined ? { duration: motion.duration[duration] } : { duration: motion.duration[duration], easing: curve };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* A Reanimated animation to `toValue` with the motion tokens, for a shared
|
|
112
|
+
* value on the JS thread: `x.value = animateMotion(R, motion, 0, { spring: "smooth" })`.
|
|
113
|
+
* Under reduced motion it returns `toValue` itself, so nothing moves.
|
|
114
|
+
*
|
|
115
|
+
* It takes no completion callback: Reanimated runs one on the UI thread, so
|
|
116
|
+
* it must be a worklet, and the reduced path couldn't keep that promise. To
|
|
117
|
+
* act when an animation ends, call `withSpring` / `withTiming` yourself with
|
|
118
|
+
* `motionSpring` / `motionTiming` and a worklet callback. A module without
|
|
119
|
+
* `withSpring` (an older one, a test fake) gets a `withTiming` at `base`.
|
|
120
|
+
*/
|
|
121
|
+
export function animateMotion(R: GenesisReanimatedModule, motion: MotionTokens, toValue: number, how: MotionHow): number {
|
|
122
|
+
if (motion.reduced) return toValue;
|
|
123
|
+
if (how.spring !== undefined) {
|
|
124
|
+
if (R.withSpring) return R.withSpring(toValue, motionSpring(motion, how.spring, how.velocity));
|
|
125
|
+
return R.withTiming(toValue, motionTiming(motion, "base", R.Easing));
|
|
126
|
+
}
|
|
127
|
+
return R.withTiming(toValue, motionTiming(motion, how.duration, R.Easing, how.easing));
|
|
128
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* usePressFeedback: how a pressable answers a touch, the same for buttons, rows and cards. It
|
|
3
|
+
* shrinks a little while held (on the motion tokens' `press` duration) and springs back on release
|
|
4
|
+
* (`snappy`), and can play a haptic when the press lands. Under Reduce Motion (or brand motion
|
|
5
|
+
* `none`) it dims instead of moving.
|
|
6
|
+
*
|
|
7
|
+
* const press = usePressFeedback({ haptic: "light" });
|
|
8
|
+
* <Pressable onPress={save} onPressIn={press.onPressIn} onPressOut={press.onPressOut}>
|
|
9
|
+
* <Animated.View style={press.style}>…</Animated.View>
|
|
10
|
+
* </Pressable>
|
|
11
|
+
*
|
|
12
|
+
* The haptic plays on `onPressIn` for `select` (a tick under the finger, as iOS does). Any other
|
|
13
|
+
* kind plays when you call `press.confirm()` from `onPress`, so a press cancelled by scrolling
|
|
14
|
+
* stays quiet.
|
|
15
|
+
*
|
|
16
|
+
* Built on React Native's `Animated`, so it works without Reanimated.
|
|
17
|
+
*
|
|
18
|
+
* @stability Beta
|
|
19
|
+
*/
|
|
20
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
21
|
+
import { Animated } from "react-native";
|
|
22
|
+
import { useMotion, type UseMotionOptions } from "./use-motion";
|
|
23
|
+
import { useHaptics, type HapticKind } from "./use-haptics";
|
|
24
|
+
|
|
25
|
+
type AnimatedValue = InstanceType<typeof Animated.Value>;
|
|
26
|
+
|
|
27
|
+
export interface PressFeedbackOptions {
|
|
28
|
+
/** A haptic when the press counts (`confirm()`), or `select` as a tick on press-in. Default none. */
|
|
29
|
+
haptic?: HapticKind | false;
|
|
30
|
+
/** How far it shrinks while held. Default 0.97. */
|
|
31
|
+
scale?: number;
|
|
32
|
+
/** Under Reduce Motion: how far it dims while held. Default 0.6. */
|
|
33
|
+
dimTo?: number;
|
|
34
|
+
/** No feedback (a disabled button). */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** The brand's motion level, as `useMotion` takes it. */
|
|
37
|
+
level?: UseMotionOptions["level"];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface PressFeedback {
|
|
41
|
+
onPressIn: () => void;
|
|
42
|
+
onPressOut: () => void;
|
|
43
|
+
/** Call from `onPress`: plays the haptic for a press that counted. */
|
|
44
|
+
confirm: () => void;
|
|
45
|
+
/** For an `Animated.View` around the pressable's content. */
|
|
46
|
+
style: { transform?: { scale: AnimatedValue }[]; opacity?: AnimatedValue };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function usePressFeedback({ haptic = false, scale = 0.97, dimTo = 0.6, disabled = false, level }: PressFeedbackOptions = {}): PressFeedback {
|
|
50
|
+
const motion = useMotion(level ? { level } : {});
|
|
51
|
+
const play = useHaptics();
|
|
52
|
+
const value = useRef(new Animated.Value(1)).current;
|
|
53
|
+
const reduced = motion.reduced;
|
|
54
|
+
|
|
55
|
+
const to = useCallback(
|
|
56
|
+
(target: number, held: boolean) => {
|
|
57
|
+
if (held || reduced) {
|
|
58
|
+
Animated.timing(value, { toValue: target, duration: motion.duration.press, useNativeDriver: true }).start();
|
|
59
|
+
} else {
|
|
60
|
+
const s = motion.spring.snappy;
|
|
61
|
+
Animated.spring(value, { toValue: target, damping: s.damping, stiffness: s.stiffness, mass: s.mass, useNativeDriver: true }).start();
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[value, motion, reduced],
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const onPressIn = useCallback(() => {
|
|
68
|
+
if (disabled) return;
|
|
69
|
+
to(reduced ? dimTo : scale, true);
|
|
70
|
+
if (haptic === "select") play("select");
|
|
71
|
+
}, [disabled, reduced, dimTo, scale, to, haptic, play]);
|
|
72
|
+
|
|
73
|
+
// Always let go, even if the pressable was disabled mid-press (a send that started), and start
|
|
74
|
+
// from rest whenever it's disabled, so it never comes back still shrunk.
|
|
75
|
+
const onPressOut = useCallback(() => to(1, false), [to]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (disabled) value.setValue(1);
|
|
78
|
+
}, [disabled, value]);
|
|
79
|
+
|
|
80
|
+
const confirm = useCallback(() => {
|
|
81
|
+
if (!disabled && haptic && haptic !== "select") play(haptic);
|
|
82
|
+
}, [disabled, haptic, play]);
|
|
83
|
+
|
|
84
|
+
const style = useMemo(() => (disabled ? {} : reduced ? { opacity: value } : { transform: [{ scale: value }] }), [disabled, reduced, value]);
|
|
85
|
+
|
|
86
|
+
return { onPressIn, onPressOut, confirm, style };
|
|
87
|
+
}
|