@delacour/react-native-bottom-sheet 0.1.0 → 0.2.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/README.md CHANGED
@@ -35,8 +35,8 @@ installing.
35
35
  | Peer | Range | Why |
36
36
  | --- | --- | --- |
37
37
  | `react` | `>=19` | Ref-as-prop |
38
- | `react-native` | `>=0.81` | Fabric `getBoundingClientRect` |
39
- | `react-native-gesture-handler` | `>=2.28` | The handle and content pans |
38
+ | `react-native` | `>=0.88` | Fabric `getBoundingClientRect` |
39
+ | `react-native-gesture-handler` | `>=3.3` | The handle and content pans |
40
40
  | `react-native-reanimated` | `>=4` | Every animated value |
41
41
  | `react-native-worklets` | `>=0.5` | `scheduleOnRN` from the UI thread |
42
42
  | `react-native-keyboard-controller` | `>=1.18` | The only keyboard source — frame-accurate height and progress |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delacour/react-native-bottom-sheet",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-alpha.20261020083124",
4
4
  "description": "Headless bottom sheet engine for React Native — no tokens, no className",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": ">=19",
41
- "react-native": ">=0.81",
42
- "react-native-gesture-handler": ">=2.28",
41
+ "react-native": ">=0.88",
42
+ "react-native-gesture-handler": ">=3.3",
43
43
  "react-native-keyboard-controller": ">=1.18",
44
44
  "react-native-reanimated": ">=4",
45
45
  "react-native-safe-area-context": ">=5",
@@ -52,6 +52,6 @@
52
52
  "@types/bun": "^1.3.8",
53
53
  "@types/react": "catalog:",
54
54
  "react-native-teleport": "^1.2.2",
55
- "typescript": "^5.9.3"
55
+ "typescript": "~6.0.3"
56
56
  }
57
57
  }
@@ -1,5 +1,5 @@
1
1
  import { type ReactElement, useCallback, useMemo } from "react";
2
- import { type BlurEvent, type FocusEvent, TextInput } from "react-native";
2
+ import { type BlurEvent, type FocusEvent, TextInput, type TextInputInstance } from "react-native";
3
3
  import { useBottomSheetTextInput } from "../keyboard/use-bottom-sheet-text-input";
4
4
  import { composeRefs } from "../lib/compose-refs";
5
5
  import type { BottomSheetTextInputProps } from "./bottom-sheet.types";
@@ -14,7 +14,7 @@ import type { BottomSheetTextInputProps } from "./bottom-sheet.types";
14
14
  */
