@delacour/react-native-ui 0.3.0-alpha.20261019125933 → 0.4.0-alpha.20261020083124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/src/components/avatar/avatar.tsx +2 -9
- package/src/components/bottom-sheet/bottom-sheet-text-input.tsx +2 -2
- package/src/components/calendar/calendar-picker.tsx +2 -2
- package/src/components/context-menu/context-menu-trigger.tsx +3 -3
- package/src/components/dialog/dialog-content.tsx +1 -1
- package/src/components/drawer/drawer-content.tsx +1 -1
- package/src/components/drawer/use-drawer-pan.ts +2 -2
- package/src/components/input/input-group.tsx +2 -2
- package/src/components/input/input.context.tsx +2 -2
- package/src/components/input/input.tsx +2 -2
- package/src/components/menu/menu.context.tsx +2 -2
- package/src/components/screen/screen-section-list.tsx +4 -1
- package/src/components/screen/screen.types.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delacour/react-native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-alpha.20261020083124",
|
|
4
4
|
"description": "React Native UI components — Uniwind, Reanimated, Gesture Handler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -118,21 +118,21 @@
|
|
|
118
118
|
"gen-exports": "bun scripts/gen-exports.ts"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
|
-
"cn": "^0.
|
|
121
|
+
"cn": "^0.5.0",
|
|
122
122
|
"tailwind-merge": "^3.6.0",
|
|
123
123
|
"tailwind-variants": "^3.3.1"
|
|
124
124
|
},
|
|
125
125
|
"peerDependencies": {
|
|
126
126
|
"@maplibre/maplibre-react-native": "^11.5.0",
|
|
127
127
|
"@central-icons-react-native/round-outlined-radius-1-stroke-1.5": "^1.1",
|
|
128
|
-
"@delacour/react-native-bottom-sheet": "
|
|
128
|
+
"@delacour/react-native-bottom-sheet": "0.2.0-alpha.20261020083124",
|
|
129
129
|
"@delacour/react-native-charts": ">=0.1.0",
|
|
130
130
|
"@legendapp/list": ">=3.3",
|
|
131
131
|
"expo-linear-gradient": ">=15",
|
|
132
132
|
"expo-router": ">=57",
|
|
133
133
|
"react": ">=19",
|
|
134
|
-
"react-native": ">=0.
|
|
135
|
-
"react-native-gesture-handler": ">=
|
|
134
|
+
"react-native": ">=0.88",
|
|
135
|
+
"react-native-gesture-handler": ">=3.3",
|
|
136
136
|
"react-native-keyboard-controller": ">=1.18",
|
|
137
137
|
"react-native-pulsar": "^1.7.0",
|
|
138
138
|
"react-native-reanimated": ">=4",
|
|
@@ -175,8 +175,8 @@
|
|
|
175
175
|
"@delacour/tsconfig": "workspace:*",
|
|
176
176
|
"@types/bun": "^1.3.8",
|
|
177
177
|
"@types/react": "catalog:",
|
|
178
|
-
"expo-router": "~
|
|
178
|
+
"expo-router": "~58.0.24",
|
|
179
179
|
"react-native-teleport": "^1.2.2",
|
|
180
|
-
"typescript": "
|
|
180
|
+
"typescript": "~6.0.3"
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode, useMemo, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
Image,
|
|
4
|
-
type ImageErrorEventData,
|
|
5
|
-
type ImageProps,
|
|
6
|
-
type ImageSourcePropType,
|
|
7
|
-
type NativeSyntheticEvent,
|
|
8
|
-
View,
|
|
9
|
-
} from "react-native";
|
|
2
|
+
import { Image, type ImageErrorEvent, type ImageProps, type ImageSourcePropType, View } from "react-native";
|
|
10
3
|
import { IconPeople } from "../../icons/central";
|
|
11
4
|
import { cn } from "../../lib/cn";
|
|
12
5
|
import { Icon } from "../icon";
|
|
@@ -88,7 +81,7 @@ function AvatarRoot({
|
|
|
88
81
|
const initials = fallback?.trim() || resolveAvatarInitials(name);
|
|
89
82
|
const label = resolveAvatarAccessibilityLabel({ accessibilityLabel, name, fallback });
|
|
90
83
|
|
|
91
|
-
const onImageError = (event:
|
|
84
|
+
const onImageError = (event: ImageErrorEvent) => {
|
|
92
85
|
setFailedKey(sourceKey);
|
|
93
86
|
imageProps?.onError?.(event);
|
|
94
87
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useBottomSheetTextInput } from "@delacour/react-native-bottom-sheet";
|
|
2
2
|
import { type ReactElement, useCallback, useMemo } from "react";
|
|
3
|
-
import type { BlurEvent, FocusEvent,
|
|
3
|
+
import type { BlurEvent, FocusEvent, TextInputInstance } from "react-native";
|
|
4
4
|
import { composeRefs } from "../../lib/compose-refs";
|
|
5
5
|
import { Input, type InputProps } from "../input";
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ export type BottomSheetTextInputProps = InputProps;
|
|
|
22
22
|
*/
|
|
23
23
|
export function BottomSheetTextInput({ ref, onFocus, onBlur, ...props }: BottomSheetTextInputProps): ReactElement {
|
|
24
24
|
const handlers = useBottomSheetTextInput();
|
|
25
|
-
const composed = useMemo(() => composeRefs<
|
|
25
|
+
const composed = useMemo(() => composeRefs<TextInputInstance | null>(ref, handlers.ref), [ref, handlers.ref]);
|
|
26
26
|
|
|
27
27
|
const handleFocus = useCallback(
|
|
28
28
|
(event: FocusEvent) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, useCallback, useMemo, useRef } from "react";
|
|
2
|
-
import { type LayoutChangeEvent, ScrollView, View, type ViewProps } from "react-native";
|
|
2
|
+
import { type LayoutChangeEvent, ScrollView, type ScrollViewInstance, View, type ViewProps } from "react-native";
|
|
3
3
|
import Animated, { FadeIn, FadeOut } from "react-native-reanimated";
|
|
4
4
|
import { useCalmMotion } from "../../hooks/use-calm-motion";
|
|
5
5
|
import { cn } from "../../lib/cn";
|
|
@@ -42,7 +42,7 @@ export function CalendarPicker({ className, ...props }: CalendarPickerProps): Re
|
|
|
42
42
|
return list;
|
|
43
43
|
}, [yearSpan.from, yearSpan.to]);
|
|
44
44
|
|
|
45
|
-
const scroller = useRef<
|
|
45
|
+
const scroller = useRef<ScrollViewInstance>(null);
|
|
46
46
|
const hasScrolled = useRef(false);
|
|
47
47
|
const handleCurrentLayout = useCallback((event: LayoutChangeEvent) => {
|
|
48
48
|
if (hasScrolled.current) return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode, useCallback, useEffect, useMemo, useRef } from "react";
|
|
2
|
-
import { type AccessibilityActionEvent, View, type ViewProps } from "react-native";
|
|
2
|
+
import { type AccessibilityActionEvent, View, type ViewInstance, type ViewProps } from "react-native";
|
|
3
3
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
4
4
|
import { scheduleOnRN } from "react-native-worklets";
|
|
5
5
|
import { type MenuMeasurable, useMenuPart } from "../menu/menu.context";
|
|
@@ -75,9 +75,9 @@ export function ContextMenuTrigger({
|
|
|
75
75
|
registerContent(children);
|
|
76
76
|
}, [children, registerContent]);
|
|
77
77
|
|
|
78
|
-
const nodeRef = useRef<
|
|
78
|
+
const nodeRef = useRef<ViewInstance | null>(null);
|
|
79
79
|
const setNode = useCallback(
|
|
80
|
-
(node:
|
|
80
|
+
(node: ViewInstance | null) => {
|
|
81
81
|
nodeRef.current = node;
|
|
82
82
|
triggerRef.current = node as MenuMeasurable | null;
|
|
83
83
|
},
|
|
@@ -34,7 +34,7 @@ export type DialogContentProps = ViewProps & {
|
|
|
34
34
|
function focus(target: DialogFocusTarget | null): void {
|
|
35
35
|
if (target === null) return;
|
|
36
36
|
const handle = findNodeHandle(target as Parameters<typeof findNodeHandle>[0]);
|
|
37
|
-
if (handle !==
|
|
37
|
+
if (handle !== undefined) AccessibilityInfo.setAccessibilityFocus(handle);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -41,7 +41,7 @@ export type DrawerContentProps = ViewProps & {
|
|
|
41
41
|
function focus(target: DrawerFocusTarget | null): void {
|
|
42
42
|
if (target === null) return;
|
|
43
43
|
const handle = findNodeHandle(target as Parameters<typeof findNodeHandle>[0]);
|
|
44
|
-
if (handle !==
|
|
44
|
+
if (handle !== undefined) AccessibilityInfo.setAccessibilityFocus(handle);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
import { Gesture, type
|
|
2
|
+
import { Gesture, type LegacyPanGesture } from "react-native-gesture-handler";
|
|
3
3
|
import { cancelAnimation, Easing, type SharedValue, useSharedValue, withTiming } from "react-native-reanimated";
|
|
4
4
|
import { scheduleOnRN } from "react-native-worklets";
|
|
5
5
|
import { OVERLAY_MOTION } from "../overlay/overlay.variants";
|
|
@@ -48,7 +48,7 @@ const PAN_RANGE: [number, number] = [-DRAWER_PAN_ACTIVE_OFFSET, DRAWER_PAN_ACTIV
|
|
|
48
48
|
* Per-gesture memory lives in shared values: each worklet gets its own copy of
|
|
49
49
|
* a captured `let`.
|
|
50
50
|
*/
|
|
51
|
-
export function useDrawerPan({ edge, extent, isEnabled, drag, onDismiss }: UseDrawerPanOptions):
|
|
51
|
+
export function useDrawerPan({ edge, extent, isEnabled, drag, onDismiss }: UseDrawerPanOptions): LegacyPanGesture {
|
|
52
52
|
const isDragging = useSharedValue(false);
|
|
53
53
|
const isPastThreshold = useSharedValue(false);
|
|
54
54
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode, useCallback, useMemo, useRef, useState } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextInputInstance } from "react-native";
|
|
3
3
|
import { useButtonGroupItemContext } from "../button/button.context";
|
|
4
4
|
import { resolveButtonSizeStep } from "../button/button.variants";
|
|
5
5
|
import { useFieldContext } from "../field/field.context";
|
|
@@ -36,7 +36,7 @@ function InputGroupRoot({
|
|
|
36
36
|
className,
|
|
37
37
|
children,
|
|
38
38
|
}: InputGroupProps): ReactElement {
|
|
39
|
-
const fieldRef = useRef<
|
|
39
|
+
const fieldRef = useRef<TextInputInstance | null>(null);
|
|
40
40
|
const field = useFieldContext();
|
|
41
41
|
const [isFocused, setFocused] = useState(false);
|
|
42
42
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, type ReactElement, type ReactNode, type RefObject, use } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextInputInstance } from "react-native";
|
|
3
3
|
import type { InputSize, InputVariant } from "./input.variants";
|
|
4
4
|
|
|
5
5
|
export type InputGroupContextValue = {
|
|
@@ -22,7 +22,7 @@ export type InputGroupContextValue = {
|
|
|
22
22
|
* the middle of the box, and a tap on the padding either side would otherwise
|
|
23
23
|
* do nothing.
|
|
24
24
|
*/
|
|
25
|
-
fieldRef: RefObject<
|
|
25
|
+
fieldRef: RefObject<TextInputInstance | null>;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const InputGroupContext = createContext<InputGroupContextValue | null>(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type Ref, useCallback, useState } from "react";
|
|
2
|
-
import { TextInput, type TextInputProps } from "react-native";
|
|
2
|
+
import { TextInput, type TextInputInstance, type TextInputProps } from "react-native";
|
|
3
3
|
import { composeRefs } from "../../lib/compose-refs";
|
|
4
4
|
import { useButtonGroupItemContext } from "../button/button.context";
|
|
5
5
|
import { resolveButtonSizeStep } from "../button/button.variants";
|
|
@@ -49,7 +49,7 @@ export type InputProps = Omit<TextInputProps, "placeholderTextColorClassName"> &
|
|
|
49
49
|
* primary token, or the destructive one while the field is invalid.
|
|
50
50
|
*/
|
|
51
51
|
selectionColorClassName?: string;
|
|
52
|
-
ref?: Ref<
|
|
52
|
+
ref?: Ref<TextInputInstance>;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
function InputRoot({
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
useRef,
|
|
11
11
|
useState,
|
|
12
12
|
} from "react";
|
|
13
|
-
import type {
|
|
13
|
+
import type { ViewInstance } from "react-native";
|
|
14
14
|
import type { SharedValue } from "react-native-reanimated";
|
|
15
15
|
import { useControllableState } from "../../hooks/use-controllable-state";
|
|
16
16
|
import type { HapticFeedback } from "../pressable/pressable";
|
|
17
17
|
import type { MenuAnchorRect } from "./menu.variants";
|
|
18
18
|
|
|
19
19
|
/** Anything `measureInWindow` can be called on — a host view, or an animated one. */
|
|
20
|
-
export type MenuMeasurable = Pick<
|
|
20
|
+
export type MenuMeasurable = Pick<ViewInstance, "measureInWindow">;
|
|
21
21
|
|
|
22
22
|
export type MenuContextValue = {
|
|
23
23
|
isOpen: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ForwardedRef, forwardRef, type ReactElement, type RefAttributes, useMemo } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SectionList, type SectionListProps, View } from "react-native";
|
|
3
3
|
import Animated from "react-native-reanimated";
|
|
4
4
|
import { cn } from "../../lib/cn";
|
|
5
5
|
import type { ScreenScrollableProps } from "./screen.types";
|
|
@@ -7,6 +7,9 @@ import { screenVariants } from "./screen.variants";
|
|
|
7
7
|
import { resolveListComponent } from "./screen-list-component";
|
|
8
8
|
import { useScreenScrollInsets } from "./use-screen-scroll-insets";
|
|
9
9
|
|
|
10
|
+
/** React Native's default `SectionT`, which its strict API no longer exports. */
|
|
11
|
+
type DefaultSectionT = Record<string, unknown>;
|
|
12
|
+
|
|
10
13
|
// `Animated.createAnimatedComponent` erases the generic parameters; the recast
|
|
11
14
|
// puts them back so `sections` and `renderItem` still check against each other.
|
|
12
15
|
const AnimatedSectionList = Animated.createAnimatedComponent(SectionList) as unknown as typeof SectionList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ScrollViewInstance, ViewProps } from "react-native";
|
|
3
3
|
import type { ScreenEdge, ScreenPlacement } from "./screen.variants";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -19,7 +19,7 @@ import type { ScreenEdge, ScreenPlacement } from "./screen.variants";
|
|
|
19
19
|
* `never` — which still compiles everywhere, silently accepts any ref, and
|
|
20
20
|
* gives a caller a `.current` it can do nothing with.
|
|
21
21
|
*/
|
|
22
|
-
export type ScreenScrollViewRef =
|
|
22
|
+
export type ScreenScrollViewRef = ScrollViewInstance;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The shape of a container that can inset itself against the safe area.
|