@gryt/ui-native 0.3.1 → 0.5.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 +9 -1
- package/dist/components/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +7 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +47 -15
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +10 -1
- package/dist/components/Drawer/Drawer.d.ts +0 -7
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.js +229 -30
- package/dist/components/Progress/Progress.d.ts +11 -17
- package/dist/components/Progress/Progress.d.ts.map +1 -1
- package/dist/components/Progress/Progress.js +66 -22
- package/dist/components/Radio/Radio.d.ts +9 -1
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Radio/Radio.js +38 -14
- package/dist/components/ScrollArea/ScrollArea.d.ts +6 -4
- package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +19 -4
- package/dist/components/Sheet/Sheet.d.ts +99 -0
- package/dist/components/Sheet/Sheet.d.ts.map +1 -0
- package/dist/components/Sheet/Sheet.js +201 -0
- package/dist/components/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Slider/Slider.js +33 -0
- package/dist/components/Switch/Switch.d.ts +4 -1
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +21 -17
- package/dist/components/Tabs/Tabs.d.ts +38 -13
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +157 -42
- package/dist/components/Toggle/Toggle.d.ts +0 -1
- package/dist/components/Toggle/Toggle.d.ts.map +1 -1
- package/dist/components/Toggle/Toggle.js +15 -1
- package/dist/components/internal/ControlRow.d.ts +54 -0
- package/dist/components/internal/ControlRow.d.ts.map +1 -0
- package/dist/components/internal/ControlRow.js +59 -0
- package/dist/components/internal/dragLock.d.ts +43 -0
- package/dist/components/internal/dragLock.d.ts.map +1 -0
- package/dist/components/internal/dragLock.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/motion/motion.d.ts +13 -3
- package/dist/motion/motion.d.ts.map +1 -1
- package/dist/motion/motion.js +6 -6
- package/package.json +11 -5
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import Animated from "react-native-reanimated";
|
|
4
|
+
import { usePressScale } from "../../motion/index.js";
|
|
5
|
+
import { useTheme } from "../../theme/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* A control and its label, where tapping either one works.
|
|
8
|
+
*
|
|
9
|
+
* The web gets this for free: the sign-in screen wraps `<Checkbox>` in a
|
|
10
|
+
* `<label>` and the browser forwards the click. React Native has no `<label>`
|
|
11
|
+
* and no `htmlFor`, so the association has to be structural — the label and the
|
|
12
|
+
* control are inside one Pressable, and that Pressable is the target.
|
|
13
|
+
*
|
|
14
|
+
* This is a parity *match* reached through a different API, which is why the
|
|
15
|
+
* exceptions table lists it as an API difference rather than a behaviour one.
|
|
16
|
+
* Tapping a label toggles the control on both platforms; only the way you say
|
|
17
|
+
* so differs.
|
|
18
|
+
*
|
|
19
|
+
* Without a label it renders the control alone, so the bare form still works
|
|
20
|
+
* and nothing existing has to change.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* How far past its own edge a control still counts as pressed.
|
|
24
|
+
*
|
|
25
|
+
* There is no web equivalent and nothing to be 1:1 with — a pointer is exact
|
|
26
|
+
* and a fingertip is about 9mm across. 20×20 is well under the 44pt minimum
|
|
27
|
+
* both Apple and WCAG ask for, and radios are usually stacked, so a near miss
|
|
28
|
+
* lands on the neighbour rather than on nothing.
|
|
29
|
+
*
|
|
30
|
+
* 12 on each side takes a 20pt box to 44pt without moving a single pixel of
|
|
31
|
+
* what is drawn. It is deliberately not padding: padding would change the
|
|
32
|
+
* layout and the spacing between a control and its label.
|
|
33
|
+
*/
|
|
34
|
+
export const CONTROL_HIT_SLOP = { top: 12, bottom: 12, left: 12, right: 12 };
|
|
35
|
+
export function ControlRow({ label, children, onPress, disabled, pressScale, accessibilityRole, accessibilityState, accessibilityLabel, style, }) {
|
|
36
|
+
const theme = useTheme();
|
|
37
|
+
const press = usePressScale(pressScale, disabled);
|
|
38
|
+
// Only the control scales, not the label. The web scales the control element
|
|
39
|
+
// and the text beside it is a sibling, so a whole row springing would be a
|
|
40
|
+
// difference rather than a match — and a line of text jumping under a
|
|
41
|
+
// fingertip reads as a glitch rather than as feedback.
|
|
42
|
+
const control = _jsx(Animated.View, { style: press.style, children: children });
|
|
43
|
+
// A label needs a string for screen readers, and `label` may be a node.
|
|
44
|
+
// Falling back to it only when it is a string is better than stringifying an
|
|
45
|
+
// element into "[object Object]".
|
|
46
|
+
const spokenLabel = accessibilityLabel ?? (typeof label === "string" ? label : undefined);
|
|
47
|
+
return (_jsxs(Pressable, { accessibilityRole: accessibilityRole, accessibilityState: accessibilityState, accessibilityLabel: spokenLabel, disabled: disabled, onPress: onPress, onPressIn: press.onPressIn, onPressOut: press.onPressOut, hitSlop: CONTROL_HIT_SLOP, style: [
|
|
48
|
+
label != null
|
|
49
|
+
? { flexDirection: "row", alignItems: "center", gap: theme.space(2) }
|
|
50
|
+
: { alignSelf: "flex-start" },
|
|
51
|
+
style,
|
|
52
|
+
], children: [control, label != null ? (typeof label === "string" ? (_jsx(Text, { style: {
|
|
53
|
+
color: disabled ? theme.color.muted : theme.color.text,
|
|
54
|
+
fontSize: 14,
|
|
55
|
+
// The row centres on the control, so the text has to sit on the
|
|
56
|
+
// same optical line rather than on its own baseline.
|
|
57
|
+
lineHeight: 20,
|
|
58
|
+
}, children: label })) : (_jsx(View, { children: label }))) : null] }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A control holding a scrolling ancestor still while it is being dragged.
|
|
3
|
+
*
|
|
4
|
+
* This exists because of one bug, and the obvious fixes all fail in ways that
|
|
5
|
+
* look like they worked, so it is worth writing down.
|
|
6
|
+
*
|
|
7
|
+
* Dragging a `Slider` inside a scrolling screen scrolled the screen. The first
|
|
8
|
+
* fix — `onPanResponderTerminationRequest: () => false` — was necessary and not
|
|
9
|
+
* sufficient: it stops the ScrollView taking the responder away, so the thumb
|
|
10
|
+
* follows your finger now, and the page still scrolls underneath. On iOS the
|
|
11
|
+
* scroll is driven by a native `UIPanGestureRecognizer` that is not part of
|
|
12
|
+
* React Native's JS responder system, so refusing to hand over the responder
|
|
13
|
+
* answers a question the native recogniser never asked.
|
|
14
|
+
* `onShouldBlockNativeResponder` is the knob for that, and it is Android-only.
|
|
15
|
+
*
|
|
16
|
+
* What works is `scrollEnabled` — and the control cannot reach the scroll view
|
|
17
|
+
* to set it, since they are separated by however much app markup. So the scroll
|
|
18
|
+
* view publishes a lock, the control claims it, and neither has to know where
|
|
19
|
+
* the other is.
|
|
20
|
+
*
|
|
21
|
+
* `react-native-gesture-handler` solves this properly, by negotiating with the
|
|
22
|
+
* native recogniser rather than switching it off. That is the better fix and it
|
|
23
|
+
* is blocked on GRYT-393: this package ships prebuilt JavaScript, Reanimated's
|
|
24
|
+
* babel plugin does not run over `node_modules`, and gesture callbacks are
|
|
25
|
+
* therefore never worklets. Measured on a device, not assumed. When that is
|
|
26
|
+
* solved, this should probably go.
|
|
27
|
+
*/
|
|
28
|
+
export interface DragLock {
|
|
29
|
+
locked: boolean;
|
|
30
|
+
lock: () => void;
|
|
31
|
+
unlock: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const DragLockContext: import("react").Context<DragLock | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Claimed by a control for the duration of a drag.
|
|
36
|
+
*
|
|
37
|
+
* No-ops outside a `ScrollArea`, which is the normal case for a control that is
|
|
38
|
+
* not in a scrolling screen. A control must not require the provider: a slider
|
|
39
|
+
* in a fixed panel has nothing to lock, and throwing there would be inventing a
|
|
40
|
+
* dependency on a component it does not need.
|
|
41
|
+
*/
|
|
42
|
+
export declare function useDragLock(): DragLock;
|
|
43
|
+
//# sourceMappingURL=dragLock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dragLock.d.ts","sourceRoot":"","sources":["../../../src/components/internal/dragLock.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,eAAe,0CAAuC,CAAC;AAQpE;;;;;;;GAOG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CAEtC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
export const DragLockContext = createContext(null);
|
|
3
|
+
const NO_LOCK = {
|
|
4
|
+
locked: false,
|
|
5
|
+
lock: () => { },
|
|
6
|
+
unlock: () => { },
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Claimed by a control for the duration of a drag.
|
|
10
|
+
*
|
|
11
|
+
* No-ops outside a `ScrollArea`, which is the normal case for a control that is
|
|
12
|
+
* not in a scrolling screen. A control must not require the provider: a slider
|
|
13
|
+
* in a fixed panel has nothing to lock, and throwing there would be inventing a
|
|
14
|
+
* dependency on a component it does not need.
|
|
15
|
+
*/
|
|
16
|
+
export function useDragLock() {
|
|
17
|
+
return useContext(DragLockContext) ?? NO_LOCK;
|
|
18
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export { Drawer, type DrawerPopupProps, type DrawerRootProps, type DrawerSide, }
|
|
|
30
30
|
export { NumberField, type NumberFieldProps } from "./components/NumberField/NumberField.js";
|
|
31
31
|
export { OtpField, type OtpFieldProps } from "./components/OtpField/OtpField.js";
|
|
32
32
|
export { ScrollArea, type ScrollAreaProps } from "./components/ScrollArea/ScrollArea.js";
|
|
33
|
+
export { Sheet, type SheetCloseProps, type SheetContentProps, type SheetProps, SheetProvider, type SheetProviderProps, type SheetTitleProps, type SheetTriggerProps, } from "./components/Sheet/Sheet.js";
|
|
34
|
+
export { useDragLock, type DragLock } from "./components/internal/dragLock.js";
|
|
33
35
|
export { ToastProvider, useToast, type ToastOptions, type ToastSeverity, } from "./components/Toast/Toast.js";
|
|
34
36
|
export { Toolbar, ToolbarSeparator, type ToolbarProps, type ToolbarSeparatorProps, } from "./components/Toolbar/Toolbar.js";
|
|
35
37
|
export { AnchoredPopup, type AnchoredPopupProps } from "./overlay/AnchoredPopup.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,IAAI,EACT,QAAQ,EACR,KAAK,aAAa,GACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,WAAW,EACX,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK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E,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EACL,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EACL,aAAa,EACb,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,qBAAqB,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EACL,UAAU,EACV,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,IAAI,GACV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,SAAS,EACT,UAAU,EACV,eAAe,EACf,IAAI,EACJ,OAAO,EACP,MAAM,EACN,aAAa,EACb,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,8 @@ export { Drawer, } from "./components/Drawer/Drawer.js";
|
|
|
30
30
|
export { NumberField } from "./components/NumberField/NumberField.js";
|
|
31
31
|
export { OtpField } from "./components/OtpField/OtpField.js";
|
|
32
32
|
export { ScrollArea } from "./components/ScrollArea/ScrollArea.js";
|
|
33
|
+
export { Sheet, SheetProvider, } from "./components/Sheet/Sheet.js";
|
|
34
|
+
export { useDragLock } from "./components/internal/dragLock.js";
|
|
33
35
|
export { ToastProvider, useToast, } from "./components/Toast/Toast.js";
|
|
34
36
|
export { Toolbar, ToolbarSeparator, } from "./components/Toolbar/Toolbar.js";
|
|
35
37
|
export { AnchoredPopup } from "./overlay/AnchoredPopup.js";
|
package/dist/motion/motion.d.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { type WithTimingConfig } from "react-native-reanimated";
|
|
2
|
+
/**
|
|
3
|
+
* Run when the animation settles, with whether it reached the end.
|
|
4
|
+
*
|
|
5
|
+
* A worklet, like everything Reanimated calls back into — hop with `runOnJS`
|
|
6
|
+
* to touch React state. Forwarded by every helper below because the alternative
|
|
7
|
+
* is a caller reaching past them to `withTiming`, which is how the sampled
|
|
8
|
+
* curve stops being the thing that runs.
|
|
9
|
+
*/
|
|
10
|
+
type Settled = (finished?: boolean) => void;
|
|
2
11
|
import { easeSpring, easeSpringTight } from "./easing.js";
|
|
3
12
|
export { easeSpring, easeSpringTight };
|
|
4
13
|
export declare const durations: {
|
|
5
14
|
readonly spring: 500;
|
|
6
15
|
readonly springSoft: 700;
|
|
7
16
|
readonly fast: 150;
|
|
17
|
+
readonly sweep: 1400;
|
|
8
18
|
};
|
|
9
19
|
/** `withTiming` on the overshooting spring, at the standard duration. */
|
|
10
|
-
export declare function springy(to: number, config?: WithTimingConfig): number;
|
|
20
|
+
export declare function springy(to: number, config?: WithTimingConfig, settled?: Settled): number;
|
|
11
21
|
/** `withTiming` on the critically damped spring — travel that must stay in bounds. */
|
|
12
|
-
export declare function travel(to: number, config?: WithTimingConfig): number;
|
|
22
|
+
export declare function travel(to: number, config?: WithTimingConfig, settled?: Settled): number;
|
|
13
23
|
/** A colour or opacity change, which should not feel sprung. */
|
|
14
|
-
export declare function fade(to: number, config?: WithTimingConfig): number;
|
|
24
|
+
export declare function fade(to: number, config?: WithTimingConfig, settled?: Settled): number;
|
|
15
25
|
//# sourceMappingURL=motion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../src/motion/motion.ts"],"names":[],"mappings":"AAYA,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;AAEvC,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../../src/motion/motion.ts"],"names":[],"mappings":"AAYA,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEpF;;;;;;;GAOG;AACH,KAAK,OAAO,GAAG,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;AAEvC,eAAO,MAAM,SAAS;;;;;CAAgB,CAAC;AAEvC,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,UAO/E;AAED,sFAAsF;AACtF,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,UAO9E;AAED,gEAAgE;AAChE,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,UAO5E"}
|
package/dist/motion/motion.js
CHANGED
|
@@ -16,17 +16,17 @@ import { easeSpring, easeSpringTight } from "./easing.js";
|
|
|
16
16
|
export { easeSpring, easeSpringTight };
|
|
17
17
|
export const durations = grytDurations;
|
|
18
18
|
/** `withTiming` on the overshooting spring, at the standard duration. */
|
|
19
|
-
export function springy(to, config) {
|
|
19
|
+
export function springy(to, config, settled) {
|
|
20
20
|
"worklet";
|
|
21
|
-
return withTiming(to, { duration: durations.spring, easing: easeSpring, ...config });
|
|
21
|
+
return withTiming(to, { duration: durations.spring, easing: easeSpring, ...config }, settled);
|
|
22
22
|
}
|
|
23
23
|
/** `withTiming` on the critically damped spring — travel that must stay in bounds. */
|
|
24
|
-
export function travel(to, config) {
|
|
24
|
+
export function travel(to, config, settled) {
|
|
25
25
|
"worklet";
|
|
26
|
-
return withTiming(to, { duration: durations.spring, easing: easeSpringTight, ...config });
|
|
26
|
+
return withTiming(to, { duration: durations.spring, easing: easeSpringTight, ...config }, settled);
|
|
27
27
|
}
|
|
28
28
|
/** A colour or opacity change, which should not feel sprung. */
|
|
29
|
-
export function fade(to, config) {
|
|
29
|
+
export function fade(to, config, settled) {
|
|
30
30
|
"worklet";
|
|
31
|
-
return withTiming(to, { duration: durations.fast, easing: Easing.out(Easing.quad), ...config });
|
|
31
|
+
return withTiming(to, { duration: durations.fast, easing: Easing.out(Easing.quad), ...config }, settled);
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gryt/ui-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Gryt's design system on React Native. Same tokens as @gryt/ui, a different renderer.",
|
|
@@ -33,17 +33,23 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=18.3.0 || >=19.0.0",
|
|
35
35
|
"react-native": ">=0.76.0",
|
|
36
|
-
"react-native-reanimated": ">=4.0.0"
|
|
36
|
+
"react-native-reanimated": ">=4.0.0",
|
|
37
|
+
"@gorhom/bottom-sheet": ">=5.2.0",
|
|
38
|
+
"react-native-gesture-handler": ">=2.16.1",
|
|
39
|
+
"react-native-safe-area-context": ">=5.0.0"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"@gryt/theme": "^0.
|
|
42
|
+
"@gryt/theme": "^0.4.0"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
45
|
+
"@gorhom/bottom-sheet": "^5.2.14",
|
|
42
46
|
"@types/react": "^19.0.0",
|
|
43
47
|
"react": "^19.0.0",
|
|
44
48
|
"react-native": "^0.76.0",
|
|
45
|
-
"
|
|
46
|
-
"react-native-reanimated": "^4.5.1"
|
|
49
|
+
"react-native-gesture-handler": "^2.32.0",
|
|
50
|
+
"react-native-reanimated": "^4.5.1",
|
|
51
|
+
"react-native-safe-area-context": "^5.7.0",
|
|
52
|
+
"vitest": "^3.0.0"
|
|
47
53
|
},
|
|
48
54
|
"peerDependenciesMeta": {}
|
|
49
55
|
}
|