15
15
  export function BottomSheetTextInput({ ref, onFocus, onBlur, ...props }: BottomSheetTextInputProps): ReactElement {
16
16
  const handlers = useBottomSheetTextInput();
17
- const composed = useMemo(() => composeRefs<TextInput | null>(ref, handlers.ref), [ref, handlers.ref]);
17
+ const composed = useMemo(() => composeRefs<TextInputInstance | null>(ref, handlers.ref), [ref, handlers.ref]);
18
18
 
19
19
  const handleFocus = useCallback(
20
20
  (event: FocusEvent) => {
@@ -1,5 +1,12 @@
1
1
  import type { ReactNode, Ref } from "react";
2
- import type { PressableProps, TextInput, TextInputProps, TextProps, View, ViewProps } from "react-native";
2
+ import type {
3
+ PressableProps,
4
+ TextInputInstance,
5
+ TextInputProps,
6
+ TextProps,
7
+ ViewInstance,
8
+ ViewProps,
9
+ } from "react-native";
3
10
  import type { SharedValue } from "react-native-reanimated";
4
11
  import type { SheetAnimation } from "../animation/animation.types";
5
12
  import type {
@@ -121,13 +128,13 @@ export type BottomSheetTriggerProps = Omit<PressableProps, "children"> & {
121
128
  children?: ReactNode;
122
129
  /** Hand `onPress` to the child rather than rendering a Pressable around it. */
123
130
  asChild?: boolean;
124
- ref?: Ref<View>;
131
+ ref?: Ref<ViewInstance>;
125
132
  };
126
133
 
127
134
  export type BottomSheetPortalProps = {
128
135
  children?: ReactNode;
129
136
  style?: ViewProps["style"];
130
- ref?: Ref<View>;
137
+ ref?: Ref<ViewInstance>;
131
138
  /**
132
139
  * Render where written — an absolute fill of the nearest positioned
133
140
  * ancestor — rather than teleporting to a host. A persistent drawer, a map's
@@ -145,7 +152,7 @@ export type BottomSheetPortalProps = {
145
152
 
146
153
  export type BottomSheetOverlayProps = Omit<ViewProps, "style"> & {
147
154
  style?: ViewProps["style"];
148
- ref?: Ref<View>;
155
+ ref?: Ref<ViewInstance>;
149
156
  /** The index the scrim is fully in by. @default 0 */
150
157
  appearsOnIndex?: number;
151
158
  /** The index the scrim is gone by. @default -1 */
@@ -162,44 +169,44 @@ export type BottomSheetOverlayProps = Omit<ViewProps, "style"> & {
162
169
  };
163
170
 
164
171
  export type BottomSheetContainerProps = ViewProps & {
165
- ref?: Ref<View>;
172
+ ref?: Ref<ViewInstance>;
166
173
  };
167
174
 
168
175
  export type BottomSheetBackgroundProps = ViewProps & {
169
- ref?: Ref<View>;
176
+ ref?: Ref<ViewInstance>;
170
177
  };
171
178
 
172
179
  export type BottomSheetHandleProps = ViewProps & {
173
- ref?: Ref<View>;
180
+ ref?: Ref<ViewInstance>;
174
181
  /** Overrides the root's `enableHandlePanningGesture` for this handle. */
175
182
  enablePanningGesture?: boolean;
176
183
  };
177
184
 
178
185
  export type BottomSheetContentProps = ViewProps & {
179
- ref?: Ref<View>;
186
+ ref?: Ref<ViewInstance>;
180
187
  /** Extra space between the content and a sticky footer. @default 0 */
181
188
  footerGap?: number;
182
189
  };
183
190
 
184
191
  export type BottomSheetFooterProps = ViewProps & {
185
- ref?: Ref<View>;
192
+ ref?: Ref<ViewInstance>;
186
193
  /**
187
194
  * Stay put over the body and ride the keyboard by transform. Off, it is a
188
195
  * plain `View` for a footer that scrolls with the content. @default true
189
196
  */
190
197
  sticky?: boolean;
191
- /** Padding on the measured inner view, so it counts in the sheet's height. */
198
+ /** Padding on the footer's view, merged with `style`. It counts in the sheet's height. */
192
199
  padding?: number;
193
200
  };
194
201
 
195
202
  export type BottomSheetTextInputProps = TextInputProps & {
196
- ref?: Ref<TextInput>;
203
+ ref?: Ref<TextInputInstance>;
197
204
  };
198
205
 
199
206
  export type BottomSheetCloseProps = Omit<PressableProps, "children"> & {
200
207
  children?: ReactNode;
201
208
  asChild?: boolean;
202
- ref?: Ref<View>;
209
+ ref?: Ref<ViewInstance>;
203
210
  };
204
211
 
205
212
  export type BottomSheetTitleProps = TextProps & {
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from "react";
2
- import { Gesture, type GestureType, type PanGesture } from "react-native-gesture-handler";
2
+ import { Gesture, type GestureType, type LegacyPanGesture } from "react-native-gesture-handler";
3
3
  import { KeyboardController } from "react-native-keyboard-controller";
4
4
  import { cancelAnimation, useSharedValue } from "react-native-reanimated";
5
5
  import { scheduleOnRN } from "react-native-worklets";
@@ -215,7 +215,7 @@ export function useSheetPan(
215
215
  settle(target, closed, velocity);
216
216
  };
217
217
 
218
- const attach = (pan: PanGesture, source: GestureSource, enabled: boolean): GestureType =>
218
+ const attach = (pan: LegacyPanGesture, source: GestureSource, enabled: boolean): GestureType =>
219
219
  pan
220
220
  .enabled(enabled)
221
221
  .shouldCancelWhenOutside(false)
@@ -1,5 +1,5 @@
1
1
  import { type RefCallback, useCallback, useRef } from "react";
2
- import { findNodeHandle, TextInput } from "react-native";
2
+ import { findNodeHandle, TextInput, type TextInputInstance } from "react-native";
3
3
  import { useOptionalBottomSheetInternal } from "../components/bottom-sheet.context";
4
4
 
5
5
  /**
@@ -10,11 +10,11 @@ import { useOptionalBottomSheetInternal } from "../components/bottom-sheet.conte
10
10
  * accepts it. One cast, in one place.
11
11
  */
12
12
  function nodeHandleOf(instance: unknown): number | null {
13
- return findNodeHandle(instance as Parameters<typeof findNodeHandle>[0]);
13
+ return findNodeHandle(instance as Parameters<typeof findNodeHandle>[0]) ?? null;
14
14
  }
15
15
 
16
16
  export type BottomSheetTextInputHandlers = {
17
- ref: RefCallback<TextInput | null>;
17
+ ref: RefCallback<TextInputInstance | null>;
18
18
  onFocus: () => void;
19
19
  onBlur: () => void;
20
20
  };
@@ -45,7 +45,7 @@ export function useBottomSheetTextInput(): BottomSheetTextInputHandlers {
45
45
  const registry = useOptionalBottomSheetInternal()?.keyboard ?? null;
46
46
  const registered = useRef<number | null>(null);
47
47
 
48
- const ref = useCallback<RefCallback<TextInput | null>>(
48
+ const ref = useCallback<RefCallback<TextInputInstance | null>>(
49
49
  (instance) => {
50
50
  if (registry === null) return;
51
51
  const previous = registered.current;
@@ -1,10 +1,10 @@
1
1
  import { type RefObject, useCallback, useEffect, useRef } from "react";
2
- import { Dimensions, type LayoutChangeEvent, type View } from "react-native";
2
+ import { Dimensions, type LayoutChangeEvent, type ViewInstance } from "react-native";
3
3
  import { acceptContainerLayout, UNMEASURED } from "../core";
4
4
  import type { SheetSharedState } from "../state/state.types";
5
5
 
6
6
  export type ContainerLayout = {
7
- ref: RefObject<View | null>;
7
+ ref: RefObject<ViewInstance | null>;
8
8
  onLayout: (event: LayoutChangeEvent) => void;
9
9
  };
10
10
 
@@ -25,7 +25,7 @@ export type ContainerLayout = {
25
25
  * `useMeasureHeight` does.
26
26
  */
27
27
  export function useContainerLayout(state: SheetSharedState): ContainerLayout {
28
- const ref = useRef<View | null>(null);
28
+ const ref = useRef<ViewInstance | null>(null);
29
29
  const { containerHeight, containerWidth, containerBottomOffset, keyboardHeight, keyboardProgress } = state;
30
30
 
31
31
  useEffect(
@@ -1,5 +1,12 @@
1
1
  import type { Component, ComponentType, DependencyList, EffectCallback, ReactElement, Ref, RefAttributes } from "react";
2
- import type { FlatList, FlatListProps, ScrollView, ScrollViewProps, SectionList, SectionListProps } from "react-native";
2
+ import type {
3
+ FlatList,
4
+ FlatListProps,
5
+ ScrollViewInstance,
6
+ ScrollViewProps,
7
+ SectionList,
8
+ SectionListProps,
9
+ } from "react-native";
3
10
  import type { AnimatedProps } from "react-native-reanimated";
4
11
 
5
12
  /**
@@ -46,7 +53,7 @@ export type ScrollableInnerComponent = ComponentType<ScrollableInnerProps>;
46
53
 
47
54
  export type BottomSheetScrollViewProps = ScrollViewProps &
48
55
  BottomSheetScrollableProps & {
49
- ref?: Ref<ScrollView>;
56
+ ref?: Ref<ScrollViewInstance>;
50
57
  };
51
58
 
52
59
  export type BottomSheetFlatListProps<ItemT> = Omit<FlatListProps<ItemT>, "children"> & BottomSheetScrollableProps;
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode, Ref } from "react";
2
- import type { View, ViewProps } from "react-native";
2
+ import type { ViewInstance, ViewProps } from "react-native";
3
3
  import type { SheetAnimation } from "../animation/animation.types";
4
4
  import type {
5
5
  SheetEvent,
@@ -42,7 +42,7 @@ export type UseSheetMachineOptions<S extends string, C, E extends SheetEvent> =
42
42
 
43
43
  export type BottomSheetStepsProps<S extends string, C, E extends SheetEvent> = Omit<ViewProps, "children"> & {
44
44
  children?: ReactNode;
45
- ref?: Ref<View>;
45
+ ref?: Ref<ViewInstance>;
46
46
  controller: SheetStepController<S, C, E>;
47
47
  /** How one step gives way to the next. @default "crossfade" */
48
48
  transition?: SheetStepTransition;
@@ -55,7 +55,7 @@ export type BottomSheetStepsProps<S extends string, C, E extends SheetEvent> = O
55
55
  };
56
56
 
57
57
  export type BottomSheetStepProps<S extends string = string> = ViewProps & {
58
- ref?: Ref<View>;
58
+ ref?: Ref<ViewInstance>;
59
59
  /** The step this body belongs to — a key of the machine's `states`. */
60
60
  name: S;
61
61
  